'Open Link in New Tab' does not work after unloading document

ASSIGNED
Assigned to
(NeedInfo from)

Status

()

Firefox
Menus
ASSIGNED
7 days ago
3 days ago

People

(Reporter: Oriol, Assigned: rpl, NeedInfo)

Tracking

({regression})

54 Branch
regression
Points:
---

Firefox Tracking Flags

(firefox53 unaffected, firefox54 affected, firefox55 affected)

Details

MozReview Requests

()

Submitter Diff Changes Open Issues Last Updated
Loading...
Error loading review requests:

Attachments

(1 attachment)

(Reporter)

Description

7 days ago
0. Disable e10s
1. Click a link which points to a slow server (bugzilla.mozilla.org is a good example)
2. Before the document unloads, right click another link
3. Wait until the new document loads
4. Click 'Open Link in New Tab' in the context menu

Expected result: a new tab loads the url of the 2nd link
Result: no new tab, an error is thrown.

  TypeError: window is null  (resource://gre/modules/WebNavigationFrames.jsm:59:1)
    getFrameId               (resource://gre/modules/WebNavigationFrames.jsm:59:1)
    _openLinkInParameters    (chrome://browser/content/nsContextMenu.js:1036:35)
    openLinkInTab            (chrome://browser/content/nsContextMenu.js:1085:37)
    oncommand                (chrome://browser/content/browser.xul:1:1)

If you follow the same steps, but now inside an iframe, the error is

  TypeError: can't access dead object (chrome://browser/content/nsContextMenu.js)
    _openLinkInParameters    (chrome://browser/content/nsContextMenu.js:1036:7)
    openLinkInTab            (chrome://browser/content/nsContextMenu.js:1085:37)
    oncommand                (chrome://browser/content/browser.xul:1:1)

The problem is

    if (!this.isRemote) {
      params.frameOuterWindowID = WebNavigationFrames.getFrameId(this.target.ownerGlobal);
    }

In the iframe case, this.target is a DeadObject, so this.target.ownerGlobal throws.
In the non-iframe case, this.target.ownerGlobal is null, so window.parent === window throws in getFrameId.

This worked correctly before bug 1190687.

This is a regression (bug 1025568), so please add automated tests to ensure this doesn't happen a third time.
Flags: needinfo?(lgreco)
status-firefox53: --- → unaffected
status-firefox54: --- → affected
status-firefox55: --- → affected
(Assignee)

Updated

6 days ago
Assignee: nobody → lgreco
Status: NEW → ASSIGNED
Comment hidden (mozreview-request)
(Assignee)

Updated

4 days ago
Attachment #8860988 - Flags: review?(kmaglione+bmo)
Comment hidden (mozreview-request)
You need to log in before you can comment on or make changes to this bug.