mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 699633 - "Inline workers broken". r=sicking, test by Jussi Kalliokoski <jussi.kalliokoski@gmail.com>.
This commit is contained in:
parent
05223144e8
commit
17d7b1154e
@ -460,8 +460,7 @@ public:
|
||||
// worker's primary script.
|
||||
if (mIsWorkerScript) {
|
||||
// Take care of the base URI first.
|
||||
rv = mWorkerPrivate->SetBaseURI(finalURI);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
mWorkerPrivate->SetBaseURI(finalURI);
|
||||
|
||||
// Now to figure out which principal to give this worker.
|
||||
WorkerPrivate* parent = mWorkerPrivate->GetParent();
|
||||
|
@ -2082,69 +2082,62 @@ WorkerPrivateParent<Derived>::UpdateGCZeal(JSContext* aCx, PRUint8 aGCZeal)
|
||||
#endif
|
||||
|
||||
template <class Derived>
|
||||
nsresult
|
||||
void
|
||||
WorkerPrivateParent<Derived>::SetBaseURI(nsIURI* aBaseURI)
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
|
||||
mBaseURI = aBaseURI;
|
||||
|
||||
nsCOMPtr<nsIURL> url(do_QueryInterface(aBaseURI));
|
||||
NS_ENSURE_TRUE(url, NS_ERROR_NO_INTERFACE);
|
||||
if (NS_FAILED(aBaseURI->GetSpec(mLocationInfo.mHref))) {
|
||||
mLocationInfo.mHref.Truncate();
|
||||
}
|
||||
|
||||
nsresult rv = url->GetSpec(mLocationInfo.mHref);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (NS_FAILED(aBaseURI->GetHost(mLocationInfo.mHostname))) {
|
||||
mLocationInfo.mHostname.Truncate();
|
||||
}
|
||||
|
||||
rv = url->GetHost(mLocationInfo.mHostname);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = url->GetPath(mLocationInfo.mPathname);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (NS_FAILED(aBaseURI->GetPath(mLocationInfo.mPathname))) {
|
||||
mLocationInfo.mPathname.Truncate();
|
||||
}
|
||||
|
||||
nsCString temp;
|
||||
|
||||
rv = url->GetQuery(temp);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!temp.IsEmpty()) {
|
||||
nsCOMPtr<nsIURL> url(do_QueryInterface(aBaseURI));
|
||||
if (url && NS_SUCCEEDED(url->GetQuery(temp)) && !temp.IsEmpty()) {
|
||||
mLocationInfo.mSearch.AssignLiteral("?");
|
||||
mLocationInfo.mSearch.Append(temp);
|
||||
}
|
||||
|
||||
rv = url->GetRef(temp);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!temp.IsEmpty()) {
|
||||
nsAutoString unicodeRef;
|
||||
|
||||
if (NS_SUCCEEDED(aBaseURI->GetRef(temp)) && !temp.IsEmpty()) {
|
||||
nsCOMPtr<nsITextToSubURI> converter =
|
||||
do_GetService(NS_ITEXTTOSUBURI_CONTRACTID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
do_GetService(NS_ITEXTTOSUBURI_CONTRACTID);
|
||||
if (converter) {
|
||||
nsCString charset;
|
||||
rv = url->GetOriginCharset(charset);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = converter->UnEscapeURIForUI(charset, temp, unicodeRef);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
mLocationInfo.mHash.AssignLiteral("#");
|
||||
mLocationInfo.mHash.Append(NS_ConvertUTF16toUTF8(unicodeRef));
|
||||
}
|
||||
nsAutoString unicodeRef;
|
||||
if (NS_SUCCEEDED(aBaseURI->GetOriginCharset(charset)) &&
|
||||
NS_SUCCEEDED(converter->UnEscapeURIForUI(charset, temp,
|
||||
unicodeRef))) {
|
||||
mLocationInfo.mHash.AssignLiteral("#");
|
||||
mLocationInfo.mHash.Append(NS_ConvertUTF16toUTF8(unicodeRef));
|
||||
}
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
if (mLocationInfo.mHash.IsEmpty()) {
|
||||
mLocationInfo.mHash.AssignLiteral("#");
|
||||
mLocationInfo.mHash.Append(temp);
|
||||
}
|
||||
}
|
||||
|
||||
rv = url->GetScheme(mLocationInfo.mProtocol);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mLocationInfo.mProtocol.AppendLiteral(":");
|
||||
if (NS_SUCCEEDED(aBaseURI->GetScheme(mLocationInfo.mProtocol))) {
|
||||
mLocationInfo.mProtocol.AppendLiteral(":");
|
||||
}
|
||||
else {
|
||||
mLocationInfo.mProtocol.Truncate();
|
||||
}
|
||||
|
||||
PRInt32 port;
|
||||
rv = url->GetPort(&port);
|
||||
if (NS_SUCCEEDED(rv) && port != -1) {
|
||||
if (NS_SUCCEEDED(aBaseURI->GetPort(&port)) && port != -1) {
|
||||
mLocationInfo.mPort.AppendInt(port);
|
||||
|
||||
nsCAutoString host(mLocationInfo.mHostname);
|
||||
@ -2156,8 +2149,6 @@ WorkerPrivateParent<Derived>::SetBaseURI(nsIURI* aBaseURI)
|
||||
else {
|
||||
mLocationInfo.mHost.Assign(mLocationInfo.mHostname);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
template <class Derived>
|
||||
|
@ -375,7 +375,7 @@ public:
|
||||
return mBaseURI;
|
||||
}
|
||||
|
||||
nsresult
|
||||
void
|
||||
SetBaseURI(nsIURI* aBaseURI);
|
||||
|
||||
nsIURI*
|
||||
|
@ -55,6 +55,7 @@ _TEST_FILES = \
|
||||
test_404.html \
|
||||
test_atob.html \
|
||||
atob_worker.js \
|
||||
test_blobWorkers.html \
|
||||
test_close.html \
|
||||
close_worker.js \
|
||||
test_errorPropagation.html \
|
||||
|
35
dom/workers/test/test_blobWorkers.html
Normal file
35
dom/workers/test/test_blobWorkers.html
Normal file
@ -0,0 +1,35 @@
|
||||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js">
|
||||
</script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
const message = "hi";
|
||||
|
||||
const workerScript =
|
||||
"onmessage = function(event) {" +
|
||||
" postMessage(event.data);" +
|
||||
"};";
|
||||
|
||||
var bb = new MozBlobBuilder();
|
||||
bb.append(workerScript);
|
||||
|
||||
var worker = new Worker(URL.createObjectURL(bb.getBlob()));
|
||||
worker.onmessage = function(event) {
|
||||
is(event.data, message, "Got correct message");
|
||||
SimpleTest.finish();
|
||||
};
|
||||
worker.postMessage(message);
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue
Block a user