Closed Bug 806686 Opened 7 years ago Closed 7 years ago

Port browser_privatebrowsing_geoprompt.js to the new per-window PB APIs

Categories

(Firefox :: Private Browsing, defect)

x86
macOS
defect
Not set

Tracking

()

RESOLVED FIXED
Firefox 19

People

(Reporter: ehsan, Assigned: bellindira)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

http://mxr.mozilla.org/mozilla-central/source/browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_geoprompt.js

In order to port this test, the file needs to be copied to the perwindow/ directory, and then instead of setting privateBrowsingEnabled, we need to open a new private browsing window and then run the test on that window.
Assignee: nobody → bellindira
Status: NEW → ASSIGNED
Attached patch Patch v1Splinter Review
The test is ported to PB perwindow model as I think it should be. However, the former test (the one in global directory) doesn't pass, it has this error:
 JavaScript Error: "TypeError: notification is null" {file: "chrome://mochitests/content/browser/browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_geoprompt.js" line: 23}
So, the new test has the same error too:
JavaScript Error: "TypeError: notification is null" {file: "chrome://mochitests/content/browser/browser/components/privatebrowsing/test/browser/perwindow/browser_privatebrowsing_geoprompt.js" line: 25}

I tried to fix it by:
- setting an interval to wait for the notification
- importing the "resource://gre/modules/PopupNotifications.jsm" in case it wasn't loaded properly
- using executeSoon
However none of it solved the problem.

So, please let me know if you have any idea about it.
Attachment #680930 - Flags: feedback?(ehsan)
Comment on attachment 680930 [details] [diff] [review]
Patch v1

Review of attachment 680930 [details] [diff] [review]:
-----------------------------------------------------------------

::: browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_geoprompt.js
@@ +18,2 @@
>  
> +        let notification = PopupNotifications.getNotification("geolocation");

First of all, you need to access PopupNotifications from aWindow.

Also, there is a whole bunch of asynchronous stuff before the notification object gets created, so you need to "wait" until that happens.

I decided that I'll fix that and land the patch.  Here's the changes that I made to your patch: https://gist.github.com/4068961
Attachment #680930 - Flags: feedback?(ehsan) → review+
https://hg.mozilla.org/mozilla-central/rev/b9e99f5e8847
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 19
You need to log in before you can comment on or make changes to this bug.