Commit Graph
79 Commits
Author SHA1 Message Date
Leo Tenenbaum 8f03313497 Bug 2022155 - Remove inScript check to do replace instead of push navigation. r=farre
Differential Revision: https://phabricator.services.mozilla.com/D288921
2026-03-31 21:37:48 +00:00
Sylvestre Ledru 9eb1a31a98 Bug 2023419 - Remove Emacs/Vim modelines from dom/ r=emilio,media-playback-reviewers,webidl,padenot
replaced by .editorconfig
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D287843
2026-03-16 21:02:32 +00:00
Simon Farre 8c5176b7fb Bug 2002750 - Serve Navigate algorithm with sourceDoc r=farre
The algorithm https://html.spec.whatwg.org/#beginning-navigation takes
an optional Document-or-null, that we are currently not passing to our
implementation of this algorithm.

Navigation::Navigate is supposed to provide the document that is
navigating away as the source document, which would differ from the old
LocationBase::Navigate behavior, which always takes the incumbent global
document as the source document (just like spec says for Location).

This change makes it possible to provide the aSourceDocument.

Differential Revision: https://phabricator.services.mozilla.com/D274272
2025-11-27 14:36:57 +00:00
Andreas Farre f3e6a0d058 Bug 1991265 - Make push to replace load conversion follow spec. r=smaug,webdriver-reviewers
Make sure that navigations from Location and Window.open perform correct
conversion of history handling when passed "auto".

Differential Revision: https://phabricator.services.mozilla.com/D266519
2025-10-13 07:25:01 +00:00
Cristina Horotan 2b88ccd9ac Revert "Bug 1991265 - Make push to replace load conversion follow spec. r=smaug,webdriver-reviewers" for causing wpt failures on location-setter-user-mouseup.html
This reverts commit 310a6f3939.
2025-10-08 17:45:53 +00:00
Andreas Farre 310a6f3939 Bug 1991265 - Make push to replace load conversion follow spec. r=smaug,webdriver-reviewers
Make sure that navigations from Location and Window.open perform correct
conversion of history handling when passed "auto".

Differential Revision: https://phabricator.services.mozilla.com/D266519
2025-10-08 16:15:45 +00:00
Serban Stanca c8e38a7f68 Revert "Bug 1991265 - Make push to replace load conversion follow spec. r=smaug" for causing wpt failures.
This reverts commit 91a14bd037.
2025-10-03 11:27:03 +00:00
Andreas Farre 91a14bd037 Bug 1991265 - Make push to replace load conversion follow spec. r=smaug
Make sure that navigations from Location and Window.open perform correct
conversion of history handling when passed "auto".

Differential Revision: https://phabricator.services.mozilla.com/D266519
2025-10-03 07:51:56 +00:00
Alexandru Marc 07a3bf3fb5 Revert "Bug 1991265 - Make push to replace load conversion follow spec. r=smaug" for causing multiple failures
This reverts commit 9dd79a9a56.
2025-10-02 23:54:32 +00:00
Andreas Farre 9dd79a9a56 Bug 1991265 - Make push to replace load conversion follow spec. r=smaug
Make sure that navigations from Location and Window.open perform correct
conversion of history handling when passed "auto".

Differential Revision: https://phabricator.services.mozilla.com/D266519
2025-10-02 22:36:01 +00:00
Andreas Farre 5d26ed1b18 Bug 1990832 - Correctly handle "auto" history behavior. r=jjaschke
Differential Revision: https://phabricator.services.mozilla.com/D266314
2025-09-26 09:27:57 +00:00
Emilio Cobos Álvarez 791917d8af Bug 1976665 - Sort headers in dom/. r=dom-core,media-playback-reviewers,webrtc-reviewers,dom-storage-reviewers,padenot,janv,smaug,jesup,jib
Most changes are automated. Relevant bit is dom/.clang-format. I had to
manually disable clang-format in a few places where importing external
files and so on that aren't self-contained, and fix a couple includes /
forward declarations.

Differential Revision: https://phabricator.services.mozilla.com/D256800
2025-08-05 11:47:34 +00:00
Jan-Niklas Jaeschke 55e4343d14 Bug 1959961, part 2 - Navigation API: Implement #navigate. r=farre,dom-core
This patch copies the code from `LocationBase::SetURI()` and
`LocationBase::CheckURL()` into a new method called `NavigateNavigable()`.

