Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistency: prerender documents get nonsensical frameId #396

Open
bershanskiy opened this issue May 24, 2023 · 3 comments
Open

Inconsistency: prerender documents get nonsensical frameId #396

bershanskiy opened this issue May 24, 2023 · 3 comments
Labels
follow-up: chrome Needs a response from a Chrome representative inconsistency Inconsistent behavior across browsers topic: prerender

Comments

@bershanskiy
Copy link
Member

Description

When document is prerendered, it gets the correct tabId, but its frameId is not correct if it is a top-level document.

Example

The following chrome.runtime.Sender was received on Chrome 112:

{
    "id": "eimadpbcbfnmbkopoojfekhnkhdbieeh",
    "url": "http://example.com/",
    "origin": "http://example.com",
    "frameId": 697,
    "documentId": "26B9995FADB439DA29A5EB8FEDA94D5A",
    "documentLifecycle": "prerender",
    "tab": {
        "active": true,
        "audible": false,
        "autoDiscardable": true,
        "discarded": false,
        "favIconUrl": "",
        "groupId": -1,
        "height": 653,
        "highlighted": true,
        "id": 1013287509,
        "incognito": false,
        "index": 1,
        "mutedInfo": {
            "muted": false
        },
        "openerTabId": 1013287455,
        "pinned": false,
        "selected": true,
        "status": "complete",
        "title": "New Tab",
        "url": "chrome://newtab/",
        "width": 1280,
        "windowId": 1013287454
    }
}
@zombie
Copy link
Collaborator

zombie commented May 25, 2023

@oliverdunk oliverdunk added the follow-up: chrome Needs a response from a Chrome representative label May 25, 2023
@oliverdunk
Copy link
Member

As discussed in the meeting, I want to confirm if this is a bug or intended behaviour that needs additional documentation.

@tophf
Copy link

tophf commented May 29, 2023

This is the intended behavior, see https://developer.chrome.com/blog/extension-instantnav/

Extension authors that assume the frameId of the outermost frame is 0 (a previous best practice) may have problems. Since a tab can now have multiple outermost frames (prerendered and cached pages), the assumption that there is a single outermost frame for a tab is incorrect. frameId == 0 will still continue to represent the outermost frame of the active page, but the outermost frames of other pages in the same tab will be non-zero. A new field frameType has been added to fix this problem. See the “How do I determine if a frame is the outermost frame?” section of this post.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
follow-up: chrome Needs a response from a Chrome representative inconsistency Inconsistent behavior across browsers topic: prerender
Projects
None yet
Development

No branches or pull requests

6 participants