Bug 949413 - Set href with context in Location.assign r?bz
MozReview-Commit-ID: Ao5eIxdo5Qv
--- a/dom/base/nsLocation.cpp
+++ b/dom/base/nsLocation.cpp
@@ -917,16 +917,20 @@ nsLocation::Replace(const nsAString& aUr
NS_ENSURE_SUCCESS(rv, rv);
return SetHrefWithBase(aUrl, oldUri, true);
}
NS_IMETHODIMP
nsLocation::Assign(const nsAString& aUrl)
{
+ if (JSContext *cx = nsContentUtils::GetCurrentJSContext()) {
+ return SetHrefWithContext(cx, aUrl, false);
+ }
+
nsAutoString oldHref;
nsresult result = NS_OK;
result = GetHref(oldHref);
if (NS_SUCCEEDED(result)) {
nsCOMPtr<nsIURI> oldUri;
--- a/testing/web-platform/meta/html/infrastructure/urls/resolving-urls/query-encoding/utf-16be.html.ini
+++ b/testing/web-platform/meta/html/infrastructure/urls/resolving-urls/query-encoding/utf-16be.html.ini
@@ -101,19 +101,16 @@
if debug and (os == "win") and (version == "6.2.9200") and (processor == "x86_64") and (bits == 64): TIMEOUT
if debug and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): TIMEOUT
if debug and (os == "win") and (version == "10.0.10240") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "win") and (version == "10.0.10240") and (processor == "x86_64") and (bits == 64): TIMEOUT
[loading webvtt <track>]
expected: TIMEOUT
- [location.assign()]
- expected: FAIL
-
[history.pushState]
expected: FAIL
[history.replaceState]
expected: FAIL
[SharedWorker() in a dedicated worker]
expected: FAIL
--- a/testing/web-platform/meta/html/infrastructure/urls/resolving-urls/query-encoding/utf-16le.html.ini
+++ b/testing/web-platform/meta/html/infrastructure/urls/resolving-urls/query-encoding/utf-16le.html.ini
@@ -101,19 +101,16 @@
if debug and (os == "win") and (version == "6.2.9200") and (processor == "x86_64") and (bits == 64): TIMEOUT
if debug and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): TIMEOUT
if debug and (os == "win") and (version == "10.0.10240") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "win") and (version == "10.0.10240") and (processor == "x86_64") and (bits == 64): TIMEOUT
[loading webvtt <track>]
expected: TIMEOUT
- [location.assign()]
- expected: FAIL
-
[history.pushState]
expected: FAIL
[history.replaceState]
expected: FAIL
[SharedWorker() in a dedicated worker]
expected: FAIL
--- a/testing/web-platform/meta/html/infrastructure/urls/resolving-urls/query-encoding/utf-8.html.ini
+++ b/testing/web-platform/meta/html/infrastructure/urls/resolving-urls/query-encoding/utf-8.html.ini
@@ -101,19 +101,16 @@
if debug and (os == "win") and (version == "6.2.9200") and (processor == "x86_64") and (bits == 64): TIMEOUT
if debug and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): TIMEOUT
if debug and (os == "win") and (version == "10.0.10240") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "win") and (version == "10.0.10240") and (processor == "x86_64") and (bits == 64): TIMEOUT
[loading webvtt <track>]
expected: TIMEOUT
- [location.assign()]
- expected: FAIL
-
[history.pushState]
expected: FAIL
[history.replaceState]
expected: FAIL
[SharedWorker() in a dedicated worker]
expected: FAIL
--- a/testing/web-platform/meta/html/infrastructure/urls/resolving-urls/query-encoding/windows-1252.html.ini
+++ b/testing/web-platform/meta/html/infrastructure/urls/resolving-urls/query-encoding/windows-1252.html.ini
@@ -19,19 +19,16 @@
expected: FAIL
[EventSource#url]
expected: FAIL
[window.open()]
expected: FAIL
- [location.assign()]
- expected: FAIL
-
[history.pushState]
expected: FAIL
[history.replaceState]
expected: FAIL
[importScripts() in a dedicated worker]
expected: FAIL