Skip to content

Specify rate limiter for navigation, history traversal, and pushState/replaceState#12492

Open
zcorpan wants to merge 5 commits into
mainfrom
zcorpan/navigation-limit-noop
Open

Specify rate limiter for navigation, history traversal, and pushState/replaceState#12492
zcorpan wants to merge 5 commits into
mainfrom
zcorpan/navigation-limit-noop

Conversation

@zcorpan
Copy link
Copy Markdown
Member

@zcorpan zcorpan commented May 27, 2026

This returns instead of throws for web compat.

Fixes #11108. Fixes #11410.

  • At least two implementers are interested (and none opposed):
    • Gecko
    • Chromium (already implemented)
  • Tests are written and can be reviewed and commented upon at:
  • Implementation bugs are filed:
    • Chromium: …
    • Gecko: …
    • WebKit: …
  • MDN issue is filed: …
  • The top of this comment includes a clear commit message to use.

(See WHATWG Working Mode: Changes for more details.)


/browsing-the-web.html ( diff )
/document-sequences.html ( diff )
/nav-history-apis.html ( diff )

…/replaceState

This returns instead of throws for web compat.

Fixes #11108. Fixes #11410.
@zcorpan zcorpan force-pushed the zcorpan/navigation-limit-noop branch from 0238d1a to f5dda35 Compare May 27, 2026 10:19
Comment thread source Outdated
Comment on lines +107485 to +107486
<li><p>If <var>navigable</var> is not <span>allowed to perform a navigation or history
update</span>, then return.</p></li>
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this should invoke WebDriver BiDi navigation failed.

@farre
Copy link
Copy Markdown
Contributor

farre commented May 27, 2026

This looks pretty much like how I envisioned. The only thing I'm not entirely sure about about is how this affects step 11 of #navigate. i.e the fact that we'll call #stop-intersection-observing-a-lazy-loading-element, and then just return. Maybe that's fine, but I think someone else needs to say so. Otherwise this LGTM.

@zcorpan
Copy link
Copy Markdown
Member Author

zcorpan commented May 27, 2026

Yes I put it there to match Chromium's order.

To notice a difference, you would need to do something like call pushState 199 times on a lazy iframe (before it has navigated to its src), then navigate it with location.href (which hits the rate limit), then wait to reset the counter, then make the iframe visible. (Assuming the limit is 200.)

I think it makes some sense that if code attempts to navigate a lazy iframe, it aborts the lazy load, even if the navigation was rate-limited.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

Repeated navigations with location.hash etc should throw History API: PushState can silently fail in Chromium while Gecko/Webkit raises exception

2 participants