browser_privacypane_*.js cause ASSERTION: XPConnect is being called on a scope without a 'Components' property due to no unregistration of autoStartPrivateBrowsingObserver

RESOLVED FIXED in Firefox 4.0b8

Status

()

Firefox
Private Browsing
RESOLVED FIXED
7 years ago
7 years ago

People

(Reporter: dbaron, Assigned: Away for a while)

Tracking

({assertion, mlk})

Trunk
Firefox 4.0b8
x86
Linux
assertion, mlk
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Reporter)

Description

7 years ago
Right after:
TEST-PASS | chrome://mochitests/content/browser/browser/components/preferences/tests/browser_privacypane_1.js | the clear data settings button should exist
(and then a few additional times later), I see:
###!!! ASSERTION: XPConnect is being called on a scope without a 'Components' property!  (stack follows): 'Error', file /builds/slave/tryserver-linux-debug/build/js/src/xpconnect/src/xpcwrappednativescope.cpp, line 781


The C++ stack is:

DEBUG_CheckForComponentsInScope [js/src/xpconnect/src/xpcwrappednativescope.cpp:782]
XPCWrappedNativeScope::FindInJSObjectScope [js/src/xpconnect/src/xpcwrappednativescope.cpp:857]
XPCConvert::NativeInterface2JSObject [js/src/xpconnect/src/xpcconvert.cpp:1164]
XPCConvert::NativeData2JS [js/src/xpconnect/src/xpcconvert.cpp:489]
XPCConvert::NativeData2JS [js/src/xpconnect/src/xpcprivate.h:3231]
nsXPCWrappedJSClass::CallMethod [js/src/xpconnect/src/xpcwrappedjsclass.cpp:1587]
nsXPCWrappedJS::CallMethod [js/src/xpconnect/src/xpcwrappedjs.cpp:588]
PrepareAndDispatch [xpcom/reflect/xptcall/src/md/unix/xptcstubs_gcc_x86_unix.cpp:95]
nsPrefBranch::NotifyObserver [modules/libpref/src/nsPrefBranch.cpp:731]
pref_DoCallback [modules/libpref/src/prefapi.cpp:970]
pref_HashPref [modules/libpref/src/prefapi.cpp:827]
PREF_SetBoolPref [modules/libpref/src/prefapi.cpp:312]
nsPrefBranch::SetBoolPref [modules/libpref/src/nsPrefBranch.cpp:182]
nsPrefService::SetBoolPref [modules/libpref/src/nsPrefService.h:62]
xptiInterfaceEntry::EnsureResolved [xpcom/reflect/xptinfo/src/xptiprivate.h:264]
CallMethodHelper::Invoke [js/src/xpconnect/src/xpcwrappednative.cpp:3042]
CallMethodHelper::Call [js/src/xpconnect/src/xpcwrappednative.cpp:2304]
XPCWrappedNative::CallMethod [js/src/xpconnect/src/xpcwrappednative.cpp:2268]
XPC_WN_CallMethod [js/src/xpconnect/src/xpcwrappednativejsops.cpp:1594]
js::CallJSNative [js/src/jscntxtinlines.h:684]
js::Interpret [js/src/jsinterp.cpp:4743]
js::RunScript [js/src/jsinterp.cpp:657]
js::Invoke [js/src/jsinterp.cpp:737]
js::ExternalInvoke [js/src/jsinterp.cpp:858]
js::ExternalInvoke [js/src/jsinterp.h:955]
js::ExternalGetOrSet [js/src/jsinterp.cpp:898]
js::Shape::set [js/src/jsscopeinlines.h:266]
js_SetPropertyHelper [js/src/jsobj.cpp:5310]
js::Interpret [js/src/jsinterp.cpp:4445]
js::RunScript [js/src/jsinterp.cpp:657]
js::Invoke [js/src/jsinterp.cpp:737]
js::ExternalInvoke [js/src/jsinterp.cpp:858]
js::ExternalInvoke [js/src/jsinterp.h:955]
js::ExternalGetOrSet [js/src/jsinterp.cpp:898]
js::Shape::set [js/src/jsscopeinlines.h:266]
js_SetPropertyHelper [js/src/jsobj.cpp:5310]
js::Interpret [js/src/jsinterp.cpp:4445]
js::RunScript [js/src/jsinterp.cpp:657]
js::Invoke [js/src/jsinterp.cpp:737]
js::ExternalInvoke [js/src/jsinterp.cpp:858]
js::ExternalInvoke [js/src/jsinterp.h:955]
JS_CallFunctionValue [js/src/jsapi.cpp:4973]
nsJSContext::CallEventHandler [dom/base/nsJSEnvironment.cpp:2177]
nsJSEventListener::HandleEvent [dom/src/events/nsJSEventListener.cpp:228]
nsEventListenerManager::HandleEventSubType [content/events/src/nsEventListenerManager.cpp:1114]
nsEventListenerManager::HandleEventInternal [content/events/src/nsEventListenerManager.cpp:1211]
nsEventListenerManager::HandleEvent [content/events/src/nsEventListenerManager.h:146]
nsEventTargetChainItem::HandleEvent [content/events/src/nsEventDispatcher.cpp:213]
nsEventTargetChainItem::HandleEventTargetChain [content/events/src/nsEventDispatcher.cpp:343]
nsEventDispatcher::Dispatch [content/events/src/nsEventDispatcher.cpp:628]
nsEventDispatcher::DispatchDOMEvent [content/events/src/nsEventDispatcher.cpp:691]
nsEventListenerManager::DispatchEvent [content/events/src/nsEventListenerManager.cpp:1328]
nsDOMEventRTTearoff::DispatchEvent [content/base/src/nsGenericElement.cpp:1970]
nsContentUtils::DispatchXULCommand [content/base/src/nsContentUtils.cpp:5522]
nsXULElement::DoCommand [content/xul/content/src/nsXULElement.cpp:2155]
nsIDOMXULElement_DoCommand [dom_quickstubs.cpp:25006]
js::CallJSNative [js/src/jscntxtinlines.h:684]
js::Interpret [js/src/jsinterp.cpp:4743]
js::RunScript [js/src/jsinterp.cpp:657]
js::Invoke [js/src/jsinterp.cpp:737]
js::ExternalInvoke [js/src/jsinterp.cpp:858]
js::ExternalInvoke [js/src/jsinterp.h:955]
JS_CallFunctionValue [js/src/jsapi.cpp:4973]
nsXPCWrappedJSClass::CallMethod [js/src/xpconnect/src/xpcwrappedjsclass.cpp:1694]
nsXPCWrappedJS::CallMethod [js/src/xpconnect/src/xpcwrappedjs.cpp:588]
PrepareAndDispatch [xpcom/reflect/xptcall/src/md/unix/xptcstubs_gcc_x86_unix.cpp:95]
nsEventListenerManager::HandleEventSubType [content/events/src/nsEventListenerManager.cpp:1114]
nsEventListenerManager::HandleEventInternal [content/events/src/nsEventListenerManager.cpp:1211]
nsEventListenerManager::HandleEvent [content/events/src/nsEventListenerManager.h:146]
nsEventTargetChainItem::HandleEvent [content/events/src/nsEventDispatcher.cpp:213]
nsEventTargetChainItem::HandleEventTargetChain [content/events/src/nsEventDispatcher.cpp:343]
nsEventDispatcher::Dispatch [content/events/src/nsEventDispatcher.cpp:628]
DocumentViewerImpl::LoadComplete [layout/base/nsDocumentViewer.cpp:1034]
nsDocShell::EndPageLoad [docshell/base/nsDocShell.cpp:6028]
nsDocShell::OnStateChange [docshell/base/nsDocShell.cpp:5881]
nsDocLoader::FireOnStateChange [uriloader/base/nsDocLoader.cpp:1318]
nsDocLoader::doStopDocumentLoad [uriloader/base/nsDocLoader.cpp:953]
nsDocLoader::DocLoaderIsEmpty [uriloader/base/nsDocLoader.cpp:820]
nsDocLoader::OnStopRequest [uriloader/base/nsDocLoader.cpp:705]
nsLoadGroup::RemoveRequest [netwerk/base/src/nsLoadGroup.cpp:680]
nsDocument::DoUnblockOnload [content/base/src/nsDocument.cpp:7269]
nsDocument::UnblockOnload [content/base/src/nsDocument.cpp:7210]
nsBindingManager::DoProcessAttachedQueue [content/xbl/src/nsBindingManager.cpp:999]
nsRunnableMethodImpl<void (nsBindingManager::*)(), true>::Run [nsThreadUtils.h:346]
nsThread::ProcessNextEvent [xpcom/threads/nsThread.cpp:626]
NS_ProcessNextEvent_P [nsThreadUtils.cpp:250]
mozilla::ipc::MessagePump::Run [ipc/glue/MessagePump.cpp:110]
MessageLoop::RunInternal [ipc/chromium/src/base/message_loop.cc:220]
MessageLoop::RunHandler [ipc/chromium/src/base/message_loop.cc:203]
MessageLoop::Run [ipc/chromium/src/base/message_loop.cc:176]
nsBaseAppShell::Run [widget/src/xpwidgets/nsBaseAppShell.cpp:187]
nsAppStartup::Run [toolkit/components/startup/src/nsAppStartup.cpp:191]
XRE_main [toolkit/xre/nsAppRunner.cpp:3691]
main [browser/app/nsBrowserApp.cpp:158]



