“SECURITY_ERR: DOM Exception 18” on “iOS9.3 Beta3” Safari

This error occurs when the history.pushState() or history.replaceState() method is called more than 100 times.

This error occurs in “iOS9.3 Beta3” Safari, but does not occur in “iOS9.3 Beta1” Safari.


The following is a test method.


1. Open xcode7.3 beta3, launch the iOS simulator.

2. Open Safari in iOS simulator.

3. Enter address of “http://www.apple.com” on Safari.

4. Open Safari on Mac, and then link to the simulator.

5. Type the following test program to the console.

for (var i=0 ; i<=100; i++) { window.history.pushState(null, null, "http://www.apple.com/"); }

for (var i=0 ; i<=100; i++) { window.history.replaceState(null, null, "http:/www.apple.com/"); }


I get the following error when “i = 100".


▼In the case of history.replaceState() method.

=======================================

Error: SecurityError: DOM Exception 18

code: 18

column: 124

line: 1

message: "SecurityError: DOM Exception 18"

name: "SecurityError"

stack: "replaceState@[native code]↵eval code↵eval@[native code]↵_evaluateOn↵_evaluateAndWrap↵evaluate"

DOMException prototype

=======================================


▼In the case of history.pushState() method.

=======================================

Error: SecurityError: DOM Exception 18

code: 18

column: 175

line: 1

message: "SecurityError: DOM Exception 18"

name: "SecurityError"

stack: "pushState@[native code]↵eval code↵eval@[native code]↵_evaluateOn↵_evaluateAndWrap↵evaluate"

DOMException prototype

=======================================


My question, which is true, a bug or spec?

Thank you guys

Replies

I've the same "issue", Also with "iOS9.3 Beta3".

I also would be grateful for an answer 🙂

So xcode7.3 beta4 has been released today that I tried again.

But still the same error occurrs!!


I think this is a surely bug.

I really hope to be fixed before the release😢


Please let me know if anyone knows a workaround for this bug.

Please file a bug report ("Report Bugs" link at the bottom right corner of the forum page) to make sure Apple knows about the problem.

I now was also posted to the bug reporter.

Thank you!

By the way, As affected by this bug, site that manages the page transition in pushState and replaceState can not be a transition 100 or more.


For example, it has confirmed to be a jQuery Mobile in the transition error.

I was posted to the bug report, there was the following reply from the apple.


=============================================

This issue behaves as intended based on the following:

This is by design. We fixed a security bug in iOS that abused pushState/replaceState.

We are now closing this bug report.

If you have questions about the resolution, or if this is still a critical issue for you, then please update your bug report with that information.

Please be sure to regularly check new Apple releases for any updates that might affect this issue.

=============================================


I can not believe because this problem is the design.


If this is it's design, Web pages and apps that have a page transition management by pushState or replaceState means that only up to 100 times can not transition.

I've posted a bug report on this, as we have the same problem in the official release of 9.3.


It may be by design, but it's breaking SPA's, so having as many devs as possible nag about it should pressure them a bit.

+1


I am experiencing this problem in an application the runs in WkWebView.


Can you post a link to bug report?

Apparently the limit was changed to 100 calls per 30 seconds. But I still see an absolute limit on the number of calls in ios 9.3.2 WKWebView.


https://trac.webkit.org/changeset/198687


I haven't sorted out how to determine when a particular webkit change lands in iOS.