Closed Bug 1097354 Opened 5 years ago Closed 5 years ago

Manual mochitest run on Yosemite starts with "adding an unknown subview" error message and stack trace

Categories

(Testing :: Mochitest, defect)

x86_64
macOS
defect
Not set

Tracking

(Not tracked)

RESOLVED FIXED
mozilla36

People

(Reporter: drno, Assigned: mstange)

References

Details

Attachments

(1 file)

If I manually start a mochitest execution on my MacBook Pro running Yosemite like this:

./mach mochitest dom/media/tests/mochitest/test_dataChannel_basicAudio.html

I always get a stack trace at the beginning:

runtests.py | Application pid: 25404
### XPCOM_MEM_BLOAT_LOG defined -- logging bloat/leaks to /var/folders/3g/bm146dzn2zs42vgkw80svyx80000gn/T/tmpK0xIWM.mozrunner/runtests_leaks.log
JavaScript warning: resource://gre/modules/Preferences.jsm, line 381: mutating the [[Prototype]] of an object will cause your code to run very slowly; instead create the object with the correct initial [[Prototype]] value using Object.create
++DOCSHELL 0x11af28000 == 1 [pid = 25404] [id = 1]
++DOMWINDOW == 1 (0x119f9b800) [pid = 25404] [serial = 1] [outer = 0x0]
++DOMWINDOW == 2 (0x119f9cc00) [pid = 25404] [serial = 2] [outer = 0x119f9b800]
2014-11-11 15:59:34.544 firefox[25404:4653236] NSWindow warning: adding an unknown subview: <NSView: 0x11d18e8e0>
2014-11-11 15:59:34.655 firefox[25404:4653236] Call stack:
(
	0   AppKit                              0x00007fff8bcebb3c -[NSThemeFrame addSubview:] + 107
	1   AppKit                              0x00007fff8b6dab8f -[NSView addSubview:positioned:relativeTo:] + 208
	2   XUL                                 0x0000000104a6322e -[BaseWindow setContentView:] + 174
	3   AppKit                              0x00007fff8b6475e5 -[NSWindow _initContent:styleMask:backing:defer:contentView:] + 1630
	4   AppKit                              0x00007fff8b646f7a -[NSWindow initWithContentRect:styleMask:backing:defer:] + 45
	5   XUL                                 0x0000000104a617c9 -[BaseWindow initWithContentRect:styleMask:backing:defer:] + 185
	6   XUL                                 0x0000000104a6369f -[ToolbarWindow initWithContentRect:styleMask:backing:defer:] + 175
	7   XUL                                 0x0000000104a580b5 _ZN13nsCocoaWindow18CreateNativeWindowERK6CGRect13nsBorderStyleb + 1573
	8   XUL                                 0x0000000104a5760a _ZN13nsCocoaWindow6CreateEP9nsIWidgetPvRK9nsIntRectP15nsDeviceContextP16nsWidgetInitData + 378
	9   XUL                                 0x00000001055d0d0b _ZN16nsWebShellWindow10InitializeEP12nsIXULWindowS1_P6nsIURIiibP12nsITabParentR16nsWidgetInitData + 1227
	10  XUL                                 0x00000001055ce395 _ZN17nsAppShellService19JustCreateTopWindowEP12nsIXULWindowP6nsIURIjiibP12nsITabParentPP16nsWebShellWindow + 1909
	11  XUL                                 0x00000001055cec8b _ZN17nsAppShellService20CreateTopLevelWindowEP12nsIXULWindowP6nsIURIjiiP12nsITabParentPS1_ + 155
	12  XUL                                 0x00000001059139b3 _ZN12nsAppStartup19CreateChromeWindow2EP19nsIWebBrowserChromejjP6nsIURIP12nsITabParentPbPS1_ + 931
	13  XUL                                 0x0000000105913b9b _ZThn8_N12nsAppStartup19CreateChromeWindow2EP19nsIWebBrowserChromejjP6nsIURIP12nsITabParentPbPS1_ + 107
	14  XUL                                 0x000000010556b586 _ZN15nsWindowWatcher18OpenWindowInternalEP12nsIDOMWindowPKcS3_S3_bbbP12nsITabParentP8nsIArrayPS1_ + 5766
	15  XUL                                 0x00000001055697bf _ZN15nsWindowWatcher10OpenWindowEP12nsIDOMWindowPKcS3_S3_P11nsISupportsPS1_ + 367
	16  XUL                                 0x0000000101715342 NS_InvokeByIndex + 578
	17  XUL                                 0x00000001024b19d8 _ZN16CallMethodHelper6InvokeEv + 88
	18  XUL                                 0x00000001024a1b07 _ZN16CallMethodHelper4CallEv + 263
	19  XUL                                 0x0000000102480484 _ZN16XPCWrappedNative10CallMethodER14XPCCallContextNS_8CallModeE + 260
	20  XUL                                 0x0000000102482658 _Z17XPC_WN_CallMethodP9JSContextjPN2JS5ValueE + 920
	21  XUL                                 0x00000001071b3f65 _ZN2js12CallJSNativeEP9JSContextPFbS1_jPN2JS5ValueEERKNS2_8CallArgsE + 165
	22  XUL                                 0x000000010713655d _ZN2js6InvokeEP9JSContextN2JS8CallArgsENS_14MaybeConstructE + 1261
	23  XUL                                 0x000000010715731c _ZL9InterpretP9JSContextRN2js8RunStateE + 51196
	24  XUL                                 0x000000010714aabb _ZN2js9RunScriptEP9JSContextRNS_8RunStateE + 667
	25  XUL                                 0x00000001071366a1 _ZN2js6InvokeEP9JSContextN2JS8CallArgsENS_14MaybeConstructE + 1585
	26  XUL                                 0x0000000107122c64 _ZN2js6InvokeEP9JSContextRKN2JS5ValueES5_jPS4_NS2_13MutableHandleIS3_EE + 900
	27  XUL                                 0x0000000106ef0e91 _Z20JS_CallFunctionValueP9JSContextN2JS6HandleIP8JSObjectEENS2_INS1_5ValueEEERKNS1_16HandleValueArrayENS1_13MutableHandleIS6_EE + 337
	28  XUL                                 0x0000000102475dec _ZN19nsXPCWrappedJSClass10CallMethodEP14nsXPCWrappedJStPK19XPTMethodDescriptorP17nsXPTCMiniVariant + 6428
	29  XUL                                 0x000000010246fbbb _ZN14nsXPCWrappedJS10CallMethodEtPK19XPTMethodDescriptorP17nsXPTCMiniVariant + 203
	30  XUL                                 0x0000000101716e76 PrepareAndDispatch + 1654
	31  XUL                                 0x000000010171588b SharedStub + 91
	32  XUL                                 0x00000001057e396b _ZL7EnumRunP21nsICommandLineHandlerP14nsICommandLinePv + 59
	33  XUL                                 0x00000001057e2f0b _ZN13nsCommandLine17EnumerateHandlersEPF12tag_nsresultP21nsICommandLineHandlerP14nsICommandLinePvES5_ + 1323
	34  XUL                                 0x00000001057e38af _ZN13nsCommandLine3RunEv + 95
	35  XUL                                 0x00000001059bee3a _ZN7XREMain11XRE_mainRunEv + 5834
	36  XUL                                 0x00000001059bf85e _ZN7XREMain8XRE_mainEiPPcPK12nsXREAppData + 798
	37  XUL                                 0x00000001059bfd22 XRE_main + 98
	38  firefox                             0x0000000100002d1e _ZL7do_mainiPPcP7nsIFile + 1950
	39  firefox                             0x0000000100002083 main + 323
	40  firefox                             0x0000000100001ae4 start + 52
	41  ???                                 0x0000000000000005 0x0 + 5
)
++DOCSHELL 0x11d16f800 == 2 [pid = 25404] [id = 2]
++DOMWINDOW == 3 (0x11d198400) [pid = 25404] [serial = 3] [outer = 0x0]
++DOMWINDOW == 4 (0x11d199000) [pid = 25404] [serial = 4] [outer = 0x11d198400]
JavaScript strict warning: resource://gre/modules/Webapps.jsm, line 575: ReferenceError: reference to undefined property Components.classes['@mozilla.org/app-migrator;1']
-*- Webapps.jsm : Exception running app migration:
-*- Webapps.jsm : TypeError Components.classes['@mozilla.org/app-migrator;1'] is undefined
-*- Webapps.jsm : Skipping app migration.
-*- Webapps.jsm : Saving /var/folders/3g/bm146dzn2zs42vgkw80svyx80000gn/T/tmpK0xIWM.mozrunner/webapps/webapps.json
JavaScript strict warning: resource://gre/modules/AppsUtils.jsm, line 760: ReferenceError: reference to undefined property this._manifest[aProp]
JavaScript strict warning: resource://gre/modules/Webapps.jsm, line 390: ReferenceError: reference to undefined property aResult.redirects
-*- Webapps.jsm : Saving /var/folders/3g/bm146dzn2zs42vgkw80svyx80000gn/T/tmpK0xIWM.mozrunner/webapps/webapps.json
-*- Webapps.jsm : Success saving /var/folders/3g/bm146dzn2zs42vgkw80svyx80000gn/T/tmpK0xIWM.mozrunner/webapps/webapps.json
[25404] WARNING: Loaded script chrome://global/content/printUtils.js twice (bug 392650): file /Users/nohlmeier/src/mozilla-central/dom/xul/nsXULPrototypeCache.cpp, line 216
I've seen this too, occasionally -- and not in tests.  But it seems benign, and I haven't yet had a chance to investigate.

Markus:  Have you seen this, and do you have any ideas about why it's happening?
It happens when we reorder the content view to be underneath the titlebar buttons in our override of -[NSWindow setContentView:] here: http://hg.mozilla.org/mozilla-central/annotate/688f821edcd4/widget/cocoa/nsCocoaWindow.mm#l2946
10.10 doesn't want people messing with the subviews of the window's frame view and prints a warning. Chrome has had the same problem and fixed it by calling -[NSThemeFrame _addKnownSubview:positioned:relativeTo:] instead. We could just do the same.
Attached patch patchSplinter Review
I haven't tested this yet, will do so before landing (unless you want to do it).
Assignee: nobody → mstange
Status: NEW → ASSIGNED
Attachment #8521675 - Flags: review?(smichaud)
Comment on attachment 8521675 [details] [diff] [review]
patch

Markus, could you test this first? :-)
Comment on attachment 8521675 [details] [diff] [review]
patch

> Markus, could you test this first? :-)

Actually nevermind.  I'll test it myself later this afternoon.

Apparently this is already being used in Google's WebKit clone, here:
https://webkit.googlesource.com/WebKit/+/master/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm
I just tried the patch locally on my system and I no longer get the stack trace at startup of mochitest.
I tested with a recent nightly and didn't see the stack trace at all.

Now I'm testing with self builds.  I expect you'll only see the stack trace if you build with the 10.10 SDK, or if you build on Yosemite without specifying any SDK.  I'll report back once I've figured it out.
Comment on attachment 8521675 [details] [diff] [review]
patch

This looks good to me.  I've now tested it and found no problems.  It fixes the bug for me.

Yes, the "adding an unknown subview" messages only show up if you've built (on Yosemite) with the 10.10 SDK (or without specifying an SDK, which amounts to the same thing).  Even specifying a much older "macos-target" (like 10.6) makes no difference.

When I looked in the AppKit framework (using Hopper Disassembler), I found code in the -[NSThemeFrame addSubview:] method which only displays this error message if _CFExecutableLinkedOnOrAfter(0xa) returns 'true'.  Presumably the '0xa' == '10' refers to the OS X major version number.
Attachment #8521675 - Flags: review?(smichaud) → review+
Summary: Manual mochitest run on Yosemite starts with stack trace → Manual mochitest run on Yosemite starts with "adding an unknown subview" error message and stack trace
https://hg.mozilla.org/mozilla-central/rev/9509628adfe4
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla36
Depends on: 1102304
You need to log in before you can comment on or make changes to this bug.