Closed
Bug 562168
Opened 14 years ago
Closed 13 years ago
Move inspector.js into a jsm
Categories
(DevTools :: General, defect, P1)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: rcampbell, Assigned: msucan)
References
Details
(Whiteboard: [minotaur][best: 1h; likely: 3h; worst: 6h])
Attachments
(1 file, 4 obsolete files)
43.82 KB,
patch
|
rcampbell
:
review+
|
Details | Diff | Splinter Review |
from (https://bugzilla.mozilla.org/show_bug.cgi?id=547453#c23) Can we put the object definitions in a JavaScript module instead? We'd still need to have object instances per-window (as lazy getters, perhaps?), and have them keep references to the per-window elements they refer to, which would require some refactoring, but it seems like that shouldn't be too hard to manage? Something like: XPCOMUtils.defineLazyGetter(this, "InspectorUI", function () { let temp = {}; Cu.import("resource:///modules/Inspector.jsm", temp); return new temp.InspectorUI(panelElement, treeElement, tabbrowser, <etc.>); });
Reporter | ||
Updated•13 years ago
|
Summary: Move Inspector object initialization into module, refactor (reticle) → Move inspector.js into a jsm
Whiteboard: [minotaur][best: 1h; likely: 3h; worst: 6h]
Reporter | ||
Comment 1•13 years ago
|
||
Updating this bug to reflect reality a year and a half later. We should move inspector.js into a jsm of it's own and lazily initialize it browser.js. This should facilitate a move into browser/devtools.
Reporter | ||
Updated•13 years ago
|
Assignee: nobody → rcampbell
Status: NEW → ASSIGNED
Reporter | ||
Comment 3•13 years ago
|
||
WIP patch. Invokable through a scratchpad, but not through browser UI. Still need to import INSPECTOR_NOTIFICATIONS into TreePanel.jsm and create a loader function for the Inspect menu item. Minor changes.
Comment 4•13 years ago
|
||
Comment on attachment 552908 [details] [diff] [review] jsm wip >--- a/browser/base/content/inspector.js >+++ b/browser/base/content/inspector.jsm >+__defineGetter__("window", function() { >+ delete this.window; >+ let win = Services.wm.getMostRecentWindow("navigator:browser"); >+ return this.window = win; >+}); >+ >+__defineGetter__("gBrowser", function() { >+ delete this.gBrowser; >+ let gBrowser = window.gBrowser; >+ return this.gBrowser = gBrowser; >+}); >+ >+__defineGetter__("document", function() { >+ delete this.document; >+ let doc = window.document; >+ return this.document = doc; >+}); This looks quite broken. Invoking the inspector a second time in a second window would let these properties still point to the first window. You're also leaking that window. By the way, how about creating resource:///modules/devtools/?
Reporter | ||
Comment 5•13 years ago
|
||
(In reply to Dão Gottwald [:dao] from comment #4) > Comment on attachment 552908 [details] [diff] [review] > jsm wip > > >--- a/browser/base/content/inspector.js > >+++ b/browser/base/content/inspector.jsm > > >+__defineGetter__("window", function() { > >+ delete this.window; > >+ let win = Services.wm.getMostRecentWindow("navigator:browser"); > >+ return this.window = win; > >+}); > >+ > >+__defineGetter__("gBrowser", function() { > >+ delete this.gBrowser; > >+ let gBrowser = window.gBrowser; > >+ return this.gBrowser = gBrowser; > >+}); > >+ > >+__defineGetter__("document", function() { > >+ delete this.document; > >+ let doc = window.document; > >+ return this.document = doc; > >+}); > > This looks quite broken. Invoking the inspector a second time in a second > window would let these properties still point to the first window. You're > also leaking that window. mm. good point. I was hoping I could keep InspectorUI as a singleton, but it looks like I may need to actually instantiate them per window. Should be easier to cleanup that way too. > By the way, how about creating resource:///modules/devtools/? yeah, Mike Ratcliffe mentioned this last week in response to your comment in one of his bugs. Probably a good idea and worth doing as we grow more and more of these. thanks for the driveby!
Updated•13 years ago
|
Priority: -- → P1
Assignee | ||
Comment 6•13 years ago
|
||
As agreed with Robert, I am going to take this bug. Will get to update the patch some time this week.
Assignee: rcampbell → mihai.sucan
Assignee | ||
Comment 7•13 years ago
|
||
Waiting for the updated patch for bug 650794. It makes sense to base on top of the work to split out the tree panel - that has r+ and it's *almost* ready.
Depends on: 650794
Assignee | ||
Comment 8•13 years ago
|
||
This is the proposed patch. This migrates the inspector.js code to .jsm. InspectorUI instances are created per window. All features work, all tests pass. Please note that this patch depends on: - v16 patch attachment 558309 [details] [diff] [review] from bug 650794, - which in turn depends on attachment 555734 [details] [diff] [review] from bug 681653. Looking forward for your review. Thank you! (Another note: I haven't moved the JSM to any different location for now. Dão's suggestion to use resource://browser/devtools/ is a good one, and we should do that. Let's discuss it on IRC or somewhere.)
Attachment #552908 -
Attachment is obsolete: true
Attachment #558329 -
Flags: review?(rcampbell)
Assignee | ||
Comment 9•13 years ago
|
||
Rebased the patch and also moved the jsm and the inspector test files to browser/devtools/highlighter/. Please note that the local patch queue is as follows: bug 681653, bug 663831, bug 650794, bug 681651, bug 562168 Please let me know if I forgot other files to move to devtools. Looking forward to your review! Thanks!
Attachment #558329 -
Attachment is obsolete: true
Attachment #561006 -
Flags: review?(rcampbell)
Attachment #558329 -
Flags: review?(rcampbell)
Assignee | ||
Comment 10•13 years ago
|
||
Rebased on top of the latest attachment 561225 [details] [diff] [review] from bug 687854.
Attachment #561006 -
Attachment is obsolete: true
Attachment #561496 -
Flags: review?(rcampbell)
Attachment #561006 -
Flags: review?(rcampbell)
Assignee | ||
Updated•13 years ago
|
Reporter | ||
Comment 11•13 years ago
|
||
just rebasing on latest patches and checkins. reviewing...
Attachment #561496 -
Attachment is obsolete: true
Attachment #561713 -
Flags: review?(rcampbell)
Attachment #561496 -
Flags: review?(rcampbell)
Reporter | ||
Comment 12•13 years ago
|
||
Comment on attachment 561713 [details] [diff] [review] yet another rebase r+ with gavin's modifications applied.
Attachment #561713 -
Flags: review?(rcampbell) → review+
Reporter | ||
Comment 13•13 years ago
|
||
fixed by bug 687854.
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Updated•6 years ago
|
Product: Firefox → DevTools
You need to log in
before you can comment on or make changes to this bug.
Description
•