Closed Bug 1110069 Opened 10 years ago Closed 10 years ago

Replace getBrowser() with gBrowser in browser/

Categories

(Firefox :: General, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Firefox 37

People

(Reporter: dao, Assigned: ankit.goyal90, Mentored)

References

Details

(Whiteboard: [good first bug][lang=js])

Attachments

(1 file, 3 obsolete files)

Bug 448572 deprecated getBrowser() a long time ago. We should be using gBrowser instead.

The instances that should be replaced can be found here:

http://mxr.mozilla.org/mozilla-central/search?string=getBrowser%28%29&find=%2Fbrowser%2F

From that list, you can ignore browser/base/content/test/general/browser_scope.js and anything under browser/metro/.
Working on it.
Comment on attachment 8534946 [details] [diff] [review]
Replaced all getBrowser() with gBrowser() for mentioned files

>-    var uri = getBrowser().currentURI;
>+    var uri = gBrowser().currentURI;

gBrowser is not a function but a DOM node (the same DOM node returned by getBrowser()). So you need to replace "getBrowser()" with "gBrowser", no parentheses.

>--- a/browser/base/content/browser.js
>+++ b/browser/base/content/browser.js
>@@ -7381,17 +7381,16 @@ function getNotificationBox(aWindow) {
> function getTabModalPromptBox(aWindow) {
>   var foundBrowser = gBrowser.getBrowserForDocument(aWindow.document);
>   if (foundBrowser)
>     return gBrowser.getTabModalPromptBox(foundBrowser);
>   return null;
> };
> 
> /* DEPRECATED */
>-function getBrowser() gBrowser;

We need to keep this for add-ons that might be calling getBrowser().
OOPS! Doing again
Attached patch fixed (obsolete) — Splinter Review
(In reply to ankit.goyal90 from comment #5)
> Created attachment 8534953 [details] [diff] [review]
> fixed

OOPS again. Looks you have to apply both patches. I create a single one.
Attached patch done! (obsolete) — Splinter Review
Comment on attachment 8534954 [details] [diff] [review]
done!

Looks good, thanks!
Attachment #8534954 - Flags: review+
Attachment #8534953 - Attachment is obsolete: true
Attachment #8534946 - Attachment is obsolete: true
Hm, the patch fails to apply in browser/base/content/browser-safebrowsing.js. Not sure what went wrong there. Have you manually edited the patch?
Assignee: nobody → ankit.goyal90
(In reply to Dão Gottwald [:dao] from comment #9)
> Hm, the patch fails to apply in
> browser/base/content/browser-safebrowsing.js. Not sure what went wrong
> there. Have you manually edited the patch?

Yes
(In reply to Dão Gottwald [:dao] from comment #9)
> Hm, the patch fails to apply in
> browser/base/content/browser-safebrowsing.js. Not sure what went wrong
> there. Have you manually edited the patch?

Yes
Shall I do it again?
Yes, could you please generate a clean diff without editing the result?
Ok
Attached patch Final patchSplinter Review
Comment on attachment 8535392 [details] [diff] [review]
Final patch

This one works. Thanks!
Attachment #8535392 - Flags: review+
Attachment #8534954 - Attachment is obsolete: true
sorry had to back this out in https://treeherder.mozilla.org/#/jobs?repo=fx-team&revision=2a11e49c5a83 since one of this 2 changes caused test failures like https://treeherder.mozilla.org/logviewer.html#?job_id=1424338&repo=fx-team
Flags: needinfo?(ankit.goyal90)
(In reply to Carsten Book [:Tomcat] from comment #18)
> sorry had to back this out in
> https://treeherder.mozilla.org/#/jobs?repo=fx-team&revision=2a11e49c5a83
> since one of this 2 changes caused test failures like
> https://treeherder.mozilla.org/logviewer.html#?job_id=1424338&repo=fx-team

This had nothing to do with this bug.
Flags: needinfo?(ankit.goyal90)
Keywords: checkin-needed
https://hg.mozilla.org/integration/fx-team/rev/06ac04ca3c31
Keywords: checkin-needed
Whiteboard: [good first bug][lang=js] → [good first bug][lang=js][fixed-in-fx-team]
https://hg.mozilla.org/mozilla-central/rev/06ac04ca3c31
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Whiteboard: [good first bug][lang=js][fixed-in-fx-team] → [good first bug][lang=js]
Target Milestone: --- → Firefox 37
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: