Open
Bug 681392
Opened 13 years ago
Updated 2 months ago
window opened with window.open does not have SpecialPowers object
Categories
(Testing :: Mochitest, defect)
Tracking
(Not tracked)
REOPENED
mozilla9
People
(Reporter: arno, Unassigned)
References
(Blocks 2 open bugs)
Details
Attachments
(1 file, 4 obsolete files)
1.03 KB,
patch
|
ted
:
review+
|
Details | Diff | Splinter Review |
Hi, when a mochitest opens a window with window.open, newly opened window does not have SpecialPowers object. So, many tests in docshell/test/chrome prints an exception about that (but for some reason, do not appear to fail; or at least, fail silently). Here are some extracts from a random log on try server: 2954 INFO TEST-INFO | chrome://mochitests/content/chrome/docshell/test/chrome/test_bug293235.xul | [SimpleTest/SimpleTest.js, window.onerror] An error occurred: SpecialPowers is not defined at chrome://mochikit/content/tests/SimpleTest/WindowSnapshot.js:12 2966 INFO TEST-INFO | chrome://mochitests/content/chrome/docshell/test/chrome/test_bug298622.xul | [SimpleTest/SimpleTest.js, window.onerror] An error occurred: SpecialPowers is not defined at chrome://mochitests/content/chrome/docshell/test/chrome/docshell_helpers.js:403 2969 INFO TEST-INFO | chrome://mochitests/content/chrome/docshell/test/chrome/test_bug301397.xul | [SimpleTest/SimpleTest.js, window.onerror] An error occurred: SpecialPowers is not defined at chrome://mochitests/content/chrome/docshell/test/chrome/docshell_helpers.js:403 2993 INFO TEST-INFO | chrome://mochitests/content/chrome/docshell/test/chrome/test_bug321671.xul | [SimpleTest/SimpleTest.js, window.onerror] An error occurred: SpecialPowers is not defined at chrome://mochitests/content/chrome/docshell/test/chrome/docshell_helpers.js:403 3574 INFO TEST-INFO | chrome://mochitests/content/chrome/docshell/test/chrome/test_bug396649.xul | [SimpleTest/SimpleTest.js, window.onerror] An error occurred: SpecialPowers is not defined at chrome://mochitests/content/chrome/docshell/test/chrome/docshell_helpers.js:403 3614 INFO TEST-INFO | chrome://mochitests/content/chrome/docshell/test/chrome/test_bug582176.xul | [SimpleTest/SimpleTest.js, window.onerror] An error occurred: SpecialPowers is not defined at chrome://mochitests/content/chrome/docshell/test/chrome/docshell_helpers.js:403 3667 INFO TEST-INFO | chrome://mochitests/content/chrome/docshell/test/chrome/test_bug89419.xul | [SimpleTest/SimpleTest.js, window.onerror] An error occurred: SpecialPowers is not defined at chrome://mochikit/content/tests/SimpleTest/WindowSnapshot.js:12 10838 INFO TEST-INFO | chrome://mochitests/content/chrome/layout/generic/test/test_bug514732-2.xul | [SimpleTest/SimpleTest.js, window.onerror] An error occurred: SpecialPowers is not defined at chrome://mochikit/content/tests/SimpleTest/docshell_helpers.js:403
Comment 1•13 years ago
|
||
I'm quite sure Joel hit this, but I don't know that we ever figured out why.
Comment 3•13 years ago
|
||
Attachment #555175 -
Flags: review?(ted.mielczarek)
Reporter | ||
Comment 4•13 years ago
|
||
I tested your patch, and it fails on my machine TEST_PATH=docshell/test/chrome/ make -C $OBJDIR mochitest-chrome opens http://mochi.test:8888/redirect.html and fails with following error: Error: docshell is not defined Source File: chrome://specialpowers/content/specialpowers.js Line: 445 By the way, would this solution ever work ? In those docshell tests, top level window is used for testing. Ie: they have no browser or iframe. So, will this._messageManager.loadFrameScript reach them ?
Comment 5•13 years ago
|
||
You're right that this patch doesn't appear to help with your situation. I'm going to need to talk with Joel about what you're seeing, because all of the existing SpecialPowers-in-mochitest-chrome goop doesn't appear to help there. And you are absolutely right about this patch being broken - it just happened to work because the error thrown caused the early return to be skipped.
Attachment #556010 -
Flags: review?(ted.mielczarek)
Updated•13 years ago
|
Attachment #555175 -
Attachment is obsolete: true
Attachment #555175 -
Flags: review?(ted.mielczarek)
Comment 6•13 years ago
|
||
Just an extra change to ensure we don't leak docshells.
Attachment #556011 -
Flags: review?(ted.mielczarek)
Updated•13 years ago
|
Attachment #556010 -
Attachment is obsolete: true
Attachment #556010 -
Flags: review?(ted.mielczarek)
Comment 7•13 years ago
|
||
While this patch is almost correct (I inversed the shouldAttach condition D:), I think we might be able to get away with just removing the shouldAttach logic entirely. I did a try run of a patch that did just that and it came back super green. http://tbpl.allizom.org/?tree=Try&usebuildbot=1&rev=84710cbbd23a
Updated•13 years ago
|
Blocks: sync-about-blank
Comment 9•13 years ago
|
||
If that works let's just do that. I don't really know why that logic is there in the first place.
Updated•13 years ago
|
Attachment #556011 -
Attachment is obsolete: true
Attachment #556011 -
Flags: review?(ted.mielczarek)
Comment 10•13 years ago
|
||
Attachment #558470 -
Flags: review?(ted.mielczarek)
Comment 11•13 years ago
|
||
Comment on attachment 558470 [details] [diff] [review] Remove about: exclusion from SpecialPowers creation. Review of attachment 558470 [details] [diff] [review]: ----------------------------------------------------------------- I don't really know why this was here in the first place. I think it got copy/pasted from something else.
Attachment #558470 -
Flags: review?(ted.mielczarek) → review+
Comment 13•13 years ago
|
||
http://hg.mozilla.org/mozilla-central/rev/e7525561c309
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla9
Reporter | ||
Comment 14•13 years ago
|
||
It looks the patch didn't fix the issue: window opened in docshell tests throw an exception when trying to access SpecialPowers. For example, this log is the one associated with inbound commit for this patch. Errors reported in comment 1 are still present. http://tinderbox.mozilla.org/showlog.cgi?log=Mozilla-Inbound/1315423077.1315424363.14717.gz
Updated•13 years ago
|
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Comment 15•13 years ago
|
||
When running |TEST_PATH=docshell/test/chrome/test_bug293235.xul make -C objdir mochitest-chrome|, I have discovered strange things. Printing out the location.href of the window to which SpecialPowers is being attached shows the same URL as the failing window in WindowSnapshot.js. However, logging the actual objects shows this: [object Window @ 0x1268be280 (native @ 0x1268bfae8)], when SpecialPowers is attaching to the window [object ChromeWindow @ 0x1268df430 (native @ 0x1268de558)], when snapshotWindow is being called. I have no idea what's going on!
Reporter | ||
Comment 16•13 years ago
|
||
(In reply to Josh Matthews [:jdm] from comment #15) > When running |TEST_PATH=docshell/test/chrome/test_bug293235.xul make -C > objdir mochitest-chrome|, I have discovered strange things. Printing out the > location.href of the window to which SpecialPowers is being attached shows > the same URL as the failing window in WindowSnapshot.js. I don't get the same result. SpecialPowers is attached to: http://mochi.test:8888/chrome/docshell/test/chrome/bug293235.html and window.location is, in snapshotWindow execution: chrome://mochitests/content/chrome/docshell/test/chrome/bug293235_window.xul If I understand correctly, the underlying problem is: call to this._messageManager.loadFrameScript(CHILD_SCRIPT); (in SpecialPowersObserver.js), will execute CHILD_SCRIPT in the context of any document loaded inside a <browser/>. But bug293235_window.xul is not within a browser. It's a top level window. I think that's the reason why SpecialPowers is not attached to bug293235_window.xul.
Comment 17•11 years ago
|
||
This is only the case with mochitest-chrome, right? I don't see this problem with mochitest-plain, except on b2g, I just filed bug 918842 for that.
Comment 19•10 years ago
|
||
Arno, are you still seeing this?
Updated•2 years ago
|
Severity: normal → S3
Comment hidden (spam) |
Updated•2 months ago
|
Attachment #9382889 -
Attachment is obsolete: true
You need to log in
before you can comment on or make changes to this bug.
Description
•