Closed
Bug 1264625
Opened 9 years ago
Closed 9 years ago
Fix "would run" warning fired when opening the browser toolbox
Categories
(DevTools :: Debugger, defect, P2)
DevTools
Debugger
Tracking
(firefox49 fixed)
RESOLVED
FIXED
Firefox 49
| Tracking | Status | |
|---|---|---|
| firefox49 | --- | fixed |
People
(Reporter: ochameau, Assigned: ochameau)
References
Details
Attachments
(1 file, 4 obsolete files)
|
25.36 KB,
patch
|
ochameau
:
review+
|
Details | Diff | Splinter Review |
That, to prevent risk of stepping into debugger/actors internals.
This warning means that we run some code that is not invisible to debugger while the debugger is active (onNewScript, onNewGlobal or breakpoint callbacks).
There is various dependencies, mostly JSM that we should not use in the context of the browser toolbox.
| Assignee | ||
Comment 1•9 years ago
|
||
Comment 2•9 years ago
|
||
How is this bug different from bug 1263935?
Updated•9 years ago
|
Priority: -- → P2
| Assignee | ||
Comment 3•9 years ago
|
||
Bug 1263935 is focusing on the AddonManager warning which is very precise.
This bug is about the various other internals we call, especially XPCOMUtils and the lazy getter helpers.
| Assignee | ||
Comment 4•9 years ago
|
||
Forgot to 'git add'...
| Assignee | ||
Updated•9 years ago
|
Attachment #8741349 -
Attachment is obsolete: true
| Assignee | ||
Comment 5•9 years ago
|
||
Comment on attachment 8743020 [details] [diff] [review]
patch v2
Review of attachment 8743020 [details] [diff] [review]:
-----------------------------------------------------------------
::: devtools/shared/Loader.jsm
@@ +47,5 @@
> + "source-map": "resource://devtools/shared/sourcemap/source-map.js",
> + // ⚠ DISCUSSION ON DEV-DEVELOPER-TOOLS REQUIRED BEFORE MODIFYING ⚠
> + // Allow access to xpcshell test items from the loader.
> + "xpcshell-test": "resource://test",
> + };
Moving `paths` over here prevent having to copy this dictionnary.
@@ -162,5 @@
> this.require = this.require.bind(this);
> - this.lazyGetter = XPCOMUtils.defineLazyGetter.bind(XPCOMUtils);
> - this.lazyImporter = XPCOMUtils.defineLazyModuleGetter.bind(XPCOMUtils);
> - this.lazyServiceGetter = XPCOMUtils.defineLazyServiceGetter.bind(XPCOMUtils);
> - this.lazyRequireGetter = this.lazyRequireGetter.bind(this);
I have to move the definition of the lazy getter in loader modules.
We basicaly can't use jsm because jsm are not flagged as invisible to debugger.
@@ +152,5 @@
> + for (let id in modules) {
> + let exports = modules[id];
> + let uri = resolveURI(id, loader.mapping);
> + loader.modules[uri] = { exports };
> + }
Using a module to define pseudo modules and globals is something done in the SDK.
Like here, for pseudo modules:
http://mxr.mozilla.org/mozilla-central/source/addon-sdk/source/lib/sdk/addon/runner.js#82
And globals:
http://mxr.mozilla.org/mozilla-central/source/addon-sdk/source/lib/sdk/addon/runner.js#67
| Assignee | ||
Comment 6•9 years ago
|
||
| Assignee | ||
Comment 7•9 years ago
|
||
| Assignee | ||
Updated•9 years ago
|
Attachment #8743020 -
Attachment is obsolete: true
| Assignee | ||
Comment 8•9 years ago
|
||
| Assignee | ||
Comment 9•9 years ago
|
||
Comment on attachment 8746011 [details] [diff] [review]
patch v3
Review of attachment 8746011 [details] [diff] [review]:
-----------------------------------------------------------------
See comment 5 for more info about this patch.
Attachment #8746011 -
Flags: review?(jryans)
Comment on attachment 8746011 [details] [diff] [review]
patch v3
Review of attachment 8746011 [details] [diff] [review]:
-----------------------------------------------------------------
Overall I think this makes sense, just a few questions.
Will browser-loader work correctly with these changes? It particular it:
* Pulls some options from the "default" loader[1]
* Defines some of the same lazy methods[2]
[1]: https://dxr.mozilla.org/mozilla-central/source/devtools/client/shared/browser-loader.js#79
[2]: https://dxr.mozilla.org/mozilla-central/source/devtools/client/shared/browser-loader.js#127-132
::: devtools/shared/builtin-modules.js
@@ +4,5 @@
> +
> +"use strict";
> +
> +/**
> + * This module defines custom globals injected in all our modules
Nit: seems wrapped strangely, rewrap to 80 chars
@@ +5,5 @@
> +"use strict";
> +
> +/**
> + * This module defines custom globals injected in all our modules
> + * and also pseudo modules that aren't js file but just dynamically set values.
Nit: maybe "aren't separate files"?
@@ +17,5 @@
> +const { Loader } = Cu.import("resource://gre/modules/commonjs/toolkit/loader.js", {});
> +const promise = Cu.import("resource://gre/modules/Promise.jsm", {}).Promise;
> +const jsmScope = Cu.import("resource://gre/modules/Services.jsm", {});
> +const { Services } = jsmScope;
> +// Steal various global only available in JSM scope (and not Sandbox one)
Nit: globals
@@ +149,5 @@
> + // a proxy whose defineProperty handler might unwittingly trigger this
> + // getter again.
> + delete obj[property];
> + let value = destructure
> + ? require(module)[property]
Will this end up being the "correct" require here, even in the case of browser-loader.js?
Attachment #8746011 -
Flags: review?(jryans) → feedback+
| Assignee | ||
Comment 11•9 years ago
|
||
(In reply to J. Ryan Stinnett [:jryans] (use ni?) from comment #10)
> Comment on attachment 8746011 [details] [diff] [review]
> patch v3
>
> Review of attachment 8746011 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> Overall I think this makes sense, just a few questions.
>
> Will browser-loader work correctly with these changes? It particular it:
>
> * Pulls some options from the "default" loader[1]
It pulls `paths` and `invilibleToDebugger` which are still exposed. (`modules` and `globals` are no longer passed, but browser-loader doesn't use them)
> * Defines some of the same lazy methods[2]
Good catch.
I imagine builtin-modules.js would have overloaded all that. But it shouldn't be loaded in browser-loader Loader instance (it is only loaded for main Loader, in, Loader.jsm).
https://dxr.mozilla.org/mozilla-central/source/devtools/client/shared/browser-loader.js#106-133
But I'm wondering if browser-loader should also use builtin-modules the same way we use it in Loader.jsm? It would work for everything but the `console` object, which should be different.
We could use a condition in builtin-modules to define console accordingly, but at the end, would it be misleading or clearer??
> @@ +149,5 @@
> > + // a proxy whose defineProperty handler might unwittingly trigger this
> > + // getter again.
> > + delete obj[property];
> > + let value = destructure
> > + ? require(module)[property]
>
> Will this end up being the "correct" require here, even in the case of
> browser-loader.js?
In the current patch, builtin-modules isn't used in browser-loader. Instead we end up using the lazy getter defined browser-loader and its version of lazyRequireGetter which should work.
If as said previously, we make it so that browser-loader also uses builtin-modules, the require() here would be the expected one.
Flags: needinfo?(jryans)
(In reply to Alexandre Poirot [:ochameau] from comment #11)
> > * Defines some of the same lazy methods[2]
>
> Good catch.
> I imagine builtin-modules.js would have overloaded all that. But it
> shouldn't be loaded in browser-loader Loader instance (it is only loaded for
> main Loader, in, Loader.jsm).
> https://dxr.mozilla.org/mozilla-central/source/devtools/client/shared/
> browser-loader.js#106-133
> But I'm wondering if browser-loader should also use builtin-modules the same
> way we use it in Loader.jsm? It would work for everything but the `console`
> object, which should be different.
> We could use a condition in builtin-modules to define console accordingly,
> but at the end, would it be misleading or clearer??
Okay, it sounds like browser-loader is safe as is then? Probably easier to leave it alone for now, and revise later if we decide we want the same technique there.
It's less important for this issue since it's not the loader used by the server.
Flags: needinfo?(jryans)
Comment on attachment 8746011 [details] [diff] [review]
patch v3
Review of attachment 8746011 [details] [diff] [review]:
-----------------------------------------------------------------
Since it sounds like browser-loader is safe, r+ assuming other nits are fixed.
Attachment #8746011 -
Flags: feedback+ → review+
| Assignee | ||
Comment 14•9 years ago
|
||
| Assignee | ||
Updated•9 years ago
|
Attachment #8746011 -
Attachment is obsolete: true
| Assignee | ||
Updated•9 years ago
|
Attachment #8751305 -
Attachment is obsolete: true
| Assignee | ||
Comment 17•9 years ago
|
||
| Assignee | ||
Comment 18•9 years ago
|
||
https://hg.mozilla.org/integration/fx-team/rev/9d54c99aa3adcb26d174a18bdedff704047066a9
Bug 1264625 - Ensure using only invisible modules when opening the browser toolbox. r=jryans
Comment 19•9 years ago
|
||
| bugherder | ||
Status: NEW → RESOLVED
Closed: 9 years ago
status-firefox49:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 49
Updated•7 years ago
|
Product: Firefox → DevTools
You need to log in
before you can comment on or make changes to this bug.
Description
•