Skip to content

Should location-object-navigate (and friends) queue a task to navigate instead of navigating directly? #3730

@zetafunction

Description

@zetafunction

location-object-navigate doesn't currently specify that a task is queued to perform the navigation. However, it looks like some browsers do queue this:

document.body.appendChild(document.createElement('iframe'));window[window.length-1].location = 'javascript:console.log(2);';console.log(1);

In IE, this prints 2 and then 1.
In Chrome, Firefox, and Safari, this prints 1 and then 2.

Similarly, should window.open() queue a task to navigate as well?

var w = window.open('javascript:window.opener.console.log(2)');console.log(1);

In Chrome and Safari, this prints 2 and then 1.
In Firefox and IE, this prints 1 and then 2.

And there's also HTMLIFrameElement.src:

document.body.appendChild(document.createElement('iframe')).src = 'javascript:console.log(2);';console.log(1);

In Chrome, IE, and Safari, this prints 2 and then 1.
In Firefox, this prints 1 and then 2.

Queueing a task would be consistent with https://html.spec.whatwg.org/multipage/links.html#following-hyperlinks-2, but it's not clear to me it's the right thing to do.

I'm not sure of a way to test this hypothesis without using javascript: URLs: it's entirely possible that the reason Firefox always prints 1 before 2 is because it is the only implementation that queues a task to process javascript: URLs.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions