Comment 11 for bug 215672

Revision history for this message
In , Jst (jst) wrote :

Here's the JS stack when we get the error about getElementById("dontShowPrivacyStatement") returning null:

1 setPrivacyPref() ["chrome://reporter/content/reportWizard.js":118]
2 anonymous(event = [object Event @ 0xa086c80 (native @ 0xa428b50)]) ["chrome://global/content/bindings/wizard.xml":410]
3 _fireEvent(aType = "pageadvanced", aTarget = [object XULElement @ 0x9fcac80 (native @ 0xa25c910)]) ["chrome://global/content/bindings/wizard.xml":411]
4 advance(aPageId = undefined) ["chrome://global/content/bindings/wizard.xml":257]
5 initPrivacyNotice() ["chrome://reporter/content/reportWizard.js":98]
6 anonymous(event = [object Event @ 0xa02c440 (native @ 0xa422940)]) ["chrome://global/content/bindings/wizard.xml":410]
7 _fireEvent(aType = "pageshow", aTarget = [object XULElement @ 0x9fcac80 (native @ 0xa25c910)]) ["chrome://global/content/bindings/wizard.xml":411]
8 set_currentPage(val = [object XULElement @ 0x9fcac80 (native @ 0xa25c910)]) ["chrome://global/content/bindings/wizard.xml":94]
9 advance(aPageId = undefined) ["chrome://global/content/bindings/wizard.xml":284]
10 () ["chrome://global/content/bindings/wizard.xml":199]

And the C++ stack is rougly this:

#0 nsXULDocument::GetElementById (this=0xa24c000, aId=@0xbffcdac4,
    aReturn=0xbffcd830)
#1 0x00366a65 in NS_InvokeByIndex_P ()
#2 0x0726f457 in XPCWrappedNative::CallMethod (ccx=@0xbffcda50,
    mode=XPCWrappedNative::CALL_METHOD)
[...]
#19 0x001aaa7f in JS_CallFunctionValue (cx=0xa010c80, obj=0x9ecd140,
    fval=166517248, argc=0, argv=0x0, rval=0xbffcfbb8)
#20 0x08635746 in nsXBLProtoImplAnonymousMethod::Execute (this=0xa5bd1a0,
    aBoundElement=0xa27a6d0)
#21 0x0862a291 in nsXBLPrototypeBinding::BindingAttached (this=0x9f98800,
    aBoundElement=0xa27a6d0)
#22 0x08623637 in nsXBLBinding::ExecuteAttachedHandler (this=0xa451480)
#23 0x086e6676 in nsElementSH::PostCreate (this=0x9ace680, wrapper=0x9f80180,
    cx=0x9676360, obj=0x9ecd140)
#24 0x07274565 in XPCWrappedNative::GetNewOrUsed (ccx=@0xbffd0058,
    Object=0xa27a6d0, Scope=0x9b50200, Interface=0x96d3f00, isGlobal=0,
    resultWrapper=0xbffcffbc)
[...]
#27 0x07221f40 in nsXPConnect::WrapNative (this=0x96edbc0,
    aJSContext=0x9676360, aScope=0x996a1a0, aCOMObj=0xa27a6d0,
    aIID=@0x897f890, _retval=0xbffd0120)
#28 0x086df602 in nsDOMClassInfo::WrapNative (cx=0x9676360, scope=0x996a1a0,
    native=0xa27a6d0, aIID=@0x897f890, vp=0xbffd0190, aHolder=0xbffd018c)
#29 0x086e05de in nsNodeSH::PreCreate (this=0x9ace680, nativeObj=0xa25c910,
    cx=0x9676360, globalObj=0x996a1a0, parentObj=0xbffd0294)
#30 0x07273d20 in XPCWrappedNative::GetNewOrUsed (ccx=@0xbffd03d8,
    Object=0xa25c910, Scope=0x999e380, Interface=0x96d3f00, isGlobal=0,
    resultWrapper=0xbffd033c)
[...]
#38 0x086df602 in nsDOMClassInfo::WrapNative (cx=0x9676360, scope=0x996a1a0,
    native=0xa25c9a0, aIID=@0x897f890, vp=0xbffd0890, aHolder=0xbffd088c)
#39 0x086e05de in nsNodeSH::PreCreate (this=0x9ace680, nativeObj=0xa25c9d0,
    cx=0x9676360, globalObj=0x996a1a0, parentObj=0xbffd0994)
