Closed Bug 1347503 Opened 7 years ago Closed 7 years ago

Geolocation and Notification prompts do not swap to a new window

Categories

(Firefox :: Site Identity, defect, P1)

defect

Tracking

()

VERIFIED FIXED
Firefox 55
Iteration:
55.2 - Apr 3
Tracking Status
firefox52 --- unaffected
firefox-esr52 --- unaffected
firefox53 + verified
firefox54 + verified
firefox55 --- verified

People

(Reporter: johannh, Assigned: nhnt11)

References

Details

(Keywords: regression, Whiteboard: [fxprivacy])

Attachments

(1 file)

This was discovered in bug 1347170

STR:

- Open permission.site
- Click Notifications and/or Location
- Right click on the tab and selected "Move to New Window"

The permission popup should correctly transfer to the new window.

Florian mentioned on IRC that the fix is likely just handling the swapping event in the way that webrtcUI does:

http://searchfox.org/mozilla-central/source/browser/modules/webrtcUI.jsm#460
Assignee: nobody → nhnt11
Status: NEW → ASSIGNED
Priority: -- → P1
Whiteboard: [fxprivacy] [triage] → [fxprivacy]
Comment on attachment 8848806 [details]
Bug 1347503 - Handle "swapping" event for permission notifications.

https://reviewboard.mozilla.org/r/121694/#review123894

r=me with the comments below addressed