The JS stack at the time of the assertion is:

The current JS stack is:
JSStackFrame at 0xb2dfd2e8
callee fun: <function set_valueFromPreferences at 0xaf449188 (JSFunction at 0xaf6b3f50)>
file chrome://global/content/bindings/preferences.xml line 325
  pc = 0xaab74bc
  current op: call
  slots: 0xb2dfd318
  sp:    0xb2dfd350 = slots + 7
    0xb2dfd318: undefined
    0xb2dfd320: undefined
    0xb2dfd328: undefined
    0xb2dfd330: undefined
    0xb2dfd338: <XPCWrappedNative_NoHelper object at 0xaf4041c0>
    0xb2dfd340: "browser.privatebrowsing.autostart"
    0xb2dfd348: false
  actuals: 0xb2dfd2e0 (1)   formals: 0xb2dfd2e0 (1)
  this: <XULElement object at 0xaf4497e0>
  rval: undefined
  flags:
  scopeChain: (JSObject *) 0xaf45a370

JSStackFrame at 0xb2dfd290
callee fun: <function _setValue at 0xaf4b3dc8 (JSFunction at 0xaf6b3af0)>
file chrome://global/content/bindings/preferences.xml line 158
  pc = 0xc835c12
  current op: setprop
  slots: 0xb2dfd2c0
  sp:    0xb2dfd2e8 = slots + 5
    0xb2dfd2c0: <XULElement object at 0xaf4497e0>
    0xb2dfd2c8: false
    0xb2dfd2d0: <function set_valueFromPreferences at 0xaf449188 (JSFunction at 0xaf6b3f50)>
    0xb2dfd2d8: <XULElement object at 0xaf4497e0>
    0xb2dfd2e0: false
  actuals: 0xb2dfd280 (2)   formals: 0xb2dfd280 (2)
  this: <XULElement object at 0xaf4497e0>
  rval: undefined
  flags:
  scopeChain: (JSObject *) 0xaf45a370

JSStackFrame at 0xb2dfd240
callee fun: <function set_value at 0xaf4b3e38 (JSFunction at 0xaf6b3b90)>
file chrome://global/content/bindings/preferences.xml line 0
  pc = 0xc4b5ba8
  current op: call
  slots: 0xb2dfd270
  sp:    0xb2dfd290 = slots + 4
    0xb2dfd270: <function _setValue at 0xaf4b3dc8 (JSFunction at 0xaf6b3af0)>
    0xb2dfd278: <XULElement object at 0xaf4497e0>
    0xb2dfd280: false
    0xb2dfd288: true
  actuals: 0xb2dfd238 (1)   formals: 0xb2dfd238 (1)
  this: <XULElement object at 0xaf4497e0>
  rval: undefined
  flags:
  scopeChain: (JSObject *) 0xaf45a370

JSStackFrame at 0xb2dfd1d8
callee fun: <function PPP_updateHistoryModePrefs at 0xaf4b3038 (JSFunction at 0xaa80ed70)>
file chrome://browser/content/preferences/privacy.js line 127
  pc = 0xacce683
  current op: setprop
  slots: 0xb2dfd208
  sp:    0xb2dfd240 = slots + 7
    0xb2dfd208: <XULElement object at 0xaf4497e0>
    0xb2dfd210: undefined
    0xb2dfd218: <XULElement object at 0xaf4497e0>
    0xb2dfd220: false
    0xb2dfd228: <function set_value at 0xaf4b3e38 (JSFunction at 0xaf6b3b90)>
    0xb2dfd230: <XULElement object at 0xaf4497e0>
    0xb2dfd238: false
  actuals: 0xb2dfd1d8 (0)   formals: 0xb2dfd1d8 (0)
  this: <Object at 0xaf45a5a0>
  rval: undefined
  flags:
  scopeChain: (JSObject *) 0xaf45a370

JSStackFrame at 0xb2dfd198
callee fun: <function oncommand at 0xaf436b60 (JSFunction at 0xa9c551e0)>
file chrome://browser/content/preferences/preferences.xul line 1
  pc = 0xcc2a404
  current op: call
  slots: 0xb2dfd1c8
  sp:    0xb2dfd1d8 = slots + 2
    0xb2dfd1c8: <function PPP_updateHistoryModePrefs at 0xaf4b3038 (JSFunction at 0xaa80ed70)>
    0xb2dfd1d0: <Object at 0xaf45a5a0>
  actuals: 0xb2dfd190 (1)   formals: 0xb2dfd190 (1)
  this: <XULElement object at 0xaf457348>
  rval: undefined
  flags:
  scopeChain: (JSObject *) 0xaf457348

JSStackFrame at 0xb2dfd140
callee fun: <function controlChanged at 0xaa8eb960 (JSFunction at 0xaa8eb960)>
file chrome://mochitests/content/browser/browser/components/preferences/tests/browser_privacypane_1.js -> file:///tmp/tmp9hWEkc/mochikit-1.tmp/privacypane_tests.js line 64
  pc = 0xb8995ae
  current op: call
  slots: 0xb2dfd170
  sp:    0xb2dfd198 = slots + 5
    0xb2dfd170: <function doCommand at 0xaf6cbf50 (JSFunction at 0xaf6cbf50)>
    0xb2dfd178: <XULElement object at 0xaf457348>
    0xb2dfd180: <function oncommand at 0xaf436b60 (JSFunction at 0xa9c551e0)>
    0xb2dfd188: <XULElement object at 0xaf457348>
    0xb2dfd190: <XULCommandEvent object at 0xaf436c78>
  actuals: 0xb2dfd138 (1)   formals: 0xb2dfd138 (1)
  this: <Object at 0xa1e20d38>
  rval: undefined
  flags:
  scopeChain: (JSObject *) 0xa1e20d38

JSStackFrame at 0xb2dfd090
callee fun: <function test_dependent_elements at 0xaa8eba00 (JSFunction at 0xaa8eba00)>
file chrome://mochitests/content/browser/browser/components/preferences/tests/browser_privacypane_1.js -> file:///tmp/tmp9hWEkc/mochikit-1.tmp/privacypane_tests.js line 88
  pc = 0xd883744
  current op: call
  slots: 0xb2dfd0c0
  sp:    0xb2dfd140 = slots + 16
    0xb2dfd0c0: <XULElement object at 0xaf457348>
    0xb2dfd0c8: <XULElement object at 0xaf481188>
    0xb2dfd0d0: <Array object at 0xaf6ac7b8>
    0xb2dfd0d8: <Array object at 0xaf436a10>
    0xb2dfd0e0: <XULElement object at 0xaf481b98>
    0xb2dfd0e8: <XULElement object at 0xaf4a6118>
    0xb2dfd0f0: <XULElement object at 0xaf4a64d0>
    0xb2dfd0f8: <XULElement object at 0xaf481540>
    0xb2dfd100: <XULElement object at 0xaf4815b0>
    0xb2dfd108: <XULElement object at 0xaf4815e8>
    0xb2dfd110: <XULElement object at 0xaf4a6508>
    0xb2dfd118: <function expect_disabled at 0xaf436968 (JSFunction at 0xaa8ebaf0)>
    0xb2dfd120: <function check_independents at 0xaf4369a0 (JSFunction at 0xaa8ebb90)>
    0xb2dfd128: <function controlChanged at 0xaa8eb960 (JSFunction at 0xaa8eb960)>
    0xb2dfd130: <Object at 0xa1e20d38>
    0xb2dfd138: <XULElement object at 0xaf457348>
  actuals: 0xb2dfd088 (1)   formals: 0xb2dfd088 (1)
  this: undefined
  rval: undefined
  flags:
  scopeChain: (JSObject *) 0xa1e20d38

