Appending a script tag with a remote src in a promise on a window focus event can prevent/hijack navigation via the address bar
Categories
(Core :: DOM: Navigation, defect, P2)
Tracking
()
People
(Reporter: gshively11, Unassigned)
Details
(Keywords: reporter-external)
Comment 1•7 years ago
|
||
Comment 2•7 years ago
|
||
Updated•7 years ago
|
Updated•7 years ago
|
Comment 4•7 years ago
|
||
Comment 5•7 years ago
|
||
Comment 6•7 years ago
|
||
Updated•7 years ago
|
Reporter | ||
Comment 7•7 years ago
|
||
Reporter | ||
Comment 8•7 years ago
|
||
Comment 9•7 years ago
|
||
Reporter | ||
Comment 10•7 years ago
|
||
Comment 11•7 years ago
|
||
Comment 12•7 years ago
|
||
Comment 13•6 years ago
|
||
Reporter | ||
Comment 14•6 years ago
|
||
Reporter | ||
Comment 15•6 years ago
|
||
Reporter | ||
Updated•6 years ago
|
Reporter | ||
Updated•6 years ago
|
Reporter | ||
Updated•6 years ago
|
Reporter | ||
Comment 17•6 years ago
|
||
Reporter | ||
Updated•6 years ago
|
Reporter | ||
Updated•6 years ago
|
Comment 18•6 years ago
|
||
Grant asked on bug 1518942 whether this bug is a dupe of bug 1263100 as well. This bug doesn't use beforeunload (like bug 1263100 and its dupes) but:
(In reply to Grant Shively from comment #5)
it uses focus instead. Navigating via the address bar triggers one final focus on the page, and we figured out a way to detect that last focus, so we use it to trigger an asynchronous window.location.assign, which is the heart of the bug. This method doesn't hijack as many navigation methods as beforeunload does, but it's still using the same core bug.
:qdot, do you think there's any point keeping these separate? (I'll add some more context on bug 1263100 in a bit.)
Reporter | ||
Comment 19•6 years ago
|
||
I should mention that we discovered the whole remote script src tag onerror thing from the original submission is unnecessary. Any network request can be used to trigger code on the last page focus before navigation:
https://826pz3mzpj.codesandbox.io/
window.addEventListener("focus", () => {
fetch("https://826pz3mzpj.codesandbox.io/file.txt").catch(
() => window.location.assign("https://media2.giphy.com/media/lk0TFUdop2JTW/giphy.gif")
);
});
Comment 20•6 years ago
|
||
:gijs Yeah, that should be fine. I think a few of our other onunloadbefore issues could probably just be pointed there too. With the spec discussion happening there, it's a good outline of the general problem a lot of these bugs encompass.
Comment 21•6 years ago
|
||
(In reply to Grant Shively from comment #15)
can I get approval from Mozilla to publish an article about it?
Given the similarity in effect to a public bug and it being sec-low, sure.
Comment 22•6 years ago
|
||
(In reply to Kyle Machulis [:qdot] [:kmachulis] (if a patch has no decent commit message, automatic r-) from comment #20)
:gijs Yeah, that should be fine. I think a few of our other onunloadbefore issues could probably just be pointed there too. With the spec discussion happening there, it's a good outline of the general problem a lot of these bugs encompass.
Alright, let's dupe this over then.
Updated•5 years ago
|
Updated•9 months ago
|
Description
•