Closed
Bug 449010
Opened 16 years ago
Closed 15 years ago
In browser.js, don't prototype single-instance objects
Categories
(Firefox :: General, defect)
Firefox
General
Tracking
()
RESOLVED
FIXED
Firefox 3.7a1
Tracking | Status | |
---|---|---|
status1.9.2 | --- | .4-fixed |
People
(Reporter: dao, Assigned: dao)
References
Details
(Whiteboard: [fixed-lorentz])
Attachments
(1 file, 6 obsolete files)
10.48 KB,
patch
|
asaf
:
review+
|
Details | Diff | Splinter Review |
No description provided.
Attachment #332190 -
Flags: review?(mano)
Assignee | ||
Updated•16 years ago
|
Assignee | ||
Comment 1•16 years ago
|
||
Assignee | ||
Updated•16 years ago
|
Attachment #332190 -
Attachment is obsolete: true
Attachment #332190 -
Flags: review?(mano)
Assignee | ||
Comment 2•16 years ago
|
||
Attachment #336994 -
Attachment is obsolete: true
Attachment #337005 -
Flags: review?(gavin.sharp)
Assignee | ||
Comment 3•16 years ago
|
||
Attachment #337005 -
Attachment is obsolete: true
Attachment #344759 -
Flags: review?(gavin.sharp)
Attachment #337005 -
Flags: review?(gavin.sharp)
Assignee | ||
Comment 4•16 years ago
|
||
Attachment #344759 -
Attachment is obsolete: true
Attachment #355288 -
Flags: review?(gavin.sharp)
Attachment #344759 -
Flags: review?(gavin.sharp)
Assignee | ||
Comment 5•16 years ago
|
||
Attachment #355288 -
Attachment is obsolete: true
Attachment #355288 -
Flags: review?(gavin.sharp)
Assignee | ||
Updated•16 years ago
|
Attachment #375397 -
Flags: review?(gavin.sharp)
Assignee | ||
Comment 6•15 years ago
|
||
Attachment #375397 -
Attachment is obsolete: true
Attachment #404823 -
Flags: review?(gavin.sharp)
Attachment #375397 -
Flags: review?(gavin.sharp)
Comment 7•15 years ago
|
||
Comment on attachment 404823 [details] [diff] [review]
updated to trunk
>diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js
>--- a/browser/base/content/browser.js
>+++ b/browser/base/content/browser.js
>@@ -70,23 +70,18 @@ Cu.import("resource://gre/modules/XPCOMU
> const nsIWebNavigation = Ci.nsIWebNavigation;
>
> var gCharsetMenu = null;
> var gLastBrowserCharset = null;
> var gPrevCharset = null;
> var gProxyFavIcon = null;
> var gLastValidURLStr = "";
> var gInPrintPreviewMode = false;
>-let gDownloadMgr = null;
>-
>-// Global variable that holds the nsContextMenu instance.
>-var gContextMenu = null;
>-
>-var gAutoHideTabbarPrefListener = null;
>-var gBookmarkAllTabsHandler = null;
>+var gDownloadMgr = null;
Why did you change let back to var? I heard it's preferable even in the global scope. IIRC sdwilsh knows why.
>+var gContextMenu = null; // nsContextMenu instance
>
> #ifndef XP_MACOSX
> var gEditUIVisible = true;
> #endif
>
> [
> ["gBrowser", "content"],
> ["gNavToolbox", "navigator-toolbox"],
>@@ -1117,18 +1112,17 @@ function prepareForStartup() {
> // and give C++ access to gBrowser
> XULBrowserWindow.init();
> window.QueryInterface(Ci.nsIInterfaceRequestor)
> .getInterface(nsIWebNavigation)
> .QueryInterface(Ci.nsIDocShellTreeItem).treeOwner
> .QueryInterface(Ci.nsIInterfaceRequestor)
> .getInterface(Ci.nsIXULWindow)
> .XULBrowserWindow = window.XULBrowserWindow;
>- window.QueryInterface(Ci.nsIDOMChromeWindow).browserDOMWindow =
>- new nsBrowserAccess();
>+ window.QueryInterface(Ci.nsIDOMChromeWindow);
>
comment above the browserDOMWindow object, that it implements the property from nsIDOMChromeWindow, and reference that comment here.
r=mano otherwise.
Attachment #404823 -
Flags: review?(gavin.sharp) → review+
Comment 8•15 years ago
|
||
Comment on attachment 404823 [details] [diff] [review]
updated to trunk
>diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js
>-function nsBrowserAccess()
>+/* nsIDOMChromeWindow */
>+var browserDOMWindow = {
I think this will have a negative compatibility impact - several addons attempt to modify nsBrowserAccess.prototype directly (particularly openURI), per http://mxr-test.konigsberg.mozilla.org/addons/search?string=nsBrowserAccess . I think you should omit this change.
>+var gMissingPluginInstaller = {
Seems like you should probably fix the indentation here.
r=me with those addressed.
Assignee | ||
Comment 9•15 years ago
|
||
(In reply to comment #7)
> >-let gDownloadMgr = null;
> >-
> >-// Global variable that holds the nsContextMenu instance.
> >-var gContextMenu = null;
> >-
> >-var gAutoHideTabbarPrefListener = null;
> >-var gBookmarkAllTabsHandler = null;
> >+var gDownloadMgr = null;
>
> Why did you change let back to var? I heard it's preferable even in the global
> scope. IIRC sdwilsh knows why.
It used to make a difference regarding window.gDownloadMgr, but it doesn't anymore.
Assignee | ||
Comment 10•15 years ago
|
||
(In reply to comment #8)
> (From update of attachment 404823 [details] [diff] [review])
> >diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js
>
> >-function nsBrowserAccess()
>
> >+/* nsIDOMChromeWindow */
> >+var browserDOMWindow = {
>
> I think this will have a negative compatibility impact - several addons attempt
> to modify nsBrowserAccess.prototype directly (particularly openURI), per
> http://mxr-test.konigsberg.mozilla.org/addons/search?string=nsBrowserAccess . I
> think you should omit this change.
Most of these extensions do nsBrowserAccess.prototype.openURI.toString().replace( ... They'll generally break whenever we touch that function (which we have recently).
> >+var gMissingPluginInstaller = {
>
> Seems like you should probably fix the indentation here.
Well, I didn't want to make blame completely useless.
Comment 11•15 years ago
|
||
(In reply to comment #10)
> Most of these extensions do
> nsBrowserAccess.prototype.openURI.toString().replace( ... They'll generally
> break whenever we touch that function (which we have recently).
Not all do that, and they won't always break when we modify it. There's very little cost to keeping it as is, and there is very little gain from changing it.
> Well, I didn't want to make blame completely useless.
I don't think whitespace fixes "make blame useless" - at worst they introduce an additional step in a process that usually already takes several steps. Not worth avoiding it at the cost of dealing with the code being incorrectly indented perpetually.
Assignee | ||
Comment 12•15 years ago
|
||
I just found out that browserDOMWindow.openURI isn't writable and toString() returns "function openURI() { [native code] }", so the prototyping is needed as an extension hook.
Assignee | ||
Comment 13•15 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 3.7a1
Comment 14•15 years ago
|
||
Couldn't they use window.wrappedJSObject?
Comment 15•15 years ago
|
||
And, FWIW, I don't think this is .replace(...) is something we should encourage or pretend to support, at all.
Assignee | ||
Comment 16•15 years ago
|
||
Yeah, toString().replace() is ugly, but a cleaner way to inject custom code wouldn't have worked either without the property being writable. wrappedJSObject doesn't seem to help.
Comment 17•15 years ago
|
||
I backported only the gMissingPluginInstaller portions of this patch to Lorentz to make transplanting the rest of the crashed-plugin UI less awful:
http://hg.mozilla.org/projects/firefox-lorentz/rev/9ae87295ef3b
Whiteboard: [fixed-lorentz]
Comment 18•15 years ago
|
||
Blanket approval for Lorentz merge to mozilla-1.9.2
a=beltzner for 1.9.2.4 - please make sure to mark status1.9.2:.4-fixed
Comment 19•15 years ago
|
||
Merged into 1.9.2 at http://hg.mozilla.org/releases/mozilla-1.9.2/rev/84ba4d805430
status1.9.2:
--- → .4-fixed
You need to log in
before you can comment on or make changes to this bug.
Description
•