::: browser/modules/PermissionUI.jsm:355
(Diff revision 1)
>      // Permission prompts are always persistent; the close button is controlled by a pref.
>      options.persistent = true;
>      options.hideClose = !Services.prefs.getBoolPref("privacy.permissionPrompts.showCloseButton");
> +    options.eventCallback = (topic) => {
> +      if (topic == "swapping")
> +        return true;

Add a comment what this does, please.

Also, this could technically be reduced to

topic => topic == "swapping"

but that might have unintended side effects if anything checks != null for the return type. What do you think?

::: browser/modules/test/browser/browser_PermissionUI.js:408
(Diff revision 1)
> + * is transferred to the new window.
> + */
> +add_task(function* test_window_swap() {
> +  yield BrowserTestUtils.withNewTab({
> +    gBrowser,
> +    url: "http://example.com",

Nit: You can just use:

BTU.withNewTab("http://example.com", function(){...

::: browser/modules/test/browser/browser_PermissionUI.js:437
(Diff revision 1)
> +
> +    let newWindowOpened = BrowserTestUtils.waitForNewWindow();
> +    gBrowser.replaceTabWithWindow(gBrowser.selectedTab);
> +    let newWindow = yield newWindowOpened;
> +    yield BrowserTestUtils.waitForEvent(newWindow.PopupNotifications.panel, "popupshown");
> +    yield BrowserTestUtils.closeWindow(newWindow);

Can you please check some content of the popup to assert that we've shown the correct notification?
Attachment #8848806 - Flags: review?(jhofmann) → review+
Iteration: --- → 55.2 - Apr 3
(In reply to Johann Hofmann [:johannh] from comment #2)
> Comment on attachment 8848806 [details]
> Bug 1347503 - Handle "swapping" event for permission notifications.
> 
> https://reviewboard.mozilla.org/r/121694/#review123894
> 
> Also, this could technically be reduced to
> 
> topic => topic == "swapping"
> 
> but that might have unintended side effects if anything checks != null for
> the return type. What do you think?

Nice. https://dxr.mozilla.org/mozilla-central/rev/05bfa2831c0ba4a26fa72328ffe6a99aba9c356a/toolkit/modules/PopupNotifications.jsm#357 suggests that we should be fine with reducing it.

> ::: browser/modules/test/browser/browser_PermissionUI.js:408
> (Diff revision 1)
> > + * is transferred to the new window.
> > + */
> > +add_task(function* test_window_swap() {
> > +  yield BrowserTestUtils.withNewTab({
> > +    gBrowser,
> > +    url: "http://example.com",
> 
> Nit: You can just use:
> 
> BTU.withNewTab("http://example.com", function(){...

Hmm, I'd rather stay consistent with the rest of this file.

> ::: browser/modules/test/browser/browser_PermissionUI.js:437
> (Diff revision 1)
> > +
> > +    let newWindowOpened = BrowserTestUtils.waitForNewWindow();
> > +    gBrowser.replaceTabWithWindow(gBrowser.selectedTab);
> > +    let newWindow = yield newWindowOpened;
> > +    yield BrowserTestUtils.waitForEvent(newWindow.PopupNotifications.panel, "popupshown");
> > +    yield BrowserTestUtils.closeWindow(newWindow);
> 
> Can you please check some content of the popup to assert that we've shown
> the correct notification?

Pushed by nhnt11@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/4e2d53d22566
Handle "swapping" event for permission notifications. r=johannh
backed this out since this might have caused failures like https://treeherder.mozilla.org/logviewer.html#?job_id=85832935&repo=autoland
Flags: needinfo?(nhnt11)
Backout by cbook@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/5e304691d84b
Backed out changeset 4e2d53d22566 for crashes in windows a11y tests
(In reply to Carsten Book [:Tomcat] from comment #7)
> backed this out since this might have caused failures like
> https://treeherder.mozilla.org/logviewer.html#?job_id=85832935&repo=autoland

That's really weird, I can't think why this would cause a11y failures. It doesn't change any existing behavior, it simply makes sure that the popup is correctly migrated when its tab changes windows. :(

I'll do another try push and investigate.
(In reply to :Nihanth Subramanya [:nhnt11] from comment #9)
> (In reply to Carsten Book [:Tomcat] from comment #7)
> > backed this out since this might have caused failures like
> > https://treeherder.mozilla.org/logviewer.html#?job_id=85832935&repo=autoland
> 
> That's really weird, I can't think why this would cause a11y failures. It
> doesn't change any existing behavior, it simply makes sure that the popup is
> correctly migrated when its tab changes windows. :(
> 
> I'll do another try push and investigate.

BTW, M-a11y was green on the try push that I did before landing: https://treeherder.mozilla.org/#/jobs?repo=try&revision=9528844eafe3&selectedJob=85484243

Can you confirm that this patch could still be the cause of the failure you linked?

In the meantime, I've triggered a bunch of retries.
Flags: needinfo?(nhnt11) → needinfo?(cbook)
hi nihanth, seems this also could be caused by the patch that landed before you and where this tests didn't run. sorry!
Flags: needinfo?(cbook)
Want to try landing this again? 
Once it's on m-c, Nihanth do you want to request uplift at least to aurora?
Flags: needinfo?(cbook)
Keywords: regression
Pushed by nhnt11@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/6aff41084a96
Handle "swapping" event for permission notifications. r=johannh
https://hg.mozilla.org/mozilla-central/rev/6aff41084a96
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 55
Flags: needinfo?(cbook)
Build ID: 20170326030204
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0

Verified as fixed on Firefox Nightly 55.0a1 on Windows 10 x 64, Mac OS X 10.12 and Ubuntu 16.04 x64.
Status: RESOLVED → VERIFIED
See comment 13.
Flags: needinfo?(nhnt11)
Comment on attachment 8848806 [details]
Bug 1347503 - Handle "swapping" event for permission notifications.

Approval Request Comment
[Feature/Bug causing the regression]: Permission prompts!
[User impact if declined]: Minor, this patch saves a click (and adds a bit of polish)
[Is this code covered by automated tests?]: yes
[Has the fix been verified in Nightly?]: yes
[Needs manual test from QE? If yes, steps to reproduce]: Verified in comment 16
[List of other uplifts needed for the feature/fix]: none
[Is the change risky?]: no
[Why is the change risky/not risky?]: Simply handles an event (by returning true). Covered by automated tests.
[String changes made/needed]: none
Flags: needinfo?(nhnt11)
Attachment #8848806 - Flags: approval-mozilla-aurora?
Looks like this needs a Beta approval request as well?
Flags: needinfo?(nhnt11)
Comment on attachment 8848806 [details]
Bug 1347503 - Handle "swapping" event for permission notifications.

Hmm, might as well.

See comment 18 for approval request comment.
Flags: needinfo?(nhnt11)
Attachment #8848806 - Flags: approval-mozilla-beta?
Comment on attachment 8848806 [details]
Bug 1347503 - Handle "swapping" event for permission notifications.

Fix a regression related to permission prompt and was verified. Aurora54+ & Beta53+.
Attachment #8848806 - Flags: approval-mozilla-beta?
Attachment #8848806 - Flags: approval-mozilla-beta+
Attachment #8848806 - Flags: approval-mozilla-aurora?
Attachment #8848806 - Flags: approval-mozilla-aurora+
Build ID: 20170329004027
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:54.0) Gecko/20100101 Firefox/54.0

Verified as fixed on Firefox Aurora 54.0a2 on Windows 10 x 64, Mac OS X 10.12 and Ubuntu 16.04 x64.
Let's make sure this works as intended on Beta 53 as well. Instructions in Comment 0.
Flags: qe-verify+
Build ID: 20170330120906
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:53.0) Gecko/20100101 Firefox/53.0

Verified as fixed on Firefox Beta 53.0b8 on Windows 10 x 64, Mac OS X 10.12 and Ubuntu 16.04 x64.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: