Closed Bug 986639 Opened 11 years ago Closed 11 years ago

Use the __URI__ property of component and module globals to detect which add-on they come from

Categories

(DevTools :: Debugger, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 31

People

(Reporter: mossop, Assigned: mossop)

References

Details

Attachments

(1 file)

All components and modules have a __URI__ property that defines what loaded them. We can use that to map back to the add-on in the add-on script actor.
Depends on: 986757
Attached patch patch rev 1Splinter Review
All JS modules have a __URI__ property denoting the URI of the module loaded. We can use this to detect which globals are from add-on provided scripts by mapping them back to the add-on ID. This does that in the add-on thread actor. Pretty simple but the testcase requires bug 986757 and bug 986108 in order to work. I don't think there's a reason not to start the review now though.
Attachment #8396033 - Flags: review?(nfitzgerald)
Comment on attachment 8396033 [details] [diff] [review] patch rev 1 Review of attachment 8396033 [details] [diff] [review]: ----------------------------------------------------------------- ::: browser/devtools/debugger/test/browser_dbg_addon-modules.js @@ +60,5 @@ > + > + gThreadClient.getSources(({sources}) => { > + ok(sources.length, "retrieved sources"); > + > + sources.forEach(source => { Any reason why you aren't using for (let source of sources) ... ? ::: toolkit/devtools/server/actors/script.js @@ +4724,5 @@ > + if (this.addonManager.mapURIToAddonID(uri, id)) > + return id.value === this.addonID; > + } > + catch (e) { > + console.log("Unexpected URI " + uridescriptor.value); DevToolsUtils.reportException("AddonThreadActor.prototype._checkGlobal", <e or new Error("Unexpected uri:" + ...)>);
Attachment #8396033 - Flags: review?(nfitzgerald) → review+
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 31
Realised I failed to address the review comments in my push so here they are: https://hg.mozilla.org/integration/fx-team/rev/c24b05af9a39
QA Whiteboard: [qa-]
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: