Closed
Bug 1370871
Opened 7 years ago
Closed 7 years ago
Remove "global" global from evaluate script context
Categories
(Remote Protocol :: Marionette, enhancement)
Tracking
(firefox55 fixed)
RESOLVED
FIXED
mozilla55
Tracking | Status | |
---|---|---|
firefox55 | --- | fixed |
People
(Reporter: ato, Assigned: ato)
References
Details
Attachments
(2 files)
For scripts that are executed in sandboxes, we expose a global named "global". I’m not quite sure why we do that, but I suspect it may have had something to do with the way evaluating scripts worked in Marionette prior to the rewrite of testing/marionette/evaluate.js. In any case, I see no harm in removing this now.
Assignee | ||
Updated•7 years ago
|
Assignee: nobody → ato
Status: NEW → ASSIGNED
Comment hidden (mozreview-request) |
Comment 2•7 years ago
|
||
mozreview-review |
Comment on attachment 8875278 [details] Bug 1370871 - Remove "global" global from evaluate script context; https://reviewboard.mozilla.org/r/146682/#review150736
Attachment #8875278 -
Flags: review?(dburns) → review+
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Comment 6•7 years ago
|
||
mozreview-review |
Comment on attachment 8875700 [details] Bug 1370871 - Remove use of global from Firefox refresh test; https://reviewboard.mozilla.org/r/147134/#review151290 r=me in the sense that this is a refactor and, well, meh. But we should declare variables properly and avoid overwriting existing things. :-) ::: browser/components/migration/tests/marionette/test_refresh_firefox.py:315 (Diff revision 2) > - global.LoginInfo = Components.Constructor("@mozilla.org/login-manager/loginInfo;1", "nsILoginInfo", "init"); > - global.profSvc = Cc["@mozilla.org/toolkit/profile-service;1"].getService(Ci.nsIToolkitProfileService); > - global.Preferences = Cu.import("resource://gre/modules/Preferences.jsm", {}).Preferences; > - global.FormHistory = Cu.import("resource://gre/modules/FormHistory.jsm", {}).FormHistory; > + LoginInfo = Components.Constructor("@mozilla.org/login-manager/loginInfo;1", "nsILoginInfo", "init"); > + profSvc = Cc["@mozilla.org/toolkit/profile-service;1"].getService(Ci.nsIToolkitProfileService); > + Preferences = Cu.import("resource://gre/modules/Preferences.jsm", {}).Preferences; > + FormHistory = Cu.import("resource://gre/modules/FormHistory.jsm", {}).FormHistory; I'm not excited about not declaring these variables, and then assigning them onto... something... (maybe window?) where it might conflict. In particular, I'd expect browser.xul to have a Preferences ref already. I think this should use `let`, or make explicit where it's assigning, and really ideally would be scoped to our own evaluation context (where, as you noted on IRC, it might be easier to just use `window.global = {}`). Really, as a consumer, what I want is for the global evaluation object to be a transparent proxy on `window`, so that I both don't interfere with `window` but can use global variables without jumping through hoops. But I guess that's not what evaluate.js does right now?
Attachment #8875700 -
Flags: review?(gijskruitbosch+bugs) → review+
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Assignee | ||
Comment 9•7 years ago
|
||
mozreview-review-reply |
Comment on attachment 8875700 [details] Bug 1370871 - Remove use of global from Firefox refresh test; https://reviewboard.mozilla.org/r/147134/#review151290 > I'm not excited about not declaring these variables, and then assigning them onto... something... (maybe window?) where it might conflict. > > In particular, I'd expect browser.xul to have a Preferences ref already. > > I think this should use `let`, or make explicit where it's assigning, and really ideally would be scoped to our own evaluation context (where, as you noted on IRC, it might be easier to just use `window.global = {}`). > > Really, as a consumer, what I want is for the global evaluation object to be a transparent proxy on `window`, so that I both don't interfere with `window` but can use global variables without jumping through hoops. But I guess that's not what evaluate.js does right now? Thanks for your quick review, Gijs! Sadly I’m not equally good at following up, but I blame that mainly on a startup crash bug on Linux (now fixed). All good points, and I’ve changed the patch to define a window.global = {} in the "firefox-refresh" sandbox now used throughout the test.
Comment 10•7 years ago
|
||
Pushed by atolfsen@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/c9a85535d607 Remove "global" global from evaluate script context; r=automatedtester https://hg.mozilla.org/integration/autoland/rev/ba02f6a155b8 Remove use of global from Firefox refresh test; r=Gijs
Comment 11•7 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/c9a85535d607 https://hg.mozilla.org/mozilla-central/rev/ba02f6a155b8
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
status-firefox55:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
Updated•1 year ago
|
Product: Testing → Remote Protocol
You need to log in
before you can comment on or make changes to this bug.
Description
•