JSStackFrame at 0xb2dfd048
callee fun: <unnamed function at 0xabd017e0 (JSFunction at 0xaa8eb910)>
file chrome://mochitests/content/browser/browser/components/preferences/tests/browser_privacypane_1.js -> file:///tmp/tmp9hWEkc/mochikit-1.tmp/privacypane_tests.js line 45
  pc = 0xb59b156
  current op: call
  slots: 0xb2dfd078
  sp:    0xb2dfd090 = slots + 3
    0xb2dfd078: <function test_dependent_elements at 0xaa8eba00 (JSFunction at 0xaa8eba00)>
    0xb2dfd080: undefined
    0xb2dfd088: <Proxy object at 0xa1ef5d80>
  actuals: 0xb2dfd030 (1)   formals: 0xb2dfd048 (0)
  argsobj: <Arguments object at 0xaf436930>
  this: <Proxy object at 0xa1ef5d80>
  rval: undefined
  flags:
  scopeChain: (JSObject *) 0xabd017a8




And the object whose scope lacks a 'Components' property is:
object 0xab01c460
class 0x34a4380 Object
flags: none
properties:
    enumerate "observe": slot 1
    enumerate "QueryInterface": slot 0
proto <Object at 0xaf7b22a8>
parent <ChromeWindow object at 0xaf7b2258>
slots:
   0 = <function XPCOMUtils_QueryInterface at 0xab01c8f8 (JSFunction at 0xb2c0bc80)>
   1 = <function PPP_observe at 0xab01c930 (JSFunction at 0xaa80eeb0)>

which is the autoStartPrivateBrowsingObserver object in browser/components/preferences/privacy.js.


As far as I can tell, privacy.js never calls removeObserver on this observer.  (I'm a bit confused as to what this code is doing, and why this observer is associated with pref window code.)
(Reporter)

Comment 1

7 years ago
Calls to this observer are responsible for 177 assertions during mochitest-other on Linux.
(Reporter)

Updated

7 years ago
Summary: browser_privacypane_1.js causes ASSERTION: XPConnect is being called on a scope without a 'Components' property → browser_privacypane_*.js cause ASSERTION: XPConnect is being called on a scope without a 'Components' property due to no unregistration of autoStartPrivateBrowsingObserver
(Reporter)

Updated

7 years ago
Blocks: 510489
(Reporter)

Updated

7 years ago
Keywords: mlk
(Assignee)

Comment 2

7 years ago
Created attachment 493428 [details] [diff] [review]
Patch (v1)
Attachment #493428 - Flags: review?(gavin.sharp)
(Assignee)

Updated

7 years ago
Assignee: nobody → ehsan
Status: NEW → ASSIGNED
Comment on attachment 493428 [details] [diff] [review]
Patch (v1)

Per IRC, let's just make uninitAutoStartPrivateBrowsingObserver.bind(this) the unload handler directly, and maybe give it a shorter name like removePBObserver or something. r=me with that.
Attachment #493428 - Flags: review?(gavin.sharp) → review+
(Assignee)

Comment 4

7 years ago
Created attachment 493438 [details] [diff] [review]
Patch (v2)

Comments addressed.
Attachment #493428 - Attachment is obsolete: true
Attachment #493438 - Flags: approval2.0?
Attachment #493438 - Flags: approval2.0? → approval2.0+
(Assignee)

Comment 5

7 years ago
http://hg.mozilla.org/mozilla-central/rev/30f1fb628aa6
Status: ASSIGNED → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 4.0b8
You need to log in before you can comment on or make changes to this bug.