mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1154812. Fix location.pathname to return the right thing in workers. r=baku
This commit is contained in:
parent
f334c48f31
commit
bb5dfb44a0
@ -7139,22 +7139,27 @@ nsContentUtils::GetInnerWindowID(nsIRequest* aRequest)
|
||||
}
|
||||
|
||||
void
|
||||
nsContentUtils::GetHostOrIPv6WithBrackets(nsIURI* aURI, nsAString& aHost)
|
||||
nsContentUtils::GetHostOrIPv6WithBrackets(nsIURI* aURI, nsCString& aHost)
|
||||
{
|
||||
aHost.Truncate();
|
||||
nsAutoCString hostname;
|
||||
nsresult rv = aURI->GetHost(hostname);
|
||||
nsresult rv = aURI->GetHost(aHost);
|
||||
if (NS_FAILED(rv)) { // Some URIs do not have a host
|
||||
return;
|
||||
}
|
||||
|
||||
if (hostname.FindChar(':') != -1) { // Escape IPv6 address
|
||||
MOZ_ASSERT(!hostname.Length() ||
|
||||
(hostname[0] !='[' && hostname[hostname.Length() - 1] != ']'));
|
||||
hostname.Insert('[', 0);
|
||||
hostname.Append(']');
|
||||
if (aHost.FindChar(':') != -1) { // Escape IPv6 address
|
||||
MOZ_ASSERT(!aHost.Length() ||
|
||||
(aHost[0] !='[' && aHost[aHost.Length() - 1] != ']'));
|
||||
aHost.Insert('[', 0);
|
||||
aHost.Append(']');
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsContentUtils::GetHostOrIPv6WithBrackets(nsIURI* aURI, nsAString& aHost)
|
||||
{
|
||||
nsAutoCString hostname;
|
||||
GetHostOrIPv6WithBrackets(aURI, hostname);
|
||||
CopyUTF8toUTF16(hostname, aHost);
|
||||
}
|
||||
|
||||
|
@ -2282,6 +2282,7 @@ public:
|
||||
* otherwise it just outputs the hostname in aHost.
|
||||
*/
|
||||
static void GetHostOrIPv6WithBrackets(nsIURI* aURI, nsAString& aHost);
|
||||
static void GetHostOrIPv6WithBrackets(nsIURI* aURI, nsCString& aHost);
|
||||
|
||||
/*
|
||||
* Call the given callback on all remote children of the given top-level
|
||||
|
@ -3996,17 +3996,16 @@ WorkerPrivateParent<Derived>::SetBaseURI(nsIURI* aBaseURI)
|
||||
mLocationInfo.mHref.Truncate();
|
||||
}
|
||||
|
||||
if (NS_FAILED(aBaseURI->GetHost(mLocationInfo.mHostname))) {
|
||||
mLocationInfo.mHostname.Truncate();
|
||||
}
|
||||
mLocationInfo.mHostname.Truncate();
|
||||
nsContentUtils::GetHostOrIPv6WithBrackets(aBaseURI, mLocationInfo.mHostname);
|
||||
|
||||
if (NS_FAILED(aBaseURI->GetPath(mLocationInfo.mPathname))) {
|
||||
nsCOMPtr<nsIURL> url(do_QueryInterface(aBaseURI));
|
||||
if (!url || NS_FAILED(url->GetFilePath(mLocationInfo.mPathname))) {
|
||||
mLocationInfo.mPathname.Truncate();
|
||||
}
|
||||
|
||||
nsCString temp;
|
||||
|
||||
nsCOMPtr<nsIURL> url(do_QueryInterface(aBaseURI));
|
||||
if (url && NS_SUCCEEDED(url->GetQuery(temp)) && !temp.IsEmpty()) {
|
||||
mLocationInfo.mSearch.Assign('?');
|
||||
mLocationInfo.mSearch.Append(temp);
|
||||
|
@ -1,5 +0,0 @@
|
||||
[members.html]
|
||||
type: testharness
|
||||
[members of WorkerLocation]
|
||||
expected: FAIL
|
||||
|
@ -1,5 +0,0 @@
|
||||
[redirect.html]
|
||||
type: testharness
|
||||
[location with a worker in separate file that redirects]
|
||||
expected: FAIL
|
||||
|
@ -1,5 +0,0 @@
|
||||
[setting-members.html]
|
||||
type: testharness
|
||||
[setting members of WorkerLocation]
|
||||
expected: FAIL
|
||||
|
@ -1,5 +0,0 @@
|
||||
[worker-separate-file.html]
|
||||
type: testharness
|
||||
[location with a worker in separate file]
|
||||
expected: FAIL
|
||||
|
@ -9,7 +9,7 @@
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('helper-redirect.py?fail');
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
worker.onmessage = this.step_func_done(function(e) {
|
||||
assert_equals(e.data[0], location.href.replace(/\/[^\/]+$/, '/post-location-members.js?a'));
|
||||
assert_equals(e.data[1], location.protocol);
|
||||
assert_equals(e.data[2], location.host);
|
||||
|
Loading…
Reference in New Issue
Block a user