The goal of this new method is to follow the spec
(https://html.spec.whatwg.org/#navigate) as close as possible.
This should be done in follow-up bugs.

Differential Revision: https://phabricator.services.mozilla.com/D249531
2025-07-22 12:59:12 +00:00
Fatih Kilic eed44c4862 Bug 1968607 - Part 1: Replace CSP with PolicyContainer. r=tschuster,webidl,smaug
We are making changes to many files. Very huge chunk of the changes are just renaming CSP -> PolicyContainer. Part 1 and part 2 are solely separated as frontend and backend. The unfortunate thing is, I mistakenly placed IDL changes in part 1, and many of those IDL changes affect frontend code too. I'm sorry for this inconvinience and hard to review patch(es).

(FWIW before this rewrite we had another patch stack. It is 25 patches and I believe isn't as comprehensive as this one. It also didn't replace CSP's inheritance but was copied alongside with CSP, but we decided to change our method and make policy conttainer contain CSP and copy it around after some discussion and reviews)

Differential Revision: https://phabricator.services.mozilla.com/D249248
2025-07-11 05:39:17 +00:00
agoloman ba849fe40a Revert "Bug 1959961, part 4 - Navigation API: Update test expectations. r=farre" for causing build bustages @Navigation.cpp.
This reverts commit 1c7513c5e5.

Revert "Bug 1959961, part 3 - Navigation API: Add flag to `nsIWebNavigation::Stop()` whether to unset the ongoing navigation. r=farre,dom-core"

This reverts commit 66456a158d.

Revert "Bug 1959961, part 2 - Navigation API: Implement #navigate. r=farre,dom-core"

This reverts commit a79033733d.

Revert "Bug 1959961, part 1 - Navigation API: Implement #dom-navigation-navigate. r=farre,dom-core"

This reverts commit f04b5a3c99.
2025-06-30 21:04:09 +00:00
Jan-Niklas Jaeschke a79033733d Bug 1959961, part 2 - Navigation API: Implement #navigate. r=farre,dom-core
This patch copies the code from `LocationBase::SetURI()` and
`LocationBase::CheckURL()` into a new method called `NavigateNavigable()`.

The goal of this new method is to follow the spec
(https://html.spec.whatwg.org/#navigate) as close as possible.
This should be done in follow-up bugs.

Differential Revision: https://phabricator.services.mozilla.com/D249531
2025-06-30 20:03:30 +00:00
Tim Huang 464ccfa020 Bug 1968644 - Part 4: Populate triggeringFirstPartyClassificationFlags and triggeringThirdPartyClassificationFlags for loads. r=smaug,necko-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D252445
2025-06-17 20:28:18 +00:00
agoloman a48b34690b Revert "Bug 1968644 - Part 10: Store JSCallingLocation and set the JSCallingLocation fallback for Media loads. r=emilio" for causing valgrid failures.
This reverts commit efd9a5ba48.

Revert "Bug 1968644 - Part 9: Add more tests for loads triggered by tracking scripts. r=valentin,anti-tracking-reviewers,emz"

This reverts commit 7d5c3e1c1c.

Revert "Bug 1968644 - Part 8: Populate the triggeringFirstPartyClassificationFlags and triggeringThirdPartyClassificationFlags for WebSocket requests. r=valentin,necko-reviewers"

This reverts commit 53a783a51e.

Revert "Bug 1968644 - Part 7: Add tests. r=necko-reviewers,anti-tracking-reviewers,emz,valentin"

This reverts commit e52f034955.

Revert "Bug 1968644 - Part 6: Populate triggeringFirstPartyClassificationFlags and triggeringThirdPartyClassificationFlags during channel creation. r=necko-reviewers,kershaw"

This reverts commit f564c21b37.

Revert "Bug 1968644 - Part 5: Populate triggeringFirstPartyClassificationFlags and triggeringThirdPartyClassificationFlags for CSS loads. r=emilio"

This reverts commit 8a8fd7bacc.

Revert "Bug 1968644 - Part 4: Populate triggeringFirstPartyClassificationFlags and triggeringThirdPartyClassificationFlags for loads. r=smaug,necko-reviewers"

This reverts commit 7b3ba3b668.

Revert "Bug 1968644 - Part 3: Populate the triggeringFirstPartyClassificationFlags and triggeringThirdPartyClassificationFlags for fetch requests. r=valentin,smaug"

This reverts commit 08f090244f.

Revert "Bug 1968644 - Part 2: Intorduce the ClassificationFlags to nsIClassifiedChannel.idl. r=dimi,necko-reviewers,valentin"

This reverts commit b8c01cd77c.

Revert "Bug 1968644 - Part 1: Introduce triggeringFirstPartyClassificationFlags and triggeringThirdPartyClassificationFlags to LoadInfo. r=necko-reviewers,kershaw"

This reverts commit a7619a72b4.
2025-06-17 14:27:29 +00:00
Tim Huang 7b3ba3b668 Bug 1968644 - Part 4: Populate triggeringFirstPartyClassificationFlags and triggeringThirdPartyClassificationFlags for loads. r=smaug,necko-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D252445
2025-06-17 09:24:42 +00:00
kernp25 4d18975ff5 Bug 1945924 - Replace SchemeIsFoo functions with the inlined SchemeIs() call. r=valentin,emilio,necko-reviewers,geckoview-reviewers,anti-tracking-reviewers,core-sessionstore-reviewers,ohall,farre
No behavior change intended.

Differential Revision: https://phabricator.services.mozilla.com/D236756
2025-03-31 14:25:54 +00:00
Henri Sivonen c7181d1ea5 Bug 1944220 Avoid JSString -> UTF-16 -> UTF-8 conversions in Location fields. r=webidl,emilio
Differential Revision: https://phabricator.services.mozilla.com/D235753
2025-01-30 16:05:41 +00:00
William Wen 795dad3b68 Bug 1913000 - Add more rate limiting to History interface. r=webidl,smaug,webdriver-reviewers,whimboo
Differential Revision: https://phabricator.services.mozilla.com/D221255
2024-09-19 16:09:02 +00:00
Jan-Niklas Jaeschke 4835874f4b Bug 1888756, part 2 - Text Fragments: Implement setting the textDirectiveUserActivation flag in the document loading algorithm. r=edgar,dom-core
This commit is a prerequisite for part 5 of this patch set.

This flag is set in the docshell, based on `user gesture activation`.
This is not necessarily sufficient,
as the text fragments spec bases the value of
this flag also on User Involvement, which is not
implemented in Gecko yet.

The flag is then plumbed through the parent process
(`DocumentLoadListener::CreateDocumentLoadInfo()`)
to the document, where it can be consumed.
This includes client-side redirects as described in [0].

There is no changed behavior in this commit.

[0] https://wicg.github.io/scroll-to-text-fragment/#restricting-the-text-fragment

Differential Revision: https://phabricator.services.mozilla.com/D212817
2024-06-26 14:24:32 +00:00
Sebastian Hengst a6113c3688 Backed out 7 changesets (bug 1888756) for potentially causing Session History crashes. a=backout
Backed out changeset 85022f2e4129 (bug 1888756)
Backed out changeset 1458ad53d229 (bug 1888756)
Backed out changeset a84d886d8753 (bug 1888756)
Backed out changeset efff3e5e95c2 (bug 1888756)
Backed out changeset 400a8ff57ae4 (bug 1888756)
Backed out changeset 04180e2fb99d (bug 1888756)
Backed out changeset 0eb8b13b0717 (bug 1888756)
2024-06-21 12:08:58 +02:00
Jan-Niklas Jaeschke 96b82fad2f Bug 1888756, part 2 - Text Fragments: Implement setting the textDirectiveUserActivation flag in the document loading algorithm. r=edgar,dom-core
This commit is a prerequisite for part 5 of this patch set.

This flag is set in the docshell, based on `user gesture activation`.
This is not necessarily sufficient,
as the text fragments spec bases the value of
this flag also on User Involvement, which is not
implemented in Gecko yet.

The flag is then plumbed through the parent process
(`DocumentLoadListener::CreateDocumentLoadInfo()`)
to the document, where it can be consumed.
This includes client-side redirects as described in [0].

There is no changed behavior in this commit.

[0] https://wicg.github.io/scroll-to-text-fragment/#restricting-the-text-fragment

Differential Revision: https://phabricator.services.mozilla.com/D212817
2024-06-20 10:24:26 +00:00
Benjamin VanderSloot 2389a4c6cc Bug 1858143 - "has storage access" should only persist during navigations that do not change the iframe's window origin - r=anti-tracking-reviewers,smaug,pbz
Minor correction from https://phabricator.services.mozilla.com/D184821.
The definition of "same-origin" used in that patch was that the iframe's origin after navigation is the same as the triggering principal.
This was incorrect.
Instead, the origin of the iframe before navigation should be the same as after navigation, which is the frame's document principal at the time this is called.

Also, I found places where I missed adding the new fields to the loadinfo: LocationBase and nsFrameLoader.
And I added the redirect tainting check and a missing nullcheck before calling SetTriggeringWindowId in nsDocShell.

Differential Revision: https://phabricator.services.mozilla.com/D190577
2023-10-26 14:24:14 +00:00
Valentin Gosu e20ea2e51f Bug 1817591 - location.href should throw a "SyntaxError" DOMException r=valentin
Differential Revision: https://phabricator.services.mozilla.com/D170350
2023-09-15 20:38:47 +00:00
Peter Van der Beken c10814e75a Bug 1846277 - Remove nsGlobalWindow.h. r=dom-core,necko-reviewers,jesup,farre
Differential Revision: https://phabricator.services.mozilla.com/D184973
2023-08-02 20:41:48 +00:00
Sean Feng b8c8157d3c Bug 1816287 - Always exit fullscreen when triggering on external protocol r=edgar
It's a security risk such that the maximized external program can obscure
the fullscreen notification and the malicious site can use this trick
to load a spoofed page in the background without user notices it.

This patch minimized the risk by always exit the fullscreen mode when
an external protocol is triggered.

Differential Revision: https://phabricator.services.mozilla.com/D177771
2023-05-17 18:00:18 +00:00
Norisz Fay e476e08413 Backed out changeset 6fa00ccfe7e0 (bug 1816287) for causing bustages on LocationBase.cpp CLOSED TREE 2023-05-17 20:11:39 +03:00
Sean Feng 79b4c118c0 Bug 1816287 - Always exit fullscreen when triggering on external protocol r=edgar
It's a security risk such that the maximized external program can obscure
the fullscreen notification and the malicious site can use this trick
to load a spoofed page in the background without user notices it.

This patch minimized the risk by always exit the fullscreen mode when
an external protocol is triggered.

Differential Revision: https://phabricator.services.mozilla.com/D177771
2023-05-17 16:34:57 +00:00
Emilio Cobos Álvarez 8dabbf6590 Bug 1823686 - Share URLExtraData between SVG attribute mapping and style attribute. r=smaug
I don't think there's ever a way these should differ.

Got some include hell from removing ReferrerInfo.h from Document.h but
hopefully should be straight-forward to review.

Depends on D173154

Differential Revision: https://phabricator.services.mozilla.com/D173155
2023-03-22 14:54:43 +00:00
Nika Layzell 2d53f3d108 Bug 1808630 - Part 2: Rename CallerInnerWindow to IncumbentInnerWindow and add EntryInnerWindow, r=smaug
This makes the correlation between the method names and what they do
more clear, and adds an Entry variant for the entry global.

Depends on D166119

Differential Revision: https://phabricator.services.mozilla.com/D166207
2023-01-09 22:22:05 +00:00
Butkovits Atila 917657ea1f Backed out changeset fa7c85ece2b3 (bug 1788513) for causing failures at url/failure.html. 2022-09-02 18:49:49 +03:00
Adam Vandolder 426e37fafc Bug 1788513 - Setting location.href to a malformed URI throws a TypeError. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D156255
2022-09-02 14:07:51 +00:00
Sylvestre Ledru 0a33533196 Bug 1519636 - Reformat recent changes to the Google coding style r=andi,necko-reviewers
Updated with clang-format version 11.0.1 (taskcluster-B6bdwSKDRF-luRQWXBuzpA)

# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D105158
2021-02-15 08:49:20 +00:00
Kris Maglione 1c35164c4d Bug 1647519: Reject javascript: requests targeting other content processes. r=nika
Loads targeting cross-process BrowsingContexts are by definition cross-origin,
which should preclude any javascript: loads. While those loads are currently
prevented by principal checks in the final target process, sending IPC
messages for the attempts is unnecessary, and potentially opens a door to
privilege escalation exploits by a compromised content process.

This patch prevents any cross-process load requests from being sent by content
processes, and adds checks in the parent process to kill any (potentially
compromised) content process which attempts to send them.

Differential Revision: https://phabricator.services.mozilla.com/D103529
2021-02-02 22:24:47 +00:00
Brindusan Cristian 96ac923d39 Backed out changeset e4cefba9f87e (bug 1647519) for build bustages in BrowsingContext.cpp. CLOSED TREE 2021-02-03 00:08:53 +02:00
Kris Maglione f533d213f0 Bug 1647519: Reject javascript: requests targeting other content processes. r=nika
Loads targeting cross-process BrowsingContexts are by definition cross-origin,
which should preclude any javascript: loads. While those loads are currently
prevented by principal checks in the final target process, sending IPC
messages for the attempts is unnecessary, and potentially opens a door to
privilege escalation exploits by a compromised content process.

This patch prevents any cross-process load requests from being sent by content
processes, and adds checks in the parent process to kill any (potentially
compromised) content process which attempts to send them.

Differential Revision: https://phabricator.services.mozilla.com/D103529
2021-02-02 21:46:53 +00:00
Mihai Alexandru Michis 15e3cc11e1 Backed out changeset c0ecccf36d56 (bug 1647519) for causing bustages in BrowsingContext.cpp
CLOSED TREE
2021-02-02 22:47:01 +02:00
Kris Maglione 7731d7d180 Bug 1647519: Reject javascript: requests targeting other content processes. r=nika
Loads targeting cross-process BrowsingContexts are by definition cross-origin,
which should preclude any javascript: loads. While those loads are currently
prevented by principal checks in the final target process, sending IPC
messages for the attempts is unnecessary, and potentially opens a door to
privilege escalation exploits by a compromised content process.

This patch prevents any cross-process load requests from being sent by content
processes, and adds checks in the parent process to kill any (potentially
compromised) content process which attempts to send them.

Differential Revision: https://phabricator.services.mozilla.com/D103529
2021-02-02 20:32:04 +00:00
Brindusan Cristian a235b9837e Backed out changeset 0395717ea76d (bug 1647519) for build bustages at BrowsingContext.cpp. CLOSED TREE 2021-02-02 22:07:10 +02:00
Kris Maglione 967bbfc75c Bug 1647519: Reject javascript: requests targeting other content processes. r=nika
Loads targeting cross-process BrowsingContexts are by definition cross-origin,
which should preclude any javascript: loads. While those loads are currently
prevented by principal checks in the final target process, sending IPC
messages for the attempts is unnecessary, and potentially opens a door to
privilege escalation exploits by a compromised content process.

This patch prevents any cross-process load requests from being sent by content
processes, and adds checks in the parent process to kill any (potentially
compromised) content process which attempts to send them.

Differential Revision: https://phabricator.services.mozilla.com/D103529
2021-02-02 19:47:12 +00:00
Sylvestre Ledru 68b806d604 Bug 1674637 - Use nested namespaces in dom/ r=sg,andi
Also add some missing namespace qualifications

Done with:
./mach static-analysis check --checks="-*,modernize-concat-nested-namespaces" --fix dom/
./mach clang-format -p $(hg status dom/|grep ^M|awk '{print $2}')

Differential Revision: https://phabricator.services.mozilla.com/D95456
2020-11-04 17:04:01 +00:00
Butkovits Atila a6e7dcc53f Backed out changeset c0adbf7522dc (bug 1674637) for bustage on GMPParent.cpp. CLOSED TREE 2020-11-04 10:54:36 +02:00
Sylvestre Ledru 8f709b39e8 Bug 1674637 - Use nested namespaces in dom/ r=sg,andi
Also add some missing namespace qualifications

Done with:
./mach static-analysis check --checks="-*,modernize-concat-nested-namespaces" --fix dom/
./mach clang-format -p $(hg status dom/|grep ^M|awk '{print $2}')

Differential Revision: https://phabricator.services.mozilla.com/D95456
2020-11-04 08:29:00 +00:00
pbz 5c176a0ded Bug 1314912 - Rate limit calls to History and Location interfaces. r=smaug
This adds a rate limit to methods and setters of the History and Location
for non-system callers.
The rate limit is counted per BrowsingContext and can be controlled by prefs.

This patch is based on the original rate limit patch by :freesamael.

Differential Revision: https://phabricator.services.mozilla.com/D90136
2020-09-21 11:54:50 +00:00
Edgar Chen 6fed29e010 Bug 1611961 - Move UserActivationState from BrowsingContext to WindowContext; r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D83126
2020-08-17 11:02:34 +00:00
Csoregi Natalia 1d46598d45 Backed out 3 changesets (bug 1648887, bug 1611961) for assertion failures on WindowContext.cpp. CLOSED TREE
Backed out changeset 3719f7db339d (bug 1648887)
Backed out changeset b7c7fcb5df37 (bug 1648887)
Backed out changeset ab82a9c613f8 (bug 1611961)
2020-08-06 17:43:51 +03:00
Edgar Chen ef727eb50f Bug 1611961 - Move UserActivationState from BrowsingContext to WindowContext; r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D83126
2020-08-06 10:25:00 +00:00