#40 0x07273d20 in XPCWrappedNative::GetNewOrUsed (ccx=@0xbffd0bf0,
    Object=0xa25c9ec, Scope=0x999e380, Interface=0x96d3f00, isGlobal=0,
    resultWrapper=0xbffd0a3c)
#41 0x072449ff in XPCConvert::NativeInterface2JSObject (ccx=@0xbffd0bf0,
    dest=0xbffd0b10, src=0xa25c9ec, iid=0xbffd0d40, scope=0x99ce6e0,
    allowNativeWrapper=1, isGlobal=0, pErr=0x0)
#42 0x07248282 in XPCConvert::NativeData2JS (ccx=@0xbffd0bf0, d=0xbffd0cec,
    s=0xbffd0ee8, type=@0xbffd0d71, iid=0xbffd0d40, scope=0x99ce6e0, pErr=0x0)
#43 0x072672f4 in nsXPCWrappedJSClass::CallMethod (this=0x99ff910,
    wrapper=0x9c5a5c0, methodIndex=3, info=0x99ee1a8, nativeParams=0xbffd0ed0)
#44 0x0725ec71 in nsXPCWrappedJS::CallMethod (this=0x9c5a5c0, methodIndex=3,
    info=0x99ee1a8, params=0xbffd0ed0)
#45 0x003678f6 in PrepareAndDispatch (methodIndex=3, self=0x9c4a630,
    args=0xbffd0f94)
#46 0x083f1db4 in nsContentPolicy::CheckPolicy (this=0x9999f70,
    policyMethod=<error reading variable>, contentType=6,
    contentLocation=0xa263ab0, requestingLocation=0xa1ed0e0,
    requestingContext=0xa25c9ec, mimeType=@0x3aa410, extra=0x0,
    decision=0xbffd13fe)
#47 0x083f10c2 in nsContentPolicy::ShouldLoad (this=0x9999f70, contentType=6,
    contentLocation=0xa263ab0, requestingLocation=0x0,
    requestingContext=0xa25c9ec, mimeType=@0x3aa410, extra=0x0,
    decision=0xbffd13fe)
#48 0x077ed45d in NS_CheckContentLoadPolicy (contentType=6,
    contentLocation=0xa263ab0, originPrincipal=0x0, context=0xa25c9ec,
    mimeType=@0x3aa410, extra=0x0, decision=0xbffd13fe, policyService=0x0,
    aSecMan=0x0)
#49 0x077ccb17 in nsDocShell::InternalLoad (this=0x96413e0, aURI=0xa263ab0,
    aReferrer=0x0, aOwner=0x0, aFlags=1, aWindowTarget=0x961f2b8,
    aTypeHint=0x0, aPostData=0x0, aHeadersData=0x0, aLoadType=1, aSHEntry=0x0,
    aFirstParty=0, aDocShell=0x0, aRequest=0x0)
[...]
#54 0x084471a8 in nsFrameLoader::LoadFrame (this=0xa41e4c0)
#55 0x087a2551 in nsXULElement::LoadSrc (this=0xa25c9d0)
#56 0x087a4eeb in nsXULElement::BindToTree (this=0xa25c9d0,
    aDocument=0xa24c000, aParent=0xa25c9a0, aBindingParent=0x0,
    aCompileEventHandlers=1)
#57 0x08457fa5 in nsGenericElement::doInsertChildAt (aKid=0xa25c9d0, aIndex=0,
    aNotify=0, aParent=0xa25c9a0, aDocument=0xa24c000, aChildArray=@0xa25c9b8)
#58 0x08458210 in nsGenericElement::InsertChildAt (this=0xa25c9a0,
    aKid=0xa25c9d0, aIndex=0, aNotify=0)
#59 0x087a2f00 in nsXULElement::InsertChildAt (this=0xa25c9a0, aKid=0xa25c9d0,
    aIndex=0, aNotify=0)
#60 0x0812c5eb in nsINode::AppendChildTo (this=0xa25c9a0, aKid=0xa25c9d0,
    aNotify=0)
#61 0x0865fd1f in nsXULDocument::ResumeWalk (this=0xa24c000)
#62 0x08660ce2 in nsXULDocument::OnStreamComplete ()

So it looks like we're executing an XBL constructor sooner than we should because of the content policy check that goes out into JS and thus wraps a DOM node... Cc:ing Jonas as he's been all over the XBL code recently.