Closed Bug 1043958 Opened 10 years ago Closed 6 years ago

Incorrect return on unsafeWindow

Categories

(Core :: General, defect)

34 Branch
x86_64
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: yohann.jardin, Unassigned)

References

Details

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:34.0) Gecko/20100101 Firefox/34.0 (Beta/Release)
Build ID: 20140724030201

Steps to reproduce:

1. Download https://addons.mozilla.org/fr/firefox/addon/greasemonkey/
2. Go to https://bugzilla.mozilla.org/
3. Tools -> Greasemonkey -> New User Script -> Name= bugzilla, Namespace= bugzilla, Description = (empty), Includes= https://bugzilla.mozilla.org/, Excludes = (empty) -> Press Ok
4. Write the following line in the script :
// ==UserScript==
// @name        bugzilla
// @namespace   bugzilla
// @include     https://bugzilla.mozilla.org/
// @version     1
// @grant       GM_getValue
// @grant       GM_setValue
// ==/UserScript==

alert(unsafeWindow.BUGZILLA);

5. Reload https://bugzilla.mozilla.org/


Actual results:

The result of the alert is "undefined"


Expected results:

The result of the alert should be "[object Object]"




Replacing
// @grant       GM_getValue
// @grant       GM_setValue
with
// @grant       none

The script now is :

// ==UserScript==
// @name        bugzilla
// @namespace   bugzilla
// @include     https://bugzilla.mozilla.org/
// @version     1
// @grant       none
// ==/UserScript==

alert(unsafeWindow.BUGZILLA);


The result of the alert is "[object Object]", as expected.



Works fine on 2014-07-23, bad on 2014-07-24.
Seems that last good revision is 63f44b4968c2 and first bad revision is fdfb57a0fe0b .
Bug 742444 landed in that range and explicitly mentions unsafeWindow in its description.
Flags: needinfo?(bobbyholley)
Blocks: 742444
Anthony, my guess is that Greasemonkey will need the same kind of jiggering as we did for Jetpack: https://hg.mozilla.org/mozilla-central/rev/77ba979e76af

Does that sound right?
Flags: needinfo?(bobbyholley) → needinfo?(arantius)
Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Summary: unsafeWindow → Incorrect return on unsafeWindow
You need to log in before you can comment on or make changes to this bug.