history.pushState() with "?" not working for file:// URLs
Reported by
martin.h...@gmail.com,
Jun 10 2016
|
||||
Issue description
UserAgent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.84 Safari/537.36
Steps to reproduce the problem:
1. Run Chrome/Chromium with or without --allow-file-access-from-files (same result)
2. Load an HTML5 page from a file:// URL, let's say file:///D:/folder/file.html
3. Call history.pushState({}, 'dummyTitle', '#foo=bar')
4. Call history.pushState({}, 'dummyTitle', '?foo=bar')
5. Call history.pushState({}, 'dummyTitle', 'file:///D:/folder/file.html?foo=bar')
What is the expected behavior?
All three calls work. This was the behavior until at least Chromium v49 (maybe also v50).
What went wrong?
Only call in step 3. (with '#' character) works.
Calls in step 4. and 5. fail: Uncaught DOMException: Failed to execute 'pushState' on 'History': A history state object with URL 'file:///D:/folder/file.html?foo=bar' cannot be created in a document with origin 'null' and URL 'file:///D:/Dev/2GoRC_2_access/web/2.1.0.0/partials/unsupportedbrowser_fileurl.html'
Did this work before? Yes v49.0
Chrome version: 53.0.2764.0 Channel: stable
OS Version: 6.1 (Windows 7, Windows Server 2008 R2)
Flash Version: 22.0.0.185
,
Jun 10 2016
Portable web applications would profit from fixing this
,
Jun 10 2016
,
Jun 10 2016
,
Jun 12 2016
The issue is caused by "equalIgnoringFragmentIdentifier()". I sumbit the patch https://codereview.chromium.org/2060093002/ . By testing , it is ok .
,
Jun 12 2016
In https://bugs.chromium.org/p/chromium/issues/detail?id=528681, we carved out an exception for pushing fragment state for `file://` URLs. It's probably reasonable to extend that to include query state as well. I don't think we should extend it to include path changes, however, for the reasons outlined in that bug. Thanks for providing a patch; I'll take a look at it shortly.
,
Jun 17 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/c21f0b11ac83ea970d0eaf6a0b223d48a32a4b32 commit c21f0b11ac83ea970d0eaf6a0b223d48a32a4b32 Author: pxinchao <pxinchao@gmail.com> Date: Fri Jun 17 13:03:05 2016 Allow 'history.pushState' to modify query string for unique and file origins. Add function equalIgnoringQueryAndFragment to ignore query and fragment for History. BUG=618989 Review-Url: https://codereview.chromium.org/2060093002 Cr-Commit-Position: refs/heads/master@{#400418} [modify] https://crrev.com/c21f0b11ac83ea970d0eaf6a0b223d48a32a4b32/AUTHORS [modify] https://crrev.com/c21f0b11ac83ea970d0eaf6a0b223d48a32a4b32/third_party/WebKit/LayoutTests/http/tests/navigation/pushstate-at-unique-origin-denied.php [modify] https://crrev.com/c21f0b11ac83ea970d0eaf6a0b223d48a32a4b32/third_party/WebKit/LayoutTests/http/tests/navigation/pushstate-whitelisted-at-unique-origin-denied.php [modify] https://crrev.com/c21f0b11ac83ea970d0eaf6a0b223d48a32a4b32/third_party/WebKit/Source/core/frame/History.cpp
,
Jun 27 2016
Thanks for investigating this. Would be great to have the issue fixed soon!
,
Jan 11
This issue has been marked as started, but has no owner. Making available. |
||||
►
Sign in to add a comment |
||||
Comment 1 by martin.h...@gmail.com
, Jun 10 2016