Bug 1168676 - Switch off embed/object ServiceWorker interception. r=ehsan

I would have liked to watch for onerror on the tags instead of having these
todos(), but onerror does not seem to fire. I have locally verified that the
test does indeed receive 404s on the network console.

--HG--
extra : rebase_source : 53c3f05cdca707b692fcf0192ae46ad42d83bc7e
extra : amend_source : 200549af4247ece528e38c7eeaa950809312adf2
This commit is contained in:
Nikhil Marathe 2015-05-28 16:27:45 -07:00
Родитель 6ba5c58d31
Коммит 66014a3f14
3 изменённых файлов: 27 добавлений и 0 удалений

Просмотреть файл

@ -20,6 +20,7 @@
#include "nsIDOMHTMLObjectElement.h"
#include "nsIDOMHTMLAppletElement.h"
#include "nsIExternalProtocolHandler.h"
#include "nsIHttpChannelInternal.h"
#include "nsIObjectFrame.h"
#include "nsIPermissionManager.h"
#include "nsPluginHost.h"
@ -2509,6 +2510,13 @@ nsObjectLoadingContent::OpenChannel()
scriptChannel->SetExecutionPolicy(nsIScriptChannel::EXECUTE_NORMAL);
}
nsCOMPtr<nsIHttpChannelInternal> internalChannel = do_QueryInterface(httpChan);
if (internalChannel) {
// Bug 1168676. object/embed tags are not allowed to be intercepted by
// ServiceWorkers.
internalChannel->ForceNoIntercept();
}
// AsyncOpen can fail if a file does not exist.
rv = chan->AsyncOpen(shim, nullptr);
NS_ENSURE_SUCCESS(rv, rv);

Просмотреть файл

@ -11,6 +11,10 @@
ok(a === b, msg + ", expected '" + b + "', got '" + a + "'");
}
function todo(v, msg) {
window.parent.postMessage({status: "todo", result: !!v, message: msg}, "*");
}
function finish() {
window.parent.postMessage({status: "done"}, "*");
}
@ -114,6 +118,10 @@
}
function testEmbed() {
return Promise.resolve().then(function() {
todo(false, "<embed> tag is not currently intercepted. See Bug 1168676.");
});
return new Promise(function(resolve, reject) {
var embed = document.createElement("embed");
embed.src = "embed";
@ -130,6 +138,10 @@
}
function testObject() {
return Promise.resolve().then(function() {
todo(false, "<object> tag is not currently intercepted. See Bug 1168676");
});
return new Promise(function(resolve, reject) {
var object = document.createElement("object");
object.data = "object";
@ -223,11 +235,16 @@
}
function testPlugin() {
return Promise.resolve().then(function() {
todo(false, "plugins are not currently intercepted. See Bug 1168676.");
});
var isMobile = /Mobile|Tablet/.test(navigator.userAgent);
if (isMobile || parent.isMulet()) {
// We can't use plugins on mobile, so skip this part of the test there.
return Promise.resolve();
}
return new Promise(function(resolve, reject) {
var embed = document.createElement("embed");
embed.type = "application/x-test";

Просмотреть файл

@ -64,6 +64,8 @@
window.onmessage = function(e) {
if (e.data.status == "ok") {
ok(e.data.result, e.data.message);
} else if (e.data.status == "todo") {
todo(e.data.result, e.data.message);
} else if (e.data.status == "registrationdone") {
iframe.src = "/tests/dom/workers/test/serviceworkers/fetch/context/index.html";
} else if (e.data.status == "done") {