зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1508992 - Enable ESLint for dom/plugins/test/mochitest (Automatic changes). r=Standard8,qdot
Differential Revision: https://phabricator.services.mozilla.com/D20093 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
56c430aac5
Коммит
1bb1750150
|
@ -1,7 +1,7 @@
|
|||
var gTestRoot = getRootDirectory(gTestPath).replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
|
||||
|
||||
// simple tab load helper, pilfered from browser plugin tests
|
||||
function promiseTabLoad(tab, url, eventType="load") {
|
||||
function promiseTabLoad(tab, url, eventType = "load") {
|
||||
return new Promise((resolve) => {
|
||||
function handle(event) {
|
||||
if (event.originalTarget != tab.linkedBrowser.contentDocument ||
|
||||
|
@ -32,7 +32,7 @@ function promiseWaitForEvent(object, eventName, capturing = false, chrome = fals
|
|||
}
|
||||
|
||||
add_task(async function() {
|
||||
registerCleanupFunction(function () {
|
||||
registerCleanupFunction(function() {
|
||||
window.focus();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -10,7 +10,7 @@ function coordinatesRelativeToWindow(aX, aY, aElement) {
|
|||
var rect = aElement.getBoundingClientRect();
|
||||
return {
|
||||
x: targetWindow.mozInnerScreenX + ((rect.left + aX) * scale),
|
||||
y: targetWindow.mozInnerScreenY + ((rect.top + aY) * scale)
|
||||
y: targetWindow.mozInnerScreenY + ((rect.top + aY) * scale),
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@ var pluginHideEnabled = Preferences.get("gfx.e10s.hide-plugins-for-scroll", true
|
|||
|
||||
|
||||
add_task(async function() {
|
||||
registerCleanupFunction(function () {
|
||||
registerCleanupFunction(function() {
|
||||
setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY, "Test Plug-in");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -16,11 +16,11 @@
|
|||
|
||||
function synthesizeNativeMouseEvent(aX, aY, aNativeMsg, aModifiers, aElement, aCallback) {
|
||||
var observer = {
|
||||
observe: function(aSubject, aTopic, aData) {
|
||||
if (aCallback && aTopic == "mouseevent") {
|
||||
aCallback(aData);
|
||||
}
|
||||
}
|
||||
observe(aSubject, aTopic, aData) {
|
||||
if (aCallback && aTopic == "mouseevent") {
|
||||
aCallback(aData);
|
||||
}
|
||||
},
|
||||
};
|
||||
SpecialPowers.DOMWindowUtils.sendNativeMouseEvent(aX, aY, aNativeMsg, aModifiers, aElement, observer);
|
||||
return true;
|
||||
|
|
|
@ -120,7 +120,7 @@ DialogWatcher.prototype.getWindowText = function(hwnd) {
|
|||
|
||||
DialogWatcher.prototype.processWindowEvents = function(timeout) {
|
||||
var onWinEvent = function(self, hook, event, hwnd, idObject, idChild, dwEventThread, dwmsEventTime) {
|
||||
var nhwnd = Number(hwnd)
|
||||
var nhwnd = Number(hwnd);
|
||||
if (event == EVENT_OBJECT_SHOW) {
|
||||
if (nhwnd == self.hwnd) {
|
||||
// We've already picked up this event via FindWindow
|
||||
|
|
|
@ -15,7 +15,7 @@ function getTestPlugin(pluginName) {
|
|||
return null;
|
||||
}
|
||||
|
||||
addMessageListener('check-plugin-unload', function(message) {
|
||||
addMessageListener("check-plugin-unload", function(message) {
|
||||
var tag = getTestPlugin();
|
||||
var results = sendAsyncMessage("check-plugin-unload", tag.loaded);
|
||||
});
|
||||
|
|
|
@ -7,11 +7,11 @@ var observerFired = false;
|
|||
var testObserver = {
|
||||
idleHang: true,
|
||||
|
||||
observe: function(subject, topic, data) {
|
||||
observe(subject, topic, data) {
|
||||
observerFired = true;
|
||||
ok(true, "Observer fired");
|
||||
is(topic, "plugin-crashed", "Checking correct topic");
|
||||
is(data, null, "Checking null data");
|
||||
is(data, null, "Checking null data");
|
||||
ok((subject instanceof Ci.nsIPropertyBag2), "got Propbag");
|
||||
ok((subject instanceof Ci.nsIWritablePropertyBag2), "got writable Propbag");
|
||||
|
||||
|
@ -36,19 +36,19 @@ var testObserver = {
|
|||
// check additional dumps
|
||||
|
||||
ok("additional_minidumps" in extraData, "got field for additional minidumps");
|
||||
let additionalDumps = extraData.additional_minidumps.split(',');
|
||||
ok(additionalDumps.includes('browser'), "browser in additional_minidumps");
|
||||
let additionalDumps = extraData.additional_minidumps.split(",");
|
||||
ok(additionalDumps.includes("browser"), "browser in additional_minidumps");
|
||||
|
||||
for (let name of additionalDumps) {
|
||||
let file = profD.clone();
|
||||
file.append(pluginId + "-" + name + ".dmp");
|
||||
ok(file.exists(), "additional dump '"+name+"' exists");
|
||||
ok(file.exists(), "additional dump '" + name + "' exists");
|
||||
}
|
||||
|
||||
// check cpu usage field
|
||||
|
||||
ok("PluginCpuUsage" in extraData, "got extra field for plugin cpu usage");
|
||||
let cpuUsage = parseFloat(extraData["PluginCpuUsage"]);
|
||||
let cpuUsage = parseFloat(extraData.PluginCpuUsage);
|
||||
if (this.idleHang) {
|
||||
ok(cpuUsage == 0, "plugin cpu usage is 0%");
|
||||
} else {
|
||||
|
@ -56,13 +56,7 @@ var testObserver = {
|
|||
}
|
||||
},
|
||||
|
||||
QueryInterface: function(iid) {
|
||||
if (iid.equals(Ci.nsIObserver) ||
|
||||
iid.equals(Ci.nsISupportsWeakReference) ||
|
||||
iid.equals(Ci.nsISupports))
|
||||
return this;
|
||||
throw Cr.NS_NOINTERFACE;
|
||||
}
|
||||
QueryInterface: ChromeUtils.generateQI(["nsIObserver", "nsISupportsWeakReference"]),
|
||||
};
|
||||
|
||||
|
||||
|
@ -72,7 +66,7 @@ function onPluginCrashed(aEvent) {
|
|||
is(aEvent.type, "PluginCrashed", "event is correct type");
|
||||
|
||||
var pluginElement = document.getElementById("plugin1");
|
||||
is (pluginElement, aEvent.target, "Plugin crashed event target is plugin element");
|
||||
is(pluginElement, aEvent.target, "Plugin crashed event target is plugin element");
|
||||
|
||||
ok(aEvent instanceof PluginCrashedEvent,
|
||||
"plugin crashed event has the right interface");
|
||||
|
|
|
@ -112,7 +112,7 @@ self.onmessage = function(event) {
|
|||
postSuccess(params);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
self.onerror = function(event) {
|
||||
var msg = "Error: " + event.message + " at " + event.filename + ":" + event.lineno;
|
||||
|
|
|
@ -84,7 +84,7 @@ function waitScrollFinish(aTarget) {
|
|||
recent = true;
|
||||
}
|
||||
aTarget.addEventListener("scroll", listener, true);
|
||||
setInterval(function () {
|
||||
setInterval(function() {
|
||||
// one second passed and we didn't receive a scroll event.
|
||||
if (!recent) {
|
||||
aTarget.removeEventListener("scroll", listener, true);
|
||||
|
|
|
@ -1,123 +1,118 @@
|
|||
function paintCountIs(plugin, expected, msg) {
|
||||
var count = plugin.getPaintCount();
|
||||
var realExpected = expected;
|
||||
++realExpected; // extra paint at startup for all async-rendering plugins
|
||||
ok(realExpected == count, msg + " (expected " + expected +
|
||||
" independent paints, expected " + realExpected + " logged paints, got " +
|
||||
count + " actual paints)");
|
||||
}
|
||||
|
||||
function getTestPlugin(pluginName) {
|
||||
var ph = SpecialPowers.Cc["@mozilla.org/plugin/host;1"]
|
||||
.getService(SpecialPowers.Ci.nsIPluginHost);
|
||||
var tags = ph.getPluginTags();
|
||||
var name = pluginName || "Test Plug-in";
|
||||
for (var tag of tags) {
|
||||
if (tag.name == name) {
|
||||
return tag;
|
||||
}
|
||||
}
|
||||
|
||||
ok(false, "Could not find plugin tag with plugin name '" + name + "'");
|
||||
return null;
|
||||
}
|
||||
|
||||
// call this to set the test plugin(s) initially expected enabled state.
|
||||
// it will automatically be reset to it's previous value after the test
|
||||
// ends
|
||||
function setTestPluginEnabledState(newEnabledState, pluginName) {
|
||||
var oldEnabledState = SpecialPowers.setTestPluginEnabledState(newEnabledState, pluginName);
|
||||
var plugin = getTestPlugin(pluginName);
|
||||
// Run a nested event loop to wait for the preference change to
|
||||
// propagate to the child. Yuck!
|
||||
SpecialPowers.Services.tm.spinEventLoopUntil(() => {
|
||||
return plugin.enabledState == newEnabledState;
|
||||
});
|
||||
SimpleTest.registerCleanupFunction(function() {
|
||||
SpecialPowers.setTestPluginEnabledState(oldEnabledState, pluginName);
|
||||
});
|
||||
}
|
||||
|
||||
function crashAndGetCrashServiceRecord(crashMethodName, callback) {
|
||||
var crashMan =
|
||||
SpecialPowers.Cu.import("resource://gre/modules/Services.jsm").
|
||||
Services.crashmanager;
|
||||
|
||||
// First, clear the crash record store.
|
||||
info("Waiting for pruneOldCrashes");
|
||||
var future = new Date(Date.now() + 1000 * 60 * 60 * 24);
|
||||
crashMan.pruneOldCrashes(future).then(function () {
|
||||
|
||||
var iframe = document.getElementById("iframe1");
|
||||
var p = iframe.contentDocument.getElementById("plugin1");
|
||||
|
||||
var crashDateMS = Date.now();
|
||||
try {
|
||||
p[crashMethodName]();
|
||||
ok(false, "p." + crashMethodName + "() should throw an exception");
|
||||
}
|
||||
catch (e) {
|
||||
ok(true, "p." + crashMethodName + "() should throw an exception");
|
||||
}
|
||||
|
||||
// The crash record store is written and read back asyncly, so poll for
|
||||
// the new record.
|
||||
function tryGetCrash() {
|
||||
info("Waiting for getCrashes");
|
||||
crashMan.getCrashes().then(SpecialPowers.wrapCallback(function (crashes) {
|
||||
if (crashes.length) {
|
||||
is(crashes.length, 1, "There should be only one record");
|
||||
var crash = SpecialPowers.wrap(crashes[0]);
|
||||
ok(!!crash.id, "Record should have an ID");
|
||||
ok(!!crash.crashDate, "Record should have a crash date");
|
||||
var dateMS = crash.crashDate.valueOf();
|
||||
var twoMin = 1000 * 60 * 2;
|
||||
ok(crashDateMS - twoMin <= dateMS &&
|
||||
dateMS <= crashDateMS + twoMin,
|
||||
"Record's crash date should be nowish: " +
|
||||
"now=" + crashDateMS + " recordDate=" + dateMS);
|
||||
callback(crashMan, crash);
|
||||
}
|
||||
else {
|
||||
setTimeout(tryGetCrash, 1000);
|
||||
}
|
||||
}), function (err) {
|
||||
ok(false, "Error getting crashes: " + err);
|
||||
SimpleTest.finish();
|
||||
});
|
||||
}
|
||||
setTimeout(tryGetCrash, 1000);
|
||||
|
||||
}, function () {
|
||||
ok(false, "pruneOldCrashes error");
|
||||
SimpleTest.finish();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a promise which resolves on `mozFullScreenChange`.
|
||||
*/
|
||||
function promiseFullScreenChange(){
|
||||
return new Promise(resolve => {
|
||||
document.addEventListener("fullscreenchange", function(e) {
|
||||
resolve();
|
||||
}, {once: true});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Crashes target plugin. Returns a promise; resolves on successful crash,
|
||||
* rejects otherwise.
|
||||
* @param plugin Target plugin to attempt to crash.
|
||||
*/
|
||||
function crashPlugin(plugin) {
|
||||
return new Promise( (resolve, reject) => {
|
||||
try {
|
||||
plugin.crash();
|
||||
reject();
|
||||
}
|
||||
catch (e) {
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
}
|
||||
function paintCountIs(plugin, expected, msg) {
|
||||
var count = plugin.getPaintCount();
|
||||
var realExpected = expected;
|
||||
++realExpected; // extra paint at startup for all async-rendering plugins
|
||||
ok(realExpected == count, msg + " (expected " + expected +
|
||||
" independent paints, expected " + realExpected + " logged paints, got " +
|
||||
count + " actual paints)");
|
||||
}
|
||||
|
||||
function getTestPlugin(pluginName) {
|
||||
var ph = SpecialPowers.Cc["@mozilla.org/plugin/host;1"]
|
||||
.getService(SpecialPowers.Ci.nsIPluginHost);
|
||||
var tags = ph.getPluginTags();
|
||||
var name = pluginName || "Test Plug-in";
|
||||
for (var tag of tags) {
|
||||
if (tag.name == name) {
|
||||
return tag;
|
||||
}
|
||||
}
|
||||
|
||||
ok(false, "Could not find plugin tag with plugin name '" + name + "'");
|
||||
return null;
|
||||
}
|
||||
|
||||
// call this to set the test plugin(s) initially expected enabled state.
|
||||
// it will automatically be reset to it's previous value after the test
|
||||
// ends
|
||||
function setTestPluginEnabledState(newEnabledState, pluginName) {
|
||||
var oldEnabledState = SpecialPowers.setTestPluginEnabledState(newEnabledState, pluginName);
|
||||
var plugin = getTestPlugin(pluginName);
|
||||
// Run a nested event loop to wait for the preference change to
|
||||
// propagate to the child. Yuck!
|
||||
SpecialPowers.Services.tm.spinEventLoopUntil(() => {
|
||||
return plugin.enabledState == newEnabledState;
|
||||
});
|
||||
SimpleTest.registerCleanupFunction(function() {
|
||||
SpecialPowers.setTestPluginEnabledState(oldEnabledState, pluginName);
|
||||
});
|
||||
}
|
||||
|
||||
function crashAndGetCrashServiceRecord(crashMethodName, callback) {
|
||||
var crashMan =
|
||||
SpecialPowers.Cu.import("resource://gre/modules/Services.jsm").
|
||||
Services.crashmanager;
|
||||
|
||||
// First, clear the crash record store.
|
||||
info("Waiting for pruneOldCrashes");
|
||||
var future = new Date(Date.now() + 1000 * 60 * 60 * 24);
|
||||
crashMan.pruneOldCrashes(future).then(function() {
|
||||
var iframe = document.getElementById("iframe1");
|
||||
var p = iframe.contentDocument.getElementById("plugin1");
|
||||
|
||||
var crashDateMS = Date.now();
|
||||
try {
|
||||
p[crashMethodName]();
|
||||
ok(false, "p." + crashMethodName + "() should throw an exception");
|
||||
} catch (e) {
|
||||
ok(true, "p." + crashMethodName + "() should throw an exception");
|
||||
}
|
||||
|
||||
// The crash record store is written and read back asyncly, so poll for
|
||||
// the new record.
|
||||
function tryGetCrash() {
|
||||
info("Waiting for getCrashes");
|
||||
crashMan.getCrashes().then(SpecialPowers.wrapCallback(function(crashes) {
|
||||
if (crashes.length) {
|
||||
is(crashes.length, 1, "There should be only one record");
|
||||
var crash = SpecialPowers.wrap(crashes[0]);
|
||||
ok(!!crash.id, "Record should have an ID");
|
||||
ok(!!crash.crashDate, "Record should have a crash date");
|
||||
var dateMS = crash.crashDate.valueOf();
|
||||
var twoMin = 1000 * 60 * 2;
|
||||
ok(crashDateMS - twoMin <= dateMS &&
|
||||
dateMS <= crashDateMS + twoMin,
|
||||
"Record's crash date should be nowish: " +
|
||||
"now=" + crashDateMS + " recordDate=" + dateMS);
|
||||
callback(crashMan, crash);
|
||||
} else {
|
||||
setTimeout(tryGetCrash, 1000);
|
||||
}
|
||||
}), function(err) {
|
||||
ok(false, "Error getting crashes: " + err);
|
||||
SimpleTest.finish();
|
||||
});
|
||||
}
|
||||
setTimeout(tryGetCrash, 1000);
|
||||
}, function() {
|
||||
ok(false, "pruneOldCrashes error");
|
||||
SimpleTest.finish();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a promise which resolves on `mozFullScreenChange`.
|
||||
*/
|
||||
function promiseFullScreenChange() {
|
||||
return new Promise(resolve => {
|
||||
document.addEventListener("fullscreenchange", function(e) {
|
||||
resolve();
|
||||
}, {once: true});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Crashes target plugin. Returns a promise; resolves on successful crash,
|
||||
* rejects otherwise.
|
||||
* @param plugin Target plugin to attempt to crash.
|
||||
*/
|
||||
function crashPlugin(plugin) {
|
||||
return new Promise( (resolve, reject) => {
|
||||
try {
|
||||
plugin.crash();
|
||||
reject();
|
||||
} catch (e) {
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function frameLoaded(finishWhenCalled = true, lastObject = false) {
|
||||
var testframe = document.getElementById('testframe');
|
||||
var testframe = document.getElementById("testframe");
|
||||
function getNode(list) {
|
||||
if (list.length === 0)
|
||||
return undefined;
|
||||
return lastObject ? list[list.length - 1] : list[0];
|
||||
}
|
||||
var embed = getNode(document.getElementsByTagName('embed'));
|
||||
var embed = getNode(document.getElementsByTagName("embed"));
|
||||
if (undefined === embed)
|
||||
embed = getNode(document.getElementsByTagName('object'));
|
||||
embed = getNode(document.getElementsByTagName("object"));
|
||||
|
||||
// In the file:// URI case, this ends up being cross-origin.
|
||||
// Skip these checks in that case.
|
||||
|
@ -24,8 +24,8 @@
|
|||
embed.getAttribute("data");
|
||||
|
||||
var req = new XMLHttpRequest();
|
||||
req.open('GET', filename, false);
|
||||
req.overrideMimeType('text/plain; charset=x-user-defined');
|
||||
req.open("GET", filename, false);
|
||||
req.overrideMimeType("text/plain; charset=x-user-defined");
|
||||
req.send(null);
|
||||
is(req.status, 200, "bad XMLHttpRequest status");
|
||||
is(content, req.responseText.replace(/\r\n/g, "\n"),
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
window.frameLoaded = function frameLoaded_toCrash() {
|
||||
SimpleTest.expectChildProcessCrash();
|
||||
|
||||
crashAndGetCrashServiceRecord("crash", function (cm, crash) {
|
||||
crashAndGetCrashServiceRecord("crash", function(cm, crash) {
|
||||
var isPluginCrash = crash.isOfType(cm.PROCESS_TYPE_PLUGIN, cm.CRASH_TYPE_CRASH);
|
||||
ok(isPluginCrash, "Record should be a plugin crash");
|
||||
if (!isPluginCrash) {
|
||||
|
@ -22,7 +22,6 @@
|
|||
}
|
||||
SimpleTest.finish();
|
||||
});
|
||||
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<iframe id="iframe1" src="crashing_subpage.html" width="600" height="600"></iframe>
|
||||
|
|
|
@ -18,11 +18,11 @@
|
|||
var timeoutPref = "dom.ipc.plugins.timeoutSecs";
|
||||
SpecialPowers.setIntPref(timeoutPref, 5);
|
||||
|
||||
crashAndGetCrashServiceRecord("hang", function (cm, crash) {
|
||||
crashAndGetCrashServiceRecord("hang", function(cm, crash) {
|
||||
ok(crash.isOfType(cm.PROCESS_TYPE_PLUGIN, cm.CRASH_TYPE_HANG),
|
||||
"Record should be a plugin hang");
|
||||
SimpleTest.finish();
|
||||
});
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<iframe id="iframe1" src="crashing_subpage.html" width="600" height="600"></iframe>
|
||||
|
|
|
@ -22,10 +22,9 @@
|
|||
// just verify that we throw. There's no reason why getNPNVdocumentOrigin _would_
|
||||
// be confused in this case anyway.
|
||||
try {
|
||||
window.location.toString = function() { return 'http://victim.rckc.at/'; }
|
||||
window.location.toString = function() { return "http://victim.rckc.at/"; };
|
||||
ok(false, "Should throw when shadowing window.location.toString");
|
||||
}
|
||||
catch (e) {
|
||||
} catch (e) {
|
||||
ok(true, "Should throw when shadowing window.location.toString");
|
||||
}
|
||||
|
||||
|
|
|
@ -54,10 +54,10 @@
|
|||
});
|
||||
|
||||
add_task(async function() {
|
||||
let fullScreenElement = document.getElementById('div1');
|
||||
let plugin = document.getElementById('iframe1')
|
||||
.contentDocument.getElementById('iframe2')
|
||||
.contentDocument.getElementById('plugin1');
|
||||
let fullScreenElement = document.getElementById("div1");
|
||||
let plugin = document.getElementById("iframe1")
|
||||
.contentDocument.getElementById("iframe2")
|
||||
.contentDocument.getElementById("plugin1");
|
||||
|
||||
let fullScreenChange = promiseFullScreenChange();
|
||||
fullScreenElement.mozRequestFullScreen();
|
||||
|
@ -85,7 +85,7 @@
|
|||
document.removeEventListener("fullscreenchange", onFullScreenChange);
|
||||
clearTimeout(timeoutId);
|
||||
resolve();
|
||||
}
|
||||
};
|
||||
document.addEventListener("fullscreenchange", onFullScreenChange);
|
||||
timeoutId = setTimeout(() => {
|
||||
document.removeEventListener("fullscreenchange", onFullScreenChange);
|
||||
|
@ -99,7 +99,7 @@
|
|||
ok(false, "Element is no longer fullscreen");
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<div id="div1">
|
||||
|
|
|
@ -54,8 +54,8 @@
|
|||
});
|
||||
|
||||
add_task(async function() {
|
||||
let fullScreenElement = document.getElementById('div1');
|
||||
let plugin = document.getElementById('plugin1');
|
||||
let fullScreenElement = document.getElementById("div1");
|
||||
let plugin = document.getElementById("plugin1");
|
||||
|
||||
let fullScreenChange = promiseFullScreenChange();
|
||||
fullScreenElement.mozRequestFullScreen();
|
||||
|
@ -84,7 +84,7 @@
|
|||
document.removeEventListener("fullscreenchange", onFullScreenChange);
|
||||
clearTimeout(timeoutId);
|
||||
reject();
|
||||
}
|
||||
};
|
||||
document.addEventListener("fullscreenchange", onFullScreenChange);
|
||||
timeoutId = setTimeout(() => {
|
||||
document.removeEventListener("fullscreenchange", onFullScreenChange);
|
||||
|
@ -98,7 +98,7 @@
|
|||
ok(false, "Element is still fullscreen");
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<div id="div1"></div>
|
||||
|
|
|
@ -54,10 +54,10 @@
|
|||
});
|
||||
|
||||
add_task(async function() {
|
||||
let fullScreenElement = document.getElementById('iframe1');
|
||||
let plugin = document.getElementById('iframe1')
|
||||
.contentDocument.getElementById('iframe2')
|
||||
.contentDocument.getElementById('plugin1');
|
||||
let fullScreenElement = document.getElementById("iframe1");
|
||||
let plugin = document.getElementById("iframe1")
|
||||
.contentDocument.getElementById("iframe2")
|
||||
.contentDocument.getElementById("plugin1");
|
||||
|
||||
let fullScreenChange = promiseFullScreenChange();
|
||||
fullScreenElement.mozRequestFullScreen();
|
||||
|
@ -85,7 +85,7 @@
|
|||
document.removeEventListener("fullscreenchange", onFullScreenChange);
|
||||
clearTimeout(timeoutId);
|
||||
resolve();
|
||||
}
|
||||
};
|
||||
document.addEventListener("fullscreenchange", onFullScreenChange);
|
||||
timeoutId = setTimeout(() => {
|
||||
document.removeEventListener("fullscreenchange", onFullScreenChange);
|
||||
|
@ -99,7 +99,7 @@
|
|||
ok(false, "Element is no longer fullscreen");
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<iframe id="iframe1" src="1028200-subpageB.html" height="600" width="600"></iframe>
|
||||
|
|
|
@ -54,10 +54,10 @@
|
|||
});
|
||||
|
||||
add_task(async function() {
|
||||
let fullScreenElement = document.getElementById('iframe1');
|
||||
let plugin = document.getElementById('iframe1')
|
||||
.contentDocument.getElementById('iframe2')
|
||||
.contentDocument.getElementById('plugin1');
|
||||
let fullScreenElement = document.getElementById("iframe1");
|
||||
let plugin = document.getElementById("iframe1")
|
||||
.contentDocument.getElementById("iframe2")
|
||||
.contentDocument.getElementById("plugin1");
|
||||
|
||||
let fullScreenChange = promiseFullScreenChange();
|
||||
fullScreenElement.mozRequestFullScreen();
|
||||
|
@ -85,7 +85,7 @@
|
|||
document.removeEventListener("fullscreenchange", onFullScreenChange);
|
||||
clearTimeout(timeoutId);
|
||||
resolve();
|
||||
}
|
||||
};
|
||||
document.addEventListener("fullscreenchange", onFullScreenChange);
|
||||
timeoutId = setTimeout(() => {
|
||||
document.removeEventListener("fullscreenchange", onFullScreenChange);
|
||||
|
@ -99,7 +99,7 @@
|
|||
ok(false, "Element is no longer fullscreen");
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<iframe id="iframe1" src="1028200-subpageB.html" height="600" width="600"></iframe>
|
||||
|
|
|
@ -54,8 +54,8 @@
|
|||
});
|
||||
|
||||
add_task(async function() {
|
||||
let fullScreenElement = document.getElementById('div1');
|
||||
let plugin = document.getElementById('plugin1');
|
||||
let fullScreenElement = document.getElementById("div1");
|
||||
let plugin = document.getElementById("plugin1");
|
||||
|
||||
let fullScreenChange = promiseFullScreenChange();
|
||||
fullScreenElement.mozRequestFullScreen();
|
||||
|
@ -83,7 +83,7 @@
|
|||
document.removeEventListener("fullscreenchange", onFullScreenChange);
|
||||
clearTimeout(timeoutId);
|
||||
resolve();
|
||||
}
|
||||
};
|
||||
document.addEventListener("fullscreenchange", onFullScreenChange);
|
||||
timeoutId = setTimeout(() => {
|
||||
document.removeEventListener("fullscreenchange", onFullScreenChange);
|
||||
|
@ -97,7 +97,7 @@
|
|||
ok(false, "Element is no longer fullscreen");
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<div id="div1">
|
||||
|
|
|
@ -54,8 +54,8 @@
|
|||
});
|
||||
|
||||
add_task(async function() {
|
||||
let fullScreenElement = document.getElementById('iframe1');
|
||||
let plugin = document.getElementById('plugin1');
|
||||
let fullScreenElement = document.getElementById("iframe1");
|
||||
let plugin = document.getElementById("plugin1");
|
||||
|
||||
let fullScreenChange = promiseFullScreenChange();
|
||||
fullScreenElement.mozRequestFullScreen();
|
||||
|
@ -84,7 +84,7 @@
|
|||
document.removeEventListener("fullscreenchange", onFullScreenChange);
|
||||
clearTimeout(timeoutId);
|
||||
reject();
|
||||
}
|
||||
};
|
||||
document.addEventListener("fullscreenchange", onFullScreenChange);
|
||||
timeoutId = setTimeout(() => {
|
||||
document.removeEventListener("fullscreenchange", onFullScreenChange);
|
||||
|
@ -98,7 +98,7 @@
|
|||
ok(false, "Element is still fullscreen");
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<iframe id="iframe1"></iframe>
|
||||
|
|
|
@ -54,10 +54,10 @@
|
|||
});
|
||||
|
||||
add_task(async function() {
|
||||
let fullScreenElement = document.getElementById('iframeA')
|
||||
let plugin = document.getElementById('iframe1')
|
||||
.contentDocument.getElementById('iframe2')
|
||||
.contentDocument.getElementById('plugin1');
|
||||
let fullScreenElement = document.getElementById("iframeA");
|
||||
let plugin = document.getElementById("iframe1")
|
||||
.contentDocument.getElementById("iframe2")
|
||||
.contentDocument.getElementById("plugin1");
|
||||
|
||||
let fullScreenChange = promiseFullScreenChange();
|
||||
fullScreenElement.mozRequestFullScreen();
|
||||
|
@ -86,7 +86,7 @@
|
|||
document.removeEventListener("fullscreenchange", onFullScreenChange);
|
||||
clearTimeout(timeoutId);
|
||||
reject();
|
||||
}
|
||||
};
|
||||
document.addEventListener("fullscreenchange", onFullScreenChange);
|
||||
timeoutId = setTimeout(() => {
|
||||
document.removeEventListener("fullscreenchange", onFullScreenChange);
|
||||
|
@ -100,8 +100,7 @@
|
|||
ok(false, "Element is still fullscreen");
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<iframe id="iframeA" src="1028200-subpageC.html" allowfullscreen="true"></iframe>
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
var p = null;
|
||||
|
||||
function startTest() {
|
||||
p = document.getElementById('theplugin');
|
||||
p = document.getElementById("theplugin");
|
||||
if (!p.hasWidget()) {
|
||||
todo(false, "This test is only relevant for windowed plugins");
|
||||
SimpleTest.finish();
|
||||
|
@ -35,8 +35,8 @@
|
|||
function doTest() {
|
||||
is(p.getClipRegionRectCount(), 1, "getClipRegionRectCount should be a single rect");
|
||||
var dpr = window.devicePixelRatio;
|
||||
is(p.getClipRegionRectEdge(0,2) - p.getClipRegionRectEdge(0,0), 100 * dpr, "width of clip region rect");
|
||||
is(p.getClipRegionRectEdge(0,3) - p.getClipRegionRectEdge(0,1), 26 * dpr, "height of clip region rect");
|
||||
is(p.getClipRegionRectEdge(0, 2) - p.getClipRegionRectEdge(0, 0), 100 * dpr, "width of clip region rect");
|
||||
is(p.getClipRegionRectEdge(0, 3) - p.getClipRegionRectEdge(0, 1), 26 * dpr, "height of clip region rect");
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
SimpleTest.waitForExplicitFinish();
|
||||
setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
|
||||
SpecialPowers.pushPrefEnv({ "set": [
|
||||
['dom.ipc.plugins.unloadTimeoutSecs', 0]
|
||||
["dom.ipc.plugins.unloadTimeoutSecs", 0],
|
||||
] });
|
||||
|
||||
function startTest() {
|
||||
|
|
|
@ -12,11 +12,11 @@
|
|||
SpecialPowers.setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
|
||||
|
||||
function addPluginElement() {
|
||||
var p = document.createElement('embed');
|
||||
p.setAttribute('id', 'plugin2');
|
||||
p.setAttribute('type', 'application/x-shockwave-flash-test');
|
||||
p.setAttribute('scale', 'noscale');
|
||||
p.setAttribute('salign', 'lt');
|
||||
var p = document.createElement("embed");
|
||||
p.setAttribute("id", "plugin2");
|
||||
p.setAttribute("type", "application/x-shockwave-flash-test");
|
||||
p.setAttribute("scale", "noscale");
|
||||
p.setAttribute("salign", "lt");
|
||||
document.body.appendChild(p);
|
||||
SimpleTest.executeSoon(function() {
|
||||
runTests();
|
||||
|
@ -24,9 +24,9 @@
|
|||
}
|
||||
|
||||
function runTests() {
|
||||
p = document.getElementById('plugin1');
|
||||
p = document.getElementById("plugin1");
|
||||
ok(p.setColor != undefined, "Static plugin parameter (salign/scale) ordering were correct");
|
||||
p2 = document.getElementById('plugin2');
|
||||
p2 = document.getElementById("plugin2");
|
||||
ok(p2.setColor != undefined, "Dynamic plugin parameter (salign/scale) ordering were correct");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
|
|
@ -15,10 +15,9 @@ setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
|
|||
|
||||
function runTests() {
|
||||
try {
|
||||
document.getElementById('plugin1').getPaintCount();
|
||||
document.getElementById("plugin1").getPaintCount();
|
||||
ok(true, "Data delivery didn't crash");
|
||||
}
|
||||
catch (e) {
|
||||
} catch (e) {
|
||||
ok(false, "Data delivery crashed");
|
||||
}
|
||||
SimpleTest.finish();
|
||||
|
|
|
@ -21,36 +21,36 @@ function runTests() {
|
|||
function waitForPaintCountIncrement() {
|
||||
waitedForPaint++;
|
||||
moveBy = -moveBy;
|
||||
$("abs").style.left = ($("abs").offsetLeft + moveBy) + 'px';
|
||||
$("abs").style.left = ($("abs").offsetLeft + moveBy) + "px";
|
||||
var x = document.documentElement.offsetHeight;
|
||||
var pc = testplugin.getPaintCount ? testplugin.getPaintCount() : -2;
|
||||
if (waitedForPaint == 20 || (pc != testplugin.last_paint_count && pc >= 0)) {
|
||||
setTimeout(func,0);
|
||||
setTimeout(func, 0);
|
||||
} else
|
||||
setTimeout(waitForPaintCountIncrement, 50);
|
||||
}
|
||||
waitForPaintCountIncrement();
|
||||
}
|
||||
|
||||
function doClick(x,y,func) {
|
||||
function doClick(x, y, func) {
|
||||
synthesizeMouse($("plugin1"), x, y, {}, window);
|
||||
setTimeout(func,0);
|
||||
setTimeout(func, 0);
|
||||
}
|
||||
|
||||
function verify(test,x,y,next) {
|
||||
function verify(test, x, y, next) {
|
||||
var p = $("plugin1").getLastMouseX();
|
||||
const delta = 2;
|
||||
var dpr = window.devicePixelRatio / SpecialPowers.getFullZoom(window);
|
||||
ok(p-delta <= x * dpr && x * dpr <= p+delta, "test"+test+" LastMouseX got " + p + " expected " + x +
|
||||
" with fullZoom="+SpecialPowers.getFullZoom(window)+" MozTransform='"+$("container").style.MozTransform+"'");
|
||||
ok(p - delta <= x * dpr && x * dpr <= p + delta, "test" + test + " LastMouseX got " + p + " expected " + x +
|
||||
" with fullZoom=" + SpecialPowers.getFullZoom(window) + " MozTransform='" + $("container").style.MozTransform + "'");
|
||||
p = $("plugin1").getLastMouseY();
|
||||
ok(p-delta <= y * dpr && y * dpr <= p+delta, "test"+test+" LastMouseY got " + p + " expected " + y +
|
||||
" with fullZoom="+SpecialPowers.getFullZoom(window)+" MozTransform='"+$("container").style.MozTransform+"'");
|
||||
ok(p - delta <= y * dpr && y * dpr <= p + delta, "test" + test + " LastMouseY got " + p + " expected " + y +
|
||||
" with fullZoom=" + SpecialPowers.getFullZoom(window) + " MozTransform='" + $("container").style.MozTransform + "'");
|
||||
if (next) next();
|
||||
}
|
||||
|
||||
function click(x,y,next) {
|
||||
waitForPaint(function(){doClick(x,y,next);})
|
||||
function click(x, y, next) {
|
||||
waitForPaint(function() { doClick(x, y, next); });
|
||||
}
|
||||
function zoom(factor) {
|
||||
SpecialPowers.setFullZoom(window, factor);
|
||||
|
@ -58,14 +58,14 @@ function runTests() {
|
|||
|
||||
function test1() { // fullZoom=1 (sanity check)
|
||||
zoom(1);
|
||||
click(55,136, function(){verify("1",55,136,test2)});
|
||||
click(55, 136, function() { verify("1", 55, 136, test2); });
|
||||
}
|
||||
function test2() { // fullZoom=2
|
||||
zoom(2);
|
||||
click(40,108, function(){verify("2",80,216,test2b)})
|
||||
click(40, 108, function() { verify("2", 80, 216, test2b); });
|
||||
}
|
||||
function test2b() {
|
||||
click(108,112, function(){verify("2c",216,224,endTest)})
|
||||
click(108, 112, function() { verify("2c", 216, 224, endTest); });
|
||||
}
|
||||
|
||||
function endTest() {
|
||||
|
@ -73,7 +73,7 @@ function runTests() {
|
|||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
setTimeout(function(){waitForPaint(test1)},1000);
|
||||
setTimeout(function() { waitForPaint(test1); }, 1000);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
|
|
@ -21,36 +21,36 @@ function runTests() {
|
|||
function waitForPaintCountIncrement() {
|
||||
waitedForPaint++;
|
||||
moveBy = -moveBy;
|
||||
$("abs").style.left = ($("abs").offsetLeft + moveBy) + 'px';
|
||||
$("abs").style.left = ($("abs").offsetLeft + moveBy) + "px";
|
||||
var x = document.documentElement.offsetHeight;
|
||||
var pc = testplugin.getPaintCount ? testplugin.getPaintCount() : -2;
|
||||
if (waitedForPaint == 20 || (pc != testplugin.last_paint_count && pc >= 0)) {
|
||||
setTimeout(func,0);
|
||||
setTimeout(func, 0);
|
||||
} else
|
||||
setTimeout(waitForPaintCountIncrement, 50);
|
||||
}
|
||||
waitForPaintCountIncrement();
|
||||
}
|
||||
|
||||
function doClick(x,y,func) {
|
||||
synthesizeMouse($("plugin1"), x, y, {}, window);
|
||||
setTimeout(func,0);
|
||||
function doClick(x, y, func) {
|
||||
synthesizeMouse($("plugin1"), x, y, {}, window);
|
||||
setTimeout(func, 0);
|
||||
}
|
||||
|
||||
function verify(test,x,y,next) {
|
||||
function verify(test, x, y, next) {
|
||||
var p = $("plugin1").getLastMouseX();
|
||||
const delta = 2;
|
||||
var dpr = window.devicePixelRatio / SpecialPowers.getFullZoom(window);
|
||||
ok(p-delta <= x * dpr && x * dpr <= p+delta, "test"+test+" LastMouseX got " + p + " expected " + x +
|
||||
" with fullZoom="+SpecialPowers.getFullZoom(window)+" MozTransform='"+$("container").style.MozTransform+"'");
|
||||
ok(p - delta <= x * dpr && x * dpr <= p + delta, "test" + test + " LastMouseX got " + p + " expected " + x +
|
||||
" with fullZoom=" + SpecialPowers.getFullZoom(window) + " MozTransform='" + $("container").style.MozTransform + "'");
|
||||
p = $("plugin1").getLastMouseY();
|
||||
ok(p-delta <= y * dpr && y * dpr <= p+delta, "test"+test+" LastMouseY got " + p + " expected " + y +
|
||||
" with fullZoom="+SpecialPowers.getFullZoom(window)+" MozTransform='"+$("container").style.MozTransform+"'");
|
||||
ok(p - delta <= y * dpr && y * dpr <= p + delta, "test" + test + " LastMouseY got " + p + " expected " + y +
|
||||
" with fullZoom=" + SpecialPowers.getFullZoom(window) + " MozTransform='" + $("container").style.MozTransform + "'");
|
||||
if (next) next();
|
||||
}
|
||||
|
||||
function click(x,y,next) {
|
||||
waitForPaint(function(){doClick(x,y,next);})
|
||||
function click(x, y, next) {
|
||||
waitForPaint(function() { doClick(x, y, next); });
|
||||
}
|
||||
function zoom(factor) {
|
||||
SpecialPowers.setFullZoom(window, factor);
|
||||
|
@ -66,10 +66,10 @@ function runTests() {
|
|||
// Looks like the plugin instance got destroyed and we never recover from that...
|
||||
// ==============================================================================
|
||||
//
|
||||
click(50,136, function(){verify("3",25,68,test3b)});
|
||||
click(50, 136, function() { verify("3", 25, 68, test3b); });
|
||||
}
|
||||
function test3b() {
|
||||
click(208,212, function(){verify("3b",104,106,test4)});
|
||||
click(208, 212, function() { verify("3b", 104, 106, test4); });
|
||||
}
|
||||
function test4() { // fullZoom=2 + scale(0.5)
|
||||
zoom(2);
|
||||
|
@ -77,7 +77,7 @@ function runTests() {
|
|||
container.style.MozTransformOrigin = "0px 0px";
|
||||
container.style.MozTransform = "scale(0.5)";
|
||||
var x = document.documentElement.offsetHeight;
|
||||
click(60,52, function(){verify("4",240,208,test5)});
|
||||
click(60, 52, function() { verify("4", 240, 208, test5); });
|
||||
}
|
||||
function test5() { // fullZoom=2 + scale(2)
|
||||
zoom(2);
|
||||
|
@ -85,7 +85,7 @@ function runTests() {
|
|||
container.style.MozTransformOrigin = "0px 0px";
|
||||
container.style.MozTransform = "scale(2)";
|
||||
var x = document.documentElement.offsetHeight;
|
||||
click(108,112, function(){verify("5",108,112,endTest)});
|
||||
click(108, 112, function() { verify("5", 108, 112, endTest); });
|
||||
}
|
||||
|
||||
function endTest() {
|
||||
|
@ -93,7 +93,7 @@ function runTests() {
|
|||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
setTimeout(function(){waitForPaint(test3)},1000);
|
||||
setTimeout(function() { waitForPaint(test3); }, 1000);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
|
|
@ -22,15 +22,15 @@
|
|||
const utils = window.windowUtils;
|
||||
|
||||
function go() {
|
||||
var plugin = document.getElementById('plugin');
|
||||
var plugin = document.getElementById("plugin");
|
||||
var objLoadingContent = SpecialPowers.wrap(plugin);
|
||||
ok(!objLoadingContent.activated, "plugin should not be activated");
|
||||
|
||||
|
||||
SimpleTest.waitForFocus(afterWindowFocus);
|
||||
}
|
||||
|
||||
function afterWindowFocus() {
|
||||
var plugin = document.getElementById('plugin');
|
||||
var plugin = document.getElementById("plugin");
|
||||
var objLoadingContent = SpecialPowers.wrap(plugin);
|
||||
|
||||
objLoadingContent.playPlugin();
|
||||
|
@ -38,9 +38,9 @@
|
|||
SimpleTest.waitForCondition(condition, afterPluginActivation,
|
||||
"Waited too long for plugin to activate");
|
||||
}
|
||||
|
||||
|
||||
function afterPluginActivation() {
|
||||
var plugin = document.getElementById('plugin');
|
||||
var plugin = document.getElementById("plugin");
|
||||
var objLoadingContent = SpecialPowers.wrap(plugin);
|
||||
ok(objLoadingContent.activated, "plugin should be activated now");
|
||||
|
||||
|
@ -52,10 +52,10 @@
|
|||
}
|
||||
|
||||
function afterPaintsFlushed() {
|
||||
var plugin = document.getElementById('plugin');
|
||||
var plugin = document.getElementById("plugin");
|
||||
try {
|
||||
is(plugin.getMouseUpEventCount(), 0, "Plugin should not have received mouse events yet.");
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
ok(false, "plugin.getMouseUpEventCount() shouldn't throw");
|
||||
}
|
||||
|
||||
|
@ -66,10 +66,10 @@
|
|||
}
|
||||
|
||||
function afterFirstClick() {
|
||||
var plugin = document.getElementById('plugin');
|
||||
var plugin = document.getElementById("plugin");
|
||||
try {
|
||||
is(plugin.getMouseUpEventCount(), 1, "Plugin should have received 1 mouse up event.");
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
ok(false, "plugin.getMouseUpEventCount() shouldn't throw");
|
||||
}
|
||||
|
||||
|
|
|
@ -21,13 +21,13 @@ setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
|
|||
|
||||
function go() {
|
||||
// Set things up.
|
||||
var win = document.getElementById('ifr').contentWindow;
|
||||
var plugin = win.document.getElementById('pluginElement');
|
||||
var win = document.getElementById("ifr").contentWindow;
|
||||
var plugin = win.document.getElementById("pluginElement");
|
||||
var testValue = plugin.getObjectValue();
|
||||
|
||||
function checkPlugin() {
|
||||
dump("About to call checkObjectValue\n");
|
||||
ok(plugin.checkObjectValue(testValue), 'Plugin proto should work correctly');
|
||||
ok(plugin.checkObjectValue(testValue), "Plugin proto should work correctly");
|
||||
}
|
||||
// First, check things before transplanting.
|
||||
checkPlugin();
|
||||
|
|
|
@ -20,7 +20,7 @@ SimpleTest.waitForExplicitFinish();
|
|||
setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
|
||||
|
||||
function go() {
|
||||
var plugin = document.getElementById('plugin');
|
||||
var plugin = document.getElementById("plugin");
|
||||
|
||||
// Get wrapped npobject from plugin (plugin.__proto__)
|
||||
var val = plugin.getObjectValue();
|
||||
|
@ -41,7 +41,7 @@ function go() {
|
|||
}
|
||||
|
||||
// Spin the event loop so the instantiation can complete
|
||||
window.setTimeout(function () {
|
||||
window.setTimeout(function() {
|
||||
ok(pluginCheck(), "Shouldn't explode");
|
||||
|
||||
// All done.
|
||||
|
|
|
@ -27,8 +27,8 @@ setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
|
|||
var frameLoadCount = 0;
|
||||
|
||||
function frameNavBlocked() {
|
||||
isnot(SpecialPowers.wrap(window.frame1).location.href.indexOf('chrome://'),
|
||||
0, 'plugin shouldnt be able to cause navigation to chrome URLs');
|
||||
isnot(SpecialPowers.wrap(window.frame1).location.href.indexOf("chrome://"),
|
||||
0, "plugin shouldnt be able to cause navigation to chrome URLs");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED, "Second T
|
|||
<script type="application/javascript">
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
window.addEventListener("load", function () {
|
||||
window.addEventListener("load", function() {
|
||||
const OBJLC = SpecialPowers.Ci.nsIObjectLoadingContent;
|
||||
is(SpecialPowers.wrap(document.getElementById("shouldLoad")).displayedType, OBJLC.TYPE_PLUGIN, "Testing object load without type, failed expected load");
|
||||
is(SpecialPowers.wrap(document.getElementById("shouldIgnoreType")).displayedType, OBJLC.TYPE_PLUGIN, "Testing object load with type, failed expected load");
|
||||
|
|
|
@ -66,53 +66,53 @@
|
|||
"qux.com:1:5," +
|
||||
"quz.com:1:8"
|
||||
);
|
||||
ok(stored(["foo.com","bar.com","baz.com","qux.com","quz.com"]),
|
||||
ok(stored(["foo.com", "bar.com", "baz.com", "qux.com", "quz.com"]),
|
||||
"Data stored for sites");
|
||||
|
||||
// Clear nothing.
|
||||
pluginHost.clearSiteData(pluginTag, null, FLAG_CLEAR_ALL, 4, {callback: function() { test1(); }});
|
||||
pluginHost.clearSiteData(pluginTag, null, FLAG_CLEAR_ALL, 4, {callback() { test1(); }});
|
||||
}
|
||||
function test1() {
|
||||
ok(stored(["foo.com","bar.com","baz.com","qux.com","quz.com"]),
|
||||
ok(stored(["foo.com", "bar.com", "baz.com", "qux.com", "quz.com"]),
|
||||
"Data stored for sites");
|
||||
|
||||
pluginHost.clearSiteData(pluginTag, null, FLAG_CLEAR_CACHE, 4, {callback: function() { test2(); }});
|
||||
pluginHost.clearSiteData(pluginTag, null, FLAG_CLEAR_CACHE, 4, {callback() { test2(); }});
|
||||
}
|
||||
function test2() {
|
||||
ok(stored(["foo.com","bar.com","baz.com","qux.com","quz.com"]),
|
||||
ok(stored(["foo.com", "bar.com", "baz.com", "qux.com", "quz.com"]),
|
||||
"Data stored for sites");
|
||||
|
||||
// Clear cache data 5 seconds or older.
|
||||
pluginHost.clearSiteData(pluginTag, null, FLAG_CLEAR_CACHE, 5, {callback: function() { test3(); }});
|
||||
pluginHost.clearSiteData(pluginTag, null, FLAG_CLEAR_CACHE, 5, {callback() { test3(); }});
|
||||
}
|
||||
function test3() {
|
||||
ok(stored(["foo.com","bar.com","baz.com","quz.com"]),
|
||||
ok(stored(["foo.com", "bar.com", "baz.com", "quz.com"]),
|
||||
"Data stored for sites");
|
||||
ok(!stored(["qux.com"]), "Data cleared for qux.com");
|
||||
// Clear cache data for foo.com, but leave non-cache data.
|
||||
pluginHost.clearSiteData(pluginTag, "foo.com", FLAG_CLEAR_CACHE, 20, {callback: function() { test4(); }});
|
||||
pluginHost.clearSiteData(pluginTag, "foo.com", FLAG_CLEAR_CACHE, 20, {callback() { test4(); }});
|
||||
}
|
||||
function test4() {
|
||||
ok(stored(["foo.com","bar.com","baz.com","quz.com"]),
|
||||
ok(stored(["foo.com", "bar.com", "baz.com", "quz.com"]),
|
||||
"Data stored for sites");
|
||||
|
||||
// Clear all data 7 seconds or older.
|
||||
pluginHost.clearSiteData(pluginTag, null, FLAG_CLEAR_ALL, 7, {callback: function() { test5(); }});
|
||||
pluginHost.clearSiteData(pluginTag, null, FLAG_CLEAR_ALL, 7, {callback() { test5(); }});
|
||||
}
|
||||
function test5() {
|
||||
ok(stored(["bar.com","baz.com","quz.com"]), "Data stored for sites");
|
||||
ok(stored(["bar.com", "baz.com", "quz.com"]), "Data stored for sites");
|
||||
ok(!stored(["foo.com"]), "Data cleared for foo.com");
|
||||
ok(!stored(["qux.com"]), "Data cleared for qux.com");
|
||||
|
||||
// Clear all cache data.
|
||||
pluginHost.clearSiteData(pluginTag, null, FLAG_CLEAR_CACHE, 20, {callback: function() { test6(); }});
|
||||
pluginHost.clearSiteData(pluginTag, null, FLAG_CLEAR_CACHE, 20, {callback() { test6(); }});
|
||||
}
|
||||
function test6() {
|
||||
ok(stored(["bar.com","baz.com"]), "Data stored for sites");
|
||||
ok(stored(["bar.com", "baz.com"]), "Data stored for sites");
|
||||
ok(!stored(["quz.com"]), "Data cleared for quz.com");
|
||||
|
||||
// Clear all data for bar.com.
|
||||
pluginHost.clearSiteData(pluginTag, "bar.com", FLAG_CLEAR_ALL, 20, {callback: function(rv) { test7(rv); }});
|
||||
pluginHost.clearSiteData(pluginTag, "bar.com", FLAG_CLEAR_ALL, 20, {callback(rv) { test7(rv); }});
|
||||
}
|
||||
function test7(rv) {
|
||||
ok(stored(["baz.com"]), "Data stored for baz.com");
|
||||
|
@ -121,42 +121,42 @@
|
|||
// Disable clearing by age.
|
||||
p.setSitesWithDataCapabilities(false);
|
||||
|
||||
pluginHost.clearSiteData(pluginTag, null, FLAG_CLEAR_ALL, 20, {callback: function(rv) {
|
||||
is(rv, Cr.NS_ERROR_PLUGIN_TIME_RANGE_NOT_SUPPORTED);
|
||||
test8(rv);
|
||||
}});
|
||||
pluginHost.clearSiteData(pluginTag, null, FLAG_CLEAR_ALL, 20, {callback(rv) {
|
||||
is(rv, Cr.NS_ERROR_PLUGIN_TIME_RANGE_NOT_SUPPORTED);
|
||||
test8(rv);
|
||||
}});
|
||||
}
|
||||
function test8(rv) {
|
||||
pluginHost.clearSiteData(pluginTag, null, FLAG_CLEAR_CACHE, 20, {callback: function(rv) {
|
||||
is(rv, Cr.NS_ERROR_PLUGIN_TIME_RANGE_NOT_SUPPORTED);
|
||||
test9(rv);
|
||||
}});
|
||||
pluginHost.clearSiteData(pluginTag, null, FLAG_CLEAR_CACHE, 20, {callback(rv) {
|
||||
is(rv, Cr.NS_ERROR_PLUGIN_TIME_RANGE_NOT_SUPPORTED);
|
||||
test9(rv);
|
||||
}});
|
||||
}
|
||||
function test9(rv) {
|
||||
pluginHost.clearSiteData(pluginTag, "baz.com", FLAG_CLEAR_ALL, 20, {callback: function(rv) {
|
||||
is(rv, Cr.NS_ERROR_PLUGIN_TIME_RANGE_NOT_SUPPORTED);
|
||||
test10(rv);
|
||||
}});
|
||||
pluginHost.clearSiteData(pluginTag, "baz.com", FLAG_CLEAR_ALL, 20, {callback(rv) {
|
||||
is(rv, Cr.NS_ERROR_PLUGIN_TIME_RANGE_NOT_SUPPORTED);
|
||||
test10(rv);
|
||||
}});
|
||||
}
|
||||
function test10(rv) {
|
||||
pluginHost.clearSiteData(pluginTag, "baz.com", FLAG_CLEAR_CACHE, 20, {callback: function(rv) {
|
||||
is(rv, Cr.NS_ERROR_PLUGIN_TIME_RANGE_NOT_SUPPORTED);
|
||||
test11();
|
||||
}});
|
||||
pluginHost.clearSiteData(pluginTag, "baz.com", FLAG_CLEAR_CACHE, 20, {callback(rv) {
|
||||
is(rv, Cr.NS_ERROR_PLUGIN_TIME_RANGE_NOT_SUPPORTED);
|
||||
test11();
|
||||
}});
|
||||
}
|
||||
function test11() {
|
||||
// Clear cache for baz.com and globally for all ages.
|
||||
pluginHost.clearSiteData(pluginTag, "baz.com", FLAG_CLEAR_CACHE, -1, {callback: function(rv) { test12()}});
|
||||
pluginHost.clearSiteData(pluginTag, "baz.com", FLAG_CLEAR_CACHE, -1, {callback(rv) { test12(); }});
|
||||
}
|
||||
function test12() {
|
||||
pluginHost.clearSiteData(pluginTag, null, FLAG_CLEAR_CACHE, -1, {callback: function(rv) { test13()}});
|
||||
pluginHost.clearSiteData(pluginTag, null, FLAG_CLEAR_CACHE, -1, {callback(rv) { test13(); }});
|
||||
}
|
||||
function test13() {
|
||||
// Check that all of the above were no-ops.
|
||||
ok(stored(["baz.com"]), "Data stored for baz.com");
|
||||
|
||||
// Clear everything for baz.com.
|
||||
pluginHost.clearSiteData(pluginTag, "baz.com", FLAG_CLEAR_ALL, -1, {callback: function(rv) { test14()}});
|
||||
pluginHost.clearSiteData(pluginTag, "baz.com", FLAG_CLEAR_ALL, -1, {callback(rv) { test14(); }});
|
||||
}
|
||||
function test14() {
|
||||
ok(!stored(["baz.com"]), "Data cleared for baz.com");
|
||||
|
@ -171,31 +171,31 @@
|
|||
"[192.168.1.1]:0:0," +
|
||||
"localhost:0:0"
|
||||
);
|
||||
ok(stored(["foo.com","nonexistent.foo.com","bar.com","192.168.1.1","localhost"]),
|
||||
ok(stored(["foo.com", "nonexistent.foo.com", "bar.com", "192.168.1.1", "localhost"]),
|
||||
"Data stored for sites");
|
||||
|
||||
// Clear data for "foo.com" and its subdomains.
|
||||
pluginHost.clearSiteData(pluginTag, "foo.com", FLAG_CLEAR_ALL, -1, {callback: function(rv) { test15()}});
|
||||
pluginHost.clearSiteData(pluginTag, "foo.com", FLAG_CLEAR_ALL, -1, {callback(rv) { test15(); }});
|
||||
}
|
||||
function test15() {
|
||||
ok(stored(["bar.com","192.168.1.1","localhost"]), "Data stored for sites");
|
||||
ok(stored(["bar.com", "192.168.1.1", "localhost"]), "Data stored for sites");
|
||||
ok(!stored(["foo.com"]), "Data cleared for foo.com");
|
||||
ok(!stored(["bar.foo.com"]), "Data cleared for subdomains of foo.com");
|
||||
|
||||
// Clear data for "bar.com" using a subdomain.
|
||||
pluginHost.clearSiteData(pluginTag, "foo.bar.com", FLAG_CLEAR_ALL, -1, {callback: function(rv) { test16()}});
|
||||
pluginHost.clearSiteData(pluginTag, "foo.bar.com", FLAG_CLEAR_ALL, -1, {callback(rv) { test16(); }});
|
||||
}
|
||||
function test16() {
|
||||
ok(!stored(["bar.com"]), "Data cleared for bar.com");
|
||||
|
||||
// Clear data for "192.168.1.1".
|
||||
pluginHost.clearSiteData(pluginTag, "192.168.1.1", FLAG_CLEAR_ALL, -1, {callback: function(rv) { test17()}});
|
||||
pluginHost.clearSiteData(pluginTag, "192.168.1.1", FLAG_CLEAR_ALL, -1, {callback(rv) { test17(); }});
|
||||
}
|
||||
function test17() {
|
||||
ok(!stored(["192.168.1.1"]), "Data cleared for 192.168.1.1");
|
||||
|
||||
// Clear data for "localhost".
|
||||
pluginHost.clearSiteData(pluginTag, "localhost", FLAG_CLEAR_ALL, -1, {callback: function(rv) { test18()}});
|
||||
pluginHost.clearSiteData(pluginTag, "localhost", FLAG_CLEAR_ALL, -1, {callback(rv) { test18(); }});
|
||||
}
|
||||
function test18() {
|
||||
ok(!stored(null), "All data cleared");
|
||||
|
@ -207,18 +207,18 @@
|
|||
"xn--bcher-kva.NZ:0:0"
|
||||
);
|
||||
// Check that both the ACE and UTF-8 representations register.
|
||||
ok(stored(["b\u00FCcher.es","xn--bcher-kva.es","b\u00FCcher.uk","xn--bcher-kva.uk"]),
|
||||
ok(stored(["b\u00FCcher.es", "xn--bcher-kva.es", "b\u00FCcher.uk", "xn--bcher-kva.uk"]),
|
||||
"Data stored for sites");
|
||||
|
||||
// Clear data for the UTF-8 version.
|
||||
pluginHost.clearSiteData(pluginTag, "b\u00FCcher.es", FLAG_CLEAR_ALL, -1, {callback: function(rv) { test19()}});
|
||||
pluginHost.clearSiteData(pluginTag, "b\u00FCcher.es", FLAG_CLEAR_ALL, -1, {callback(rv) { test19(); }});
|
||||
}
|
||||
function test19() {
|
||||
ok(!stored(["b\u00FCcher.es"]), "Data cleared for UTF-8 representation");
|
||||
ok(!stored(["xn--bcher-kva.es"]), "Data cleared for ACE representation");
|
||||
|
||||
// Clear data for the ACE version.
|
||||
pluginHost.clearSiteData(pluginTag, "xn--bcher-kva.uk", FLAG_CLEAR_ALL, -1, {callback: function(rv) { test20()}});
|
||||
pluginHost.clearSiteData(pluginTag, "xn--bcher-kva.uk", FLAG_CLEAR_ALL, -1, {callback(rv) { test20(); }});
|
||||
}
|
||||
function test20() {
|
||||
ok(!stored(["b\u00FCcher.uk"]), "Data cleared for UTF-8 representation");
|
||||
|
@ -227,9 +227,9 @@
|
|||
// The NPAPI spec requires that the plugin report sites in normalized
|
||||
// UTF-8. We do happen to normalize the result anyway, so while that's not
|
||||
// strictly required, we test it here.
|
||||
ok(stored(["b\u00FCcher.nz","xn--bcher-kva.nz"]),
|
||||
ok(stored(["b\u00FCcher.nz", "xn--bcher-kva.nz"]),
|
||||
"Data stored for sites");
|
||||
pluginHost.clearSiteData(pluginTag, "b\u00FCcher.nz", FLAG_CLEAR_ALL, -1, {callback: function(rv) { test21()}});
|
||||
pluginHost.clearSiteData(pluginTag, "b\u00FCcher.nz", FLAG_CLEAR_ALL, -1, {callback(rv) { test21(); }});
|
||||
}
|
||||
function test21() {
|
||||
ok(!stored(["b\u00FCcher.nz"]), "Data cleared for UTF-8 representation");
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
<script class="testbody" type="text/javascript">
|
||||
function runTests() {
|
||||
var text = " some text \n to copy 'n paste "
|
||||
var text = " some text \n to copy 'n paste ";
|
||||
var textElt = document.getElementById("input");
|
||||
var plugin = document.getElementById("plugin1");
|
||||
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
|
||||
|
||||
window.frameLoaded = function frameLoaded_toCrash() {
|
||||
var iframe = document.getElementById('iframe1');
|
||||
var p = iframe.contentDocument.getElementById('plugin1');
|
||||
var iframe = document.getElementById("iframe1");
|
||||
var p = iframe.contentDocument.getElementById("plugin1");
|
||||
|
||||
// This test is for bug 550026, which is inherently nondeterministic.
|
||||
// If we hit that bug, the browser process would crash when the plugin
|
||||
|
@ -34,13 +34,11 @@
|
|||
SimpleTest.finish();
|
||||
},
|
||||
1000);
|
||||
}
|
||||
catch (e) {
|
||||
} catch (e) {
|
||||
ok(true, "p.crashInNestedLoop() should throw an exception");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
<iframe id="iframe1" src="crashing_subpage.html" width="600" height="600"></iframe>
|
||||
|
|
|
@ -11,26 +11,24 @@
|
|||
window.frameLoaded = function frameLoaded_toCrash() {
|
||||
SimpleTest.expectChildProcessCrash();
|
||||
|
||||
var iframe = document.getElementById('iframe1');
|
||||
var p = iframe.contentDocument.getElementById('plugin1');
|
||||
var iframe = document.getElementById("iframe1");
|
||||
var p = iframe.contentDocument.getElementById("plugin1");
|
||||
|
||||
p.setColor("FFFF00FF");
|
||||
|
||||
try {
|
||||
p.crash();
|
||||
ok(false, "p.crash() should throw an exception");
|
||||
}
|
||||
catch (e) {
|
||||
} catch (e) {
|
||||
ok(true, "p.crash() should throw an exception");
|
||||
}
|
||||
|
||||
// Create random identifiers to test bug 560213
|
||||
for (var i = 0; i < 5; ++i) {
|
||||
var r = 'rid_' + Math.floor(Math.random() * 10000 + 1);
|
||||
var r = "rid_" + Math.floor(Math.random() * 10000 + 1);
|
||||
try {
|
||||
ok(!(r in p), "unknown identifier in crashed plugin should fail silently");
|
||||
}
|
||||
catch (e) {
|
||||
} catch (e) {
|
||||
ok(false, "unknown identifier check threw");
|
||||
}
|
||||
}
|
||||
|
@ -38,25 +36,23 @@
|
|||
try {
|
||||
p.setColor("FFFF0000");
|
||||
ok(false, "p.setColor should throw after the plugin crashes");
|
||||
}
|
||||
catch (e) {
|
||||
} catch (e) {
|
||||
ok(true, "p.setColor should throw after the plugin crashes");
|
||||
}
|
||||
|
||||
window.frameLoaded = function reloaded() {
|
||||
var p = iframe.contentDocument.getElementById('plugin1');
|
||||
var p = iframe.contentDocument.getElementById("plugin1");
|
||||
try {
|
||||
p.setColor('FF00FF00');
|
||||
p.setColor("FF00FF00");
|
||||
ok(true, "Reloading worked");
|
||||
}
|
||||
catch (e) {
|
||||
} catch (e) {
|
||||
ok(false, "Reloading didn't give us a usable plugin");
|
||||
}
|
||||
SimpleTest.finish();
|
||||
}
|
||||
};
|
||||
|
||||
iframe.contentWindow.location.reload();
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
<iframe id="iframe1" src="crashing_subpage.html" width="600" height="600"></iframe>
|
||||
|
|
|
@ -10,19 +10,19 @@
|
|||
SimpleTest.waitForExplicitFinish();
|
||||
setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
|
||||
|
||||
var iframe = document.getElementById('iframe1');
|
||||
var iframe = document.getElementById("iframe1");
|
||||
|
||||
function mainLoaded() {
|
||||
SimpleTest.expectChildProcessCrash();
|
||||
|
||||
var p = iframe.contentDocument.createElement('embed');
|
||||
p.setAttribute('id', 'plugin1');
|
||||
p.setAttribute('type', 'application/x-test');
|
||||
p.setAttribute('width', '400');
|
||||
p.setAttribute('height', '400');
|
||||
p.setAttribute('drawmode', 'solid');
|
||||
p.setAttribute('color', 'FF00FFFF');
|
||||
p.setAttribute('newCrash', 'true');
|
||||
var p = iframe.contentDocument.createElement("embed");
|
||||
p.setAttribute("id", "plugin1");
|
||||
p.setAttribute("type", "application/x-test");
|
||||
p.setAttribute("width", "400");
|
||||
p.setAttribute("height", "400");
|
||||
p.setAttribute("drawmode", "solid");
|
||||
p.setAttribute("color", "FF00FFFF");
|
||||
p.setAttribute("newCrash", "true");
|
||||
iframe.contentDocument.body.appendChild(p);
|
||||
|
||||
// The plugin will now crash when it is instantiated, but
|
||||
|
@ -36,18 +36,17 @@
|
|||
"Plugin should have crashed on creation");
|
||||
|
||||
window.frameLoaded = reloaded1;
|
||||
iframe.contentWindow.location.replace('crashing_subpage.html');
|
||||
})
|
||||
iframe.contentWindow.location.replace("crashing_subpage.html");
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function reloaded1() {
|
||||
var p = iframe.contentDocument.getElementById('plugin1');
|
||||
var p = iframe.contentDocument.getElementById("plugin1");
|
||||
try {
|
||||
p.setColor('FF00FF00');
|
||||
p.setColor("FF00FF00");
|
||||
ok(true, "Reloading after crash-on-new worked");
|
||||
}
|
||||
catch (e) {
|
||||
} catch (e) {
|
||||
ok(false, "Reloading after crash-on-new didn't give us a usable plugin");
|
||||
}
|
||||
p.crashOnDestroy();
|
||||
|
@ -61,12 +60,11 @@
|
|||
}
|
||||
|
||||
function reloaded2() {
|
||||
var p = iframe.contentDocument.getElementById('plugin1');
|
||||
var p = iframe.contentDocument.getElementById("plugin1");
|
||||
try {
|
||||
p.setColor('FF00FF00');
|
||||
p.setColor("FF00FF00");
|
||||
ok(true, "Reloading after crash-on-destroy worked");
|
||||
}
|
||||
catch (e) {
|
||||
} catch (e) {
|
||||
ok(false, "Reloading after crash-on-destroy didn't give us a usable plugin");
|
||||
}
|
||||
SimpleTest.finish();
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
for (var n in pluginElement) {
|
||||
++c;
|
||||
ok(n in pluginElement, "Enumerated property which doesn't exist?");
|
||||
if (n == 'setColor')
|
||||
if (n == "setColor")
|
||||
foundSetColor = true;
|
||||
}
|
||||
ok(c > 0, "Should have enumerated some properties");
|
||||
|
|
|
@ -15,49 +15,45 @@
|
|||
var timeoutPref = "dom.ipc.plugins.timeoutSecs";
|
||||
SpecialPowers.setIntPref(timeoutPref, 5);
|
||||
|
||||
var iframe = document.getElementById('iframe1');
|
||||
var p = iframe.contentDocument.getElementById('plugin1');
|
||||
var iframe = document.getElementById("iframe1");
|
||||
var p = iframe.contentDocument.getElementById("plugin1");
|
||||
|
||||
p.setColor("FFFF00FF");
|
||||
|
||||
try {
|
||||
p.hang();
|
||||
ok(false, "p.hang() should throw an exception");
|
||||
}
|
||||
catch (e) {
|
||||
} catch (e) {
|
||||
ok(true, "p.hang() should throw an exception");
|
||||
}
|
||||
|
||||
try {
|
||||
p.setColor("FFFF0000");
|
||||
ok(false, "p.setColor should throw after the plugin crashes");
|
||||
}
|
||||
catch (e) {
|
||||
} catch (e) {
|
||||
ok(true, "p.setColor should throw after the plugin crashes");
|
||||
}
|
||||
|
||||
window.frameLoaded = function reloaded() {
|
||||
var p = iframe.contentDocument.getElementById('plugin1');
|
||||
var p = iframe.contentDocument.getElementById("plugin1");
|
||||
try {
|
||||
p.setColor('FF00FF00');
|
||||
p.setColor("FF00FF00");
|
||||
ok(true, "Reloading worked");
|
||||
}
|
||||
catch (e) {
|
||||
} catch (e) {
|
||||
ok(false, "Reloading didn't give us a usable plugin");
|
||||
}
|
||||
|
||||
try {
|
||||
SpecialPowers.clearUserPref(timeoutPref);
|
||||
}
|
||||
catch(e) {
|
||||
} catch (e) {
|
||||
ok(false, "Couldn't reset timeout pref");
|
||||
}
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
};
|
||||
|
||||
iframe.contentWindow.location.reload();
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
<iframe id="iframe1" src="crashing_subpage.html" width="600" height="600"></iframe>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
<body>
|
||||
<script type="application/javascript">
|
||||
"use strict"
|
||||
"use strict";
|
||||
{
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
let ph = SpecialPowers.Cc["@mozilla.org/plugin/host;1"].getService(SpecialPowers.Ci.nsIPluginHost);
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
destroyed = false;
|
||||
exceptionThrown = false;
|
||||
runTests(function () {
|
||||
runTests(function() {
|
||||
SimpleTest.finish();
|
||||
});
|
||||
});
|
||||
|
@ -54,9 +54,9 @@
|
|||
}
|
||||
|
||||
function runTests(callback) {
|
||||
p = document.getElementById('plugin1');
|
||||
d1 = document.getElementById('div1');
|
||||
d2 = document.getElementById('div2');
|
||||
p = document.getElementById("plugin1");
|
||||
d1 = document.getElementById("div1");
|
||||
d2 = document.getElementById("div2");
|
||||
|
||||
// First tests involve moving the instance from one div to another.
|
||||
p.startWatchingInstanceCount();
|
||||
|
|
|
@ -32,8 +32,8 @@
|
|||
}
|
||||
|
||||
function startTest() {
|
||||
var p1 = document.getElementById('plugin1');
|
||||
var d1 = document.getElementById('div1');
|
||||
var p1 = document.getElementById("plugin1");
|
||||
var d1 = document.getElementById("div1");
|
||||
|
||||
p1.callOnDestroy(onDestroy);
|
||||
d1.removeChild(p1);
|
||||
|
|
|
@ -32,8 +32,8 @@
|
|||
}
|
||||
|
||||
function startTest() {
|
||||
var p1 = document.getElementById('plugin1');
|
||||
var d1 = document.getElementById('div1');
|
||||
var p1 = document.getElementById("plugin1");
|
||||
var d1 = document.getElementById("div1");
|
||||
|
||||
p1.callOnDestroy(onDestroy);
|
||||
|
||||
|
|
|
@ -32,9 +32,9 @@
|
|||
}
|
||||
|
||||
function startTest() {
|
||||
var p1 = document.getElementById('plugin1');
|
||||
var d1 = document.getElementById('div1');
|
||||
var d2 = document.getElementById('div2');
|
||||
var p1 = document.getElementById("plugin1");
|
||||
var d1 = document.getElementById("div1");
|
||||
var d2 = document.getElementById("div2");
|
||||
|
||||
p1.callOnDestroy(onDestroy);
|
||||
d1.removeChild(d2);
|
||||
|
|
|
@ -10,16 +10,16 @@
|
|||
SimpleTest.waitForExplicitFinish();
|
||||
setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
|
||||
|
||||
var iframe = document.getElementById('iframe1');
|
||||
var iframe = document.getElementById("iframe1");
|
||||
|
||||
function mainLoaded() {
|
||||
var p = iframe.contentDocument.createElement('embed');
|
||||
p.setAttribute('id', 'plugin1');
|
||||
p.setAttribute('type', 'application/x-test');
|
||||
p.setAttribute('width', '400');
|
||||
p.setAttribute('height', '400');
|
||||
p.setAttribute('drawmode', 'solid');
|
||||
p.setAttribute('color', 'FF00FFFF');
|
||||
var p = iframe.contentDocument.createElement("embed");
|
||||
p.setAttribute("id", "plugin1");
|
||||
p.setAttribute("type", "application/x-test");
|
||||
p.setAttribute("width", "400");
|
||||
p.setAttribute("height", "400");
|
||||
p.setAttribute("drawmode", "solid");
|
||||
p.setAttribute("color", "FF00FFFF");
|
||||
iframe.contentDocument.body.appendChild(p);
|
||||
|
||||
// Plugin instantiation happens asynchronously
|
||||
|
@ -27,7 +27,7 @@
|
|||
SimpleTest.executeSoon(function() {
|
||||
ok(p.setColor !== undefined, "Dynamic plugin instantiation.");
|
||||
SimpleTest.finish();
|
||||
})
|
||||
});
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED, "Second Test Plug-in");
|
||||
|
||||
function frameLoaded() {
|
||||
var contentDocument = document.getElementById('testframe').contentDocument;
|
||||
var contentDocument = document.getElementById("testframe").contentDocument;
|
||||
ok(contentDocument.body.innerHTML.length > 0, "Frame content shouldn't be empty.");
|
||||
ok(contentDocument.plugins.length > 0, "Frame content should have a plugin.");
|
||||
var plugin = contentDocument.plugins[0];
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
|
||||
|
||||
function runTests() {
|
||||
var p1 = document.getElementById('plugin1');
|
||||
var p2 = document.getElementById('plugin2');
|
||||
var p1 = document.getElementById("plugin1");
|
||||
var p2 = document.getElementById("plugin2");
|
||||
|
||||
var o = p1.getObjectValue();
|
||||
ok(p1.checkObjectValue(o), "Plugin objects passed to the same instance are identical.");
|
||||
|
|
|
@ -13,11 +13,11 @@
|
|||
setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
|
||||
|
||||
function runTest() {
|
||||
var p = document.getElementById('plugin1');
|
||||
var p = document.getElementById("plugin1");
|
||||
var destroyed = false;
|
||||
p.callOnDestroy(function() {
|
||||
destroyed = true;
|
||||
ok(!p.streamTest('loremipsum.txt', false, null, null,
|
||||
ok(!p.streamTest("loremipsum.txt", false, null, null,
|
||||
function(r, t) {
|
||||
ok(false, "get-during-destroy should have failed");
|
||||
}, null, true), "NPN_GetURLNotify should fail during NPP_Destroy");
|
||||
|
|
|
@ -5,16 +5,16 @@
|
|||
|
||||
<body onload="runTests()">
|
||||
<script class="testbody" type="application/javascript">
|
||||
dump('lastScript\n');
|
||||
dump("lastScript\n");
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
|
||||
|
||||
function runTests() {
|
||||
ok(
|
||||
document.getElementById('plugin1').pluginFoundElement,
|
||||
document.getElementById("plugin1").pluginFoundElement,
|
||||
"plugin1.pluginFoundElement (NPNVPluginElementNPObject) - " +
|
||||
document.getElementById('plugin1').pluginFoundElement
|
||||
document.getElementById("plugin1").pluginFoundElement
|
||||
);
|
||||
ok(
|
||||
window.pluginFoundWindow,
|
||||
|
|
|
@ -18,15 +18,15 @@
|
|||
<script type="application/javascript">
|
||||
function MyFunc(arg) {
|
||||
is(arg, "hi", "Argument passed to constructor function");
|
||||
this.localProp = 'local';
|
||||
this.localProp = "local";
|
||||
}
|
||||
MyFunc.prototype.protoProp = 't';
|
||||
MyFunc.prototype.protoProp = "t";
|
||||
|
||||
var theplugin = document.getElementById('theplugin');
|
||||
var theplugin = document.getElementById("theplugin");
|
||||
|
||||
ok(theplugin.constructObject(Array) instanceof Array, "Constructed Array");
|
||||
var o = theplugin.constructObject(MyFunc, "hi");
|
||||
ok(o instanceof MyFunc, "Constructed MyFunc");
|
||||
is(o.localProp, 'local', "this property correct");
|
||||
is(o.protoProp, 't', "prototype property correct");
|
||||
is(o.localProp, "local", "this property correct");
|
||||
is(o.protoProp, "t", "prototype property correct");
|
||||
</script>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<p id="display"></p>
|
||||
|
||||
<script class="testbody" type="application/javascript">
|
||||
////
|
||||
// //
|
||||
// This test exercises NP identifiers by querying the reflector to make sure
|
||||
// that identifiers are translated to values correctly.
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
|||
var i, prop, randomnumber;
|
||||
|
||||
for (i = 0; i < 20; ++i) {
|
||||
randomnumber=Math.floor(Math.random()*1001);
|
||||
randomnumber = Math.floor(Math.random() * 1001);
|
||||
prop = "prop" + randomnumber;
|
||||
is(reflector[prop], prop, "Property " + prop);
|
||||
}
|
||||
|
@ -45,8 +45,8 @@
|
|||
is(reflector[prop], prop, "Property " + prop);
|
||||
}
|
||||
|
||||
is(reflector.a, 'a', "Property .a");
|
||||
is(reflector['a'], 'a', "Property ['a']");
|
||||
is(reflector.a, "a", "Property .a");
|
||||
is(reflector.a, "a", "Property ['a']");
|
||||
reflector = null;
|
||||
|
||||
SpecialPowers.gc();
|
||||
|
@ -54,9 +54,8 @@
|
|||
++testsRun;
|
||||
if (testsRun == 3) {
|
||||
SimpleTest.finish();
|
||||
}
|
||||
else {
|
||||
document.getElementById('subframe').contentWindow.location.reload(true);
|
||||
} else {
|
||||
document.getElementById("subframe").contentWindow.location.reload(true);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -15,19 +15,19 @@
|
|||
|
||||
// global test function
|
||||
function testMe(arg) {
|
||||
var result = arg+arg;
|
||||
var result = arg + arg;
|
||||
for (var i = 1; i < arguments.length; i++) {
|
||||
result += arguments[i] + arguments[i];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
////
|
||||
// //
|
||||
// This test exercises NPN_Evaluate using the test plugin's
|
||||
// npnEvaluateTest method. This method calls NPN_Evaluate on
|
||||
// npnEvaluateTest method. This method calls NPN_Evaluate on
|
||||
// a string argument passed to it, and returns the eval result.
|
||||
// The array below drives the tests; each array member has two
|
||||
// members: the first is a string to eval, and the second is
|
||||
// members: the first is a string to eval, and the second is
|
||||
// the expected result of the eval.
|
||||
//
|
||||
|
||||
|
@ -41,13 +41,13 @@
|
|||
["testMe(new Object(3))", 6],
|
||||
["new Object(3)", new Object(3)],
|
||||
["new Array(1, 2, 3, 4)", [1, 2, 3, 4]],
|
||||
["document.getElementById('display')",
|
||||
["document.getElementById('display')",
|
||||
document.getElementById("display")],
|
||||
["encodeURI('a = b')", "a%20=%20b"],
|
||||
["document.getElementById('testdiv').innerHTML = 'Hello world!'",
|
||||
["document.getElementById('testdiv').innerHTML = 'Hello world!'",
|
||||
"Hello world!"],
|
||||
["function test2() { var x = {a: '1', b: '2'}; return x; } test2();",
|
||||
{a: '1', b: '2'}],
|
||||
["function test2() { var x = {a: '1', b: '2'}; return x; } test2();",
|
||||
{a: "1", b: "2"}],
|
||||
["(function() { var ret; try { win = window.open(); win.document.writeln('wibble'); ret = 'no error' } catch(e) { ret = e.name; } win.close(); return ret; })()", "no error"],
|
||||
];
|
||||
|
||||
|
@ -64,26 +64,26 @@
|
|||
json_result = result.toString();
|
||||
if (typeof(expected) == "function")
|
||||
json_expected = expected.toString();
|
||||
is(json_result, json_expected,
|
||||
is(json_result, json_expected,
|
||||
"npnEvaluateTest returned an unexpected value");
|
||||
is(typeof(result), typeof(expected),
|
||||
is(typeof(result), typeof(expected),
|
||||
"npnEvaluateTest return value was of unexpected type");
|
||||
var success = (json_result == json_expected &&
|
||||
var success = (json_result == json_expected &&
|
||||
typeof(result) == typeof(expected));
|
||||
$("verbose").appendChild(
|
||||
createEl('span',null, (success ? "pass" : "fail") + ": eval(" + test[0] + ")"));
|
||||
createEl("span", null, (success ? "pass" : "fail") + ": eval(" + test[0] + ")"));
|
||||
$("verbose").appendChild(
|
||||
createEl('span', null," == " + json_result + "(" +
|
||||
typeof(result) + "), expected " + json_expected + "(" +
|
||||
createEl("span", null, " == " + json_result + "(" +
|
||||
typeof(result) + "), expected " + json_expected + "(" +
|
||||
typeof(expected) + ")"));
|
||||
$("verbose").appendChild(
|
||||
createEl('br')
|
||||
createEl("br")
|
||||
);
|
||||
}
|
||||
|
||||
is(document.getElementById('testdiv').innerHTML, "Hello world!",
|
||||
|
||||
is(document.getElementById("testdiv").innerHTML, "Hello world!",
|
||||
"innerHTML not set correctly via NPN_Evaluate");
|
||||
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
<body onload="runTests()">
|
||||
|
||||
<script class="testbody" type="application/javascript">
|
||||
////
|
||||
// //
|
||||
// This test exercises NPN_Invoke by calling the plugin's npnInvokeTest
|
||||
// method, which in turn invokes a script method with 1 or more parameters,
|
||||
// method, which in turn invokes a script method with 1 or more parameters,
|
||||
// and then compares the return vale with an expected value. This is good
|
||||
// for verifying various NPVariant values and types moving between
|
||||
// the browser and the plugin.
|
||||
|
@ -39,15 +39,15 @@
|
|||
}
|
||||
|
||||
// some objects and arrays used in the tests...
|
||||
var obj = {"key1": "string", "key2": 0, "key3": true, "key4": undefined,
|
||||
var obj = {"key1": "string", "key2": 0, "key3": true, "key4": undefined,
|
||||
"key5": null, "key6": -551235.12552, "key7": false};
|
||||
var arr = ["string", 0, true, false, undefined, null, -1, 55512.1252];
|
||||
var obj2 = {"key1": "string", "key2": 0, "key3": true, "key4": undefined,
|
||||
var obj2 = {"key1": "string", "key2": 0, "key3": true, "key4": undefined,
|
||||
"key5": null, "key6": -551235.12552, "key7": false, "array": arr};
|
||||
var arr2 = ["string", false, undefined, null, -1, 55512.1252,
|
||||
{"a": "apple", "b": true, "c": undefined}];
|
||||
|
||||
////
|
||||
// //
|
||||
// A list of tests to run. Each member of the main array contains
|
||||
// two members: the first contains the arguments passed to npnInvokeTest,
|
||||
// and the second is the expected result.
|
||||
|
@ -94,24 +94,24 @@
|
|||
[["returnArgs", arr2, arr2], true],
|
||||
// multiple arguments
|
||||
[["returnArgs", [0, 1, 2], 0, 1, 2], true],
|
||||
[["returnArgs", [5, "a", true, false, null],
|
||||
[["returnArgs", [5, "a", true, false, null],
|
||||
5, "a", true, false, null], true],
|
||||
[["returnArgs", [-1500.583, "test string\n",
|
||||
[5, 10, 15, 20], {"a": 1, "b": 2}],
|
||||
[["returnArgs", [-1500.583, "test string\n",
|
||||
[5, 10, 15, 20], {"a": 1, "b": 2}],
|
||||
-1500.583, "test string\n", [5, 10, 15, 20], {"a": 1, "b": 2}], true],
|
||||
[["returnArgs", [undefined, 0, null, "yes"],
|
||||
[["returnArgs", [undefined, 0, null, "yes"],
|
||||
undefined, 0, null, "yes"], true],
|
||||
[["returnArgs", [0, undefined, null, "yes"],
|
||||
[["returnArgs", [0, undefined, null, "yes"],
|
||||
0, undefined, null, "yes"], true],
|
||||
// too many/too few args
|
||||
[["returnTwoArgs", ["a", "b"], "a", "b", "c"], true],
|
||||
[["returnTwoArgs", ["a", undefined], "a"], true],
|
||||
[["returnTwoArgs", [undefined, undefined]], true],
|
||||
];
|
||||
|
||||
|
||||
function runTests() {
|
||||
var plugin = document.getElementById("plugin1");
|
||||
|
||||
|
||||
var result;
|
||||
for (var test of tests) {
|
||||
switch (test[0].length) {
|
||||
|
@ -141,12 +141,12 @@
|
|||
}
|
||||
is(result, test[1], "npnInvokeTestFailed: " + plugin.getError());
|
||||
$("verbose").appendChild(
|
||||
createEl('span', null, ((result == test[1] ? "pass" : "fail") + ": " + test[0])));
|
||||
createEl("span", null, ((result == test[1] ? "pass" : "fail") + ": " + test[0])));
|
||||
if (result != test[1])
|
||||
$("verbose").appendChild(createEl("span", null, (" " + plugin.getError())));
|
||||
$("verbose").appendChild(createEl('br'));
|
||||
$("verbose").appendChild(createEl("br"));
|
||||
}
|
||||
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -15,19 +15,19 @@
|
|||
|
||||
// global test function
|
||||
function testMe(arg) {
|
||||
var result = arg+arg;
|
||||
var result = arg + arg;
|
||||
for (var i = 1; i < arguments.length; i++) {
|
||||
result += arguments[i] + arguments[i];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
////
|
||||
// //
|
||||
// This test exercises NPN_InvokeDefault using the test plugin's
|
||||
// npnInvokeDefaultTest method. This method invokes an object
|
||||
// with a single parameter, and returns the result of the invocation.
|
||||
// The test list below is used to drive the tests. Each member of the
|
||||
// array contains three members: the object to invoke, an argument to
|
||||
// The test list below is used to drive the tests. Each member of the
|
||||
// array contains three members: the object to invoke, an argument to
|
||||
// invoke it with, and the expected result of the invocation.
|
||||
//
|
||||
var tests = [
|
||||
|
@ -61,7 +61,7 @@
|
|||
["Object", "a string", new String("a string")],
|
||||
["Object", 3.14, new Number(3.14)],
|
||||
["Object", { "key1": "test", "key2": 15 }, { "key1": "test", "key2": 15 }],
|
||||
["Object", [1, 3, 5, 7, 9, 11, 13, 17], [1, 3, 5, 7, 9, 11, 13, 17]],
|
||||
["Object", [1, 3, 5, 7, 9, 11, 13, 17], [1, 3, 5, 7, 9, 11, 13, 17]],
|
||||
// RegExp object
|
||||
["RegExp", "...", RegExp("...")],
|
||||
// String object
|
||||
|
@ -74,7 +74,7 @@
|
|||
["String", ""],
|
||||
// global functions
|
||||
["testMe", 3, 6],
|
||||
["testMe", "string", [1,2], "stringstring1,21,2"],
|
||||
["testMe", "string", [1, 2], "stringstring1,21,2"],
|
||||
["testMe", "me", "meme"],
|
||||
["testMe", undefined, Number.NaN],
|
||||
["testMe", [1, 2], "1,21,2"],
|
||||
|
@ -83,7 +83,7 @@
|
|||
["parseInt", "156", 156],
|
||||
["encodeURI", "a = b", "a%20=%20b"],
|
||||
];
|
||||
|
||||
|
||||
function runTests() {
|
||||
var plugin = document.getElementById("plugin1");
|
||||
|
||||
|
@ -102,42 +102,42 @@
|
|||
result = plugin.npnInvokeDefaultTest(test[0], test[1], test[2]);
|
||||
break;
|
||||
}
|
||||
// serialize the two values for easy
|
||||
// serialize the two values for easy
|
||||
var json_expected = JSON.stringify(expected);
|
||||
var json_result = JSON.stringify(result);
|
||||
if (typeof(result) == "function")
|
||||
json_result = result.toString();
|
||||
if (typeof(test[2]) == "function")
|
||||
json_expected = expected.toString();
|
||||
is(json_result, json_expected,
|
||||
is(json_result, json_expected,
|
||||
"npnInvokeDefault returned an unexpected value");
|
||||
is(typeof(result), typeof(expected),
|
||||
is(typeof(result), typeof(expected),
|
||||
"npnInvokeDefaultTest return value was of unexpected type");
|
||||
var success = (json_result == json_expected &&
|
||||
var success = (json_result == json_expected &&
|
||||
typeof(result) == typeof(expected));
|
||||
$("verbose").appendChild(
|
||||
createEl('span', null, ((success ? "pass" : "fail") + ": " + test[0] + "(")));
|
||||
createEl("span", null, ((success ? "pass" : "fail") + ": " + test[0] + "(")));
|
||||
for (var i = 1; i < test.length - 1; i++) {
|
||||
$("verbose").appendChild(
|
||||
createEl('span', null, (JSON.stringify(test[i]) + (i < test.length - 2 ? "," : ""))));
|
||||
createEl("span", null, (JSON.stringify(test[i]) + (i < test.length - 2 ? "," : ""))));
|
||||
}
|
||||
$("verbose").appendChild(
|
||||
createEl('span', null, (") == " + json_result + "(" +
|
||||
typeof(result) + "), expected " + json_expected + "(" +
|
||||
createEl("span", null, (") == " + json_result + "(" +
|
||||
typeof(result) + "), expected " + json_expected + "(" +
|
||||
typeof(expected) + ")")));
|
||||
$("verbose").appendChild(createEl('br'));
|
||||
$("verbose").appendChild(createEl("br"));
|
||||
}
|
||||
|
||||
let testObject = plugin.getInvokeDefaultObject();
|
||||
|
||||
// Test calling the invokedefault method of plugin-defined object
|
||||
is(testObject(), "Test Plug-in",
|
||||
is(testObject(), "Test Plug-in",
|
||||
"calling NPN_InvokeDefault on plugin-defined Object doesn't work");
|
||||
is(testObject(1), "Test Plug-in;1",
|
||||
is(testObject(1), "Test Plug-in;1",
|
||||
"calling NPN_InvokeDefault on plugin-defined Object doesn't work");
|
||||
is(testObject("test"), "Test Plug-in;test",
|
||||
is(testObject("test"), "Test Plug-in;test",
|
||||
"calling NPN_InvokeDefault on plugin-defined Object doesn't work");
|
||||
is(testObject(undefined, -1, null), "Test Plug-in;undefined;-1;null",
|
||||
is(testObject(undefined, -1, null), "Test Plug-in;undefined;-1;null",
|
||||
"calling NPN_InvokeDefault on plugin-defined Object doesn't work");
|
||||
|
||||
SimpleTest.finish();
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
let body = document.body;
|
||||
// A single-pixel white png
|
||||
let testPNG = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAAAAAA6fptVAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3AoIFiETNqbNRQAAAB1pVFh0Q29tbWVudAAAAAAAQ3JlYXRlZCB3aXRoIEdJTVBkLmUHAAAACklEQVQIHWP4DwABAQEANl9ngAAAAABJRU5ErkJggg==';
|
||||
let testPNG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAAAAAA6fptVAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3AoIFiETNqbNRQAAAB1pVFh0Q29tbWVudAAAAAAAQ3JlYXRlZCB3aXRoIEdJTVBkLmUHAAAACklEQVQIHWP4DwABAQEANl9ngAAAAABJRU5ErkJggg==";
|
||||
// An empty, but valid, SVG
|
||||
let testSVG = 'data:image/svg+xml,<?xml version="1.0" encoding="UTF-8"?><svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"></svg>';
|
||||
// executeSoon wrapper to count pending callbacks
|
||||
|
@ -98,13 +98,13 @@
|
|||
}
|
||||
function setDisplayed(obj, display) {
|
||||
if (display)
|
||||
removeAttr(obj, 'style');
|
||||
removeAttr(obj, "style");
|
||||
else
|
||||
setAttr(obj, 'style', "display: none;");
|
||||
setAttr(obj, "style", "display: none;");
|
||||
}
|
||||
function displayed(obj) {
|
||||
// Hacky, but that's all we use style for.
|
||||
return !hasAttr(obj, 'style');
|
||||
return !hasAttr(obj, "style");
|
||||
}
|
||||
function actualType(obj, state) {
|
||||
return state.getActualType.call(obj);
|
||||
|
@ -133,20 +133,20 @@
|
|||
// Out of document nodes without data attributes simply can't be
|
||||
// reloaded currently. Bug 767635
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Make a list of combinations of sub-lists, e.g.:
|
||||
// [ [a, b], [c, d] ]
|
||||
// ->
|
||||
// [ [a, c], [a, d], [b, c], [b, d] ]
|
||||
function eachList() {
|
||||
// Make a list of combinations of sub-lists, e.g.:
|
||||
// [ [a, b], [c, d] ]
|
||||
// ->
|
||||
// [ [a, c], [a, d], [b, c], [b, d] ]
|
||||
function eachList() {
|
||||
let all = [];
|
||||
if (!arguments.length)
|
||||
return all;
|
||||
let list = Array.prototype.slice.call(arguments, 0);
|
||||
for (let c of list[0]) {
|
||||
if (list.length > 1) {
|
||||
for (let x of eachList.apply(this,list.slice(1))) {
|
||||
for (let x of eachList.apply(this, list.slice(1))) {
|
||||
all.push((c.length ? [c] : []).concat(x));
|
||||
}
|
||||
} else if (c.length) {
|
||||
|
@ -157,91 +157,91 @@
|
|||
}
|
||||
|
||||
let states = {
|
||||
svg: function(obj, state) {
|
||||
removeAttr(obj, "type");
|
||||
src(obj, state, testSVG);
|
||||
state.noChannel = false;
|
||||
state.expectedType = "image/svg";
|
||||
// SVGs are actually image-like subdocuments
|
||||
state.expectedMode = "document";
|
||||
},
|
||||
image: function(obj, state) {
|
||||
removeAttr(obj, "type");
|
||||
src(obj, state, testPNG);
|
||||
state.noChannel = false;
|
||||
state.expectedMode = "image";
|
||||
state.expectedType = "image/png";
|
||||
},
|
||||
plugin: function(obj, state) {
|
||||
removeAttr(obj, "type");
|
||||
src(obj, state, "data:application/x-test,foo");
|
||||
state.noChannel = false;
|
||||
state.expectedType = "application/x-test";
|
||||
state.expectedMode = "plugin";
|
||||
},
|
||||
pluginExtension: function(obj, state) {
|
||||
src(obj, state, "./fake_plugin.tst");
|
||||
state.expectedMode = "plugin";
|
||||
state.pluginExtension = true;
|
||||
state.noChannel = false;
|
||||
},
|
||||
document: function(obj, state) {
|
||||
removeAttr(obj, "type");
|
||||
src(obj, state, "data:text/plain,I am a document");
|
||||
state.noChannel = false;
|
||||
state.expectedType = "text/plain";
|
||||
state.expectedMode = "document";
|
||||
},
|
||||
fallback: function(obj, state) {
|
||||
removeAttr(obj, "type");
|
||||
state.expectedType = "application/x-unknown";
|
||||
state.expectedMode = "none";
|
||||
state.noChannel = true;
|
||||
src(obj, state, null);
|
||||
},
|
||||
addToDoc: function(obj, state) {
|
||||
body.appendChild(obj);
|
||||
},
|
||||
removeFromDoc: function(obj, state) {
|
||||
if (body.contains(obj))
|
||||
body.removeChild(obj);
|
||||
},
|
||||
svg(obj, state) {
|
||||
removeAttr(obj, "type");
|
||||
src(obj, state, testSVG);
|
||||
state.noChannel = false;
|
||||
state.expectedType = "image/svg";
|
||||
// SVGs are actually image-like subdocuments
|
||||
state.expectedMode = "document";
|
||||
},
|
||||
image(obj, state) {
|
||||
removeAttr(obj, "type");
|
||||
src(obj, state, testPNG);
|
||||
state.noChannel = false;
|
||||
state.expectedMode = "image";
|
||||
state.expectedType = "image/png";
|
||||
},
|
||||
plugin(obj, state) {
|
||||
removeAttr(obj, "type");
|
||||
src(obj, state, "data:application/x-test,foo");
|
||||
state.noChannel = false;
|
||||
state.expectedType = "application/x-test";
|
||||
state.expectedMode = "plugin";
|
||||
},
|
||||
pluginExtension(obj, state) {
|
||||
src(obj, state, "./fake_plugin.tst");
|
||||
state.expectedMode = "plugin";
|
||||
state.pluginExtension = true;
|
||||
state.noChannel = false;
|
||||
},
|
||||
document(obj, state) {
|
||||
removeAttr(obj, "type");
|
||||
src(obj, state, "data:text/plain,I am a document");
|
||||
state.noChannel = false;
|
||||
state.expectedType = "text/plain";
|
||||
state.expectedMode = "document";
|
||||
},
|
||||
fallback(obj, state) {
|
||||
removeAttr(obj, "type");
|
||||
state.expectedType = "application/x-unknown";
|
||||
state.expectedMode = "none";
|
||||
state.noChannel = true;
|
||||
src(obj, state, null);
|
||||
},
|
||||
addToDoc(obj, state) {
|
||||
body.appendChild(obj);
|
||||
},
|
||||
removeFromDoc(obj, state) {
|
||||
if (body.contains(obj))
|
||||
body.removeChild(obj);
|
||||
},
|
||||
// Set the proper type
|
||||
setType: function(obj, state) {
|
||||
if (state.expectedType) {
|
||||
state.badType = false;
|
||||
setAttr(obj, 'type', state.expectedType);
|
||||
forceReload(obj, state);
|
||||
}
|
||||
},
|
||||
setType(obj, state) {
|
||||
if (state.expectedType) {
|
||||
state.badType = false;
|
||||
setAttr(obj, "type", state.expectedType);
|
||||
forceReload(obj, state);
|
||||
}
|
||||
},
|
||||
// Set an improper type
|
||||
setWrongType: function(obj, state) {
|
||||
// This should break no-channel-plugins but nothing else
|
||||
state.badType = true;
|
||||
setAttr(obj, 'type', "application/x-unknown");
|
||||
forceReload(obj, state);
|
||||
},
|
||||
setWrongType(obj, state) {
|
||||
// This should break no-channel-plugins but nothing else
|
||||
state.badType = true;
|
||||
setAttr(obj, "type", "application/x-unknown");
|
||||
forceReload(obj, state);
|
||||
},
|
||||
// Set a plugin type
|
||||
setPluginType: function(obj, state) {
|
||||
// If an object/embed has a type set to a plugin type, it should not
|
||||
// use the channel type.
|
||||
state.badType = false;
|
||||
setAttr(obj, 'type', 'application/x-test');
|
||||
state.expectedType = "application/x-test";
|
||||
state.expectedMode = "plugin";
|
||||
forceReload(obj, state);
|
||||
},
|
||||
noChannel: function(obj, state) {
|
||||
src(obj, state, null);
|
||||
state.noChannel = true;
|
||||
state.pluginExtension = false;
|
||||
},
|
||||
displayNone: function(obj, state) {
|
||||
setDisplayed(obj, false);
|
||||
},
|
||||
displayInherit: function(obj, state) {
|
||||
setDisplayed(obj, true);
|
||||
}
|
||||
setPluginType(obj, state) {
|
||||
// If an object/embed has a type set to a plugin type, it should not
|
||||
// use the channel type.
|
||||
state.badType = false;
|
||||
setAttr(obj, "type", "application/x-test");
|
||||
state.expectedType = "application/x-test";
|
||||
state.expectedMode = "plugin";
|
||||
forceReload(obj, state);
|
||||
},
|
||||
noChannel(obj, state) {
|
||||
src(obj, state, null);
|
||||
state.noChannel = true;
|
||||
state.pluginExtension = false;
|
||||
},
|
||||
displayNone(obj, state) {
|
||||
setDisplayed(obj, false);
|
||||
},
|
||||
displayInherit(obj, state) {
|
||||
setDisplayed(obj, true);
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
|
@ -251,7 +251,7 @@
|
|||
let expectedMode = state.expectedMode;
|
||||
let actualMode = getMode(obj, state);
|
||||
|
||||
if (state.noChannel && !getAttr(obj, 'type')) {
|
||||
if (state.noChannel && !getAttr(obj, "type")) {
|
||||
// Some combinations of test both set no type and no channel. This is
|
||||
// worth testing with the various combinations, but shouldn't load.
|
||||
expectedMode = "none";
|
||||
|
@ -260,7 +260,7 @@
|
|||
// Embed tags should always try to load a plugin by type or extension
|
||||
// before falling back to opening a channel. See bug 803159
|
||||
if (state.tagName == "embed" &&
|
||||
(getAttr(obj, 'type') == "application/x-test" || state.pluginExtension)) {
|
||||
(getAttr(obj, "type") == "application/x-test" || state.pluginExtension)) {
|
||||
state.noChannel = true;
|
||||
}
|
||||
|
||||
|
@ -287,7 +287,7 @@
|
|||
|
||||
// Embeds with a plugin type should skip opening a channel prior to
|
||||
// loading, taking only type into account.
|
||||
if (state.tagName == 'embed' && getAttr(obj, 'type') == 'application/x-test' &&
|
||||
if (state.tagName == "embed" && getAttr(obj, "type") == "application/x-test" &&
|
||||
body.contains(obj)) {
|
||||
expectedMode = "plugin";
|
||||
}
|
||||
|
@ -318,7 +318,7 @@
|
|||
try {
|
||||
let x = obj.getObjectValue();
|
||||
scripted = true;
|
||||
} catch(e) {}
|
||||
} catch (e) {}
|
||||
is(scripted, shouldBeSpawnable, "check plugin scriptability");
|
||||
|
||||
// If this tag previously had other spawned plugins, make sure it
|
||||
|
@ -333,7 +333,7 @@
|
|||
didRespawn = true;
|
||||
}
|
||||
}
|
||||
is(didRespawn, true, "Plugin should have re-spawned since old state ("+state.oldPlugins.length+")");
|
||||
is(didRespawn, true, "Plugin should have re-spawned since old state (" + state.oldPlugins.length + ")");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -349,12 +349,11 @@
|
|||
// We don't spin the event loop between applying to_state and
|
||||
// running tests, so some types are still loading
|
||||
state.loading = true;
|
||||
info("["+(++total)+"] Testing [ " + from_state + " ] -> [ " + to_state + " ] / " + state.tagName + " / immediate");
|
||||
info("[" + (++total) + "] Testing [ " + from_state + " ] -> [ " + to_state + " ] / " + state.tagName + " / immediate");
|
||||
testObject(obj, state);
|
||||
|
||||
if (body.contains(obj))
|
||||
body.removeChild(obj);
|
||||
|
||||
},
|
||||
// Apply states, spin event loop, run tests.
|
||||
"cycle": function(obj, from_state, to_state, state) {
|
||||
|
@ -365,13 +364,15 @@
|
|||
// Because re-appending to the document creates a script blocker, but
|
||||
// plugins spawn asynchronously, we need to return to the event loop
|
||||
// twice to ensure the plugin has been given a chance to lazily spawn.
|
||||
runSoon(function() { runSoon(function() {
|
||||
info("["+(++total)+"] Testing [ " + from_state + " ] -> [ " + to_state + " ] / " + state.tagName + " / cycle");
|
||||
runSoon(function() {
|
||||
runSoon(function() {
|
||||
info("[" + (++total) + "] Testing [ " + from_state + " ] -> [ " + to_state + " ] / " + state.tagName + " / cycle");
|
||||
testObject(obj, state);
|
||||
|
||||
if (body.contains(obj))
|
||||
body.removeChild(obj);
|
||||
}); });
|
||||
});
|
||||
});
|
||||
},
|
||||
// Apply initial state, spin event loop, apply final state, spin event
|
||||
// loop again.
|
||||
|
@ -387,13 +388,15 @@
|
|||
// but plugins spawn asynchronously, we need to return to the event
|
||||
// loop twice to ensure the plugin has been given a chance to lazily
|
||||
// spawn.
|
||||
runSoon(function() { runSoon(function() {
|
||||
info("["+(++total)+"] Testing [ " + from_state + " ] -> [ " + to_state + " ] / " + state.tagName + " / cycleboth");
|
||||
runSoon(function() {
|
||||
runSoon(function() {
|
||||
info("[" + (++total) + "] Testing [ " + from_state + " ] -> [ " + to_state + " ] / " + state.tagName + " / cycleboth");
|
||||
testObject(obj, state);
|
||||
|
||||
if (body.contains(obj))
|
||||
body.removeChild(obj);
|
||||
}); });
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
// Apply initial state, spin event loop, apply later state, test
|
||||
|
@ -407,7 +410,7 @@
|
|||
for (let to of to_state) {
|
||||
states[to](obj, state);
|
||||
}
|
||||
info("["+(++total)+"] Testing [ " + from_state + " ] -> [ " + to_state + " ] / " + state.tagName + " / cyclefirst");
|
||||
info("[" + (++total) + "] Testing [ " + from_state + " ] -> [ " + to_state + " ] / " + state.tagName + " / cyclefirst");
|
||||
// We don't spin the event loop between applying to_state and
|
||||
// running tests, so some types are still loading
|
||||
state.loading = true;
|
||||
|
@ -421,11 +424,11 @@
|
|||
|
||||
function test(testdat) {
|
||||
// FIXME bug 1291854: Change back to lets when the test is fixed.
|
||||
for (var from_state of testdat['from_states']) {
|
||||
for (var to_state of testdat['to_states']) {
|
||||
for (var mode of testdat['test_modes']) {
|
||||
for (var type of testdat['tag_types']) {
|
||||
runSoon(function () {
|
||||
for (var from_state of testdat.from_states) {
|
||||
for (var to_state of testdat.to_states) {
|
||||
for (var mode of testdat.test_modes) {
|
||||
for (var type of testdat.tag_types) {
|
||||
runSoon(function() {
|
||||
let obj = document.createElement(type);
|
||||
obj.width = 1; obj.height = 1;
|
||||
let state = {};
|
||||
|
@ -438,10 +441,10 @@
|
|||
// prior to applying any attributes.
|
||||
// TODO when embed goes away we wont need to check for
|
||||
// QueryInterface any longer.
|
||||
var lookup_on = obj.QueryInterface ? obj.QueryInterface(OBJLC): obj;
|
||||
state.getDisplayedType = SpecialPowers.do_lookupGetter(lookup_on, 'displayedType');
|
||||
state.getHasRunningPlugin = SpecialPowers.do_lookupGetter(lookup_on, 'hasRunningPlugin');
|
||||
state.getActualType = SpecialPowers.do_lookupGetter(lookup_on, 'actualType');
|
||||
var lookup_on = obj.QueryInterface ? obj.QueryInterface(OBJLC) : obj;
|
||||
state.getDisplayedType = SpecialPowers.do_lookupGetter(lookup_on, "displayedType");
|
||||
state.getHasRunningPlugin = SpecialPowers.do_lookupGetter(lookup_on, "hasRunningPlugin");
|
||||
state.getActualType = SpecialPowers.do_lookupGetter(lookup_on, "actualType");
|
||||
test_modes[mode](obj, from_state, to_state, state);
|
||||
});
|
||||
}
|
||||
|
@ -453,57 +456,57 @@
|
|||
function onLoad() {
|
||||
// Generic tests
|
||||
test({
|
||||
'tag_types': [ 'embed', 'object' ],
|
||||
"tag_types": [ "embed", "object" ],
|
||||
// In all three modes
|
||||
'test_modes': [ 'immediate', 'cycle', 'cyclefirst', 'cycleboth' ],
|
||||
"test_modes": [ "immediate", "cycle", "cyclefirst", "cycleboth" ],
|
||||
// Starting from a blank tag in and out of the document, a loading
|
||||
// plugin, and no-channel plugin (initial types only really have
|
||||
// odd cases with plugins)
|
||||
'from_states': [
|
||||
[ 'addToDoc' ],
|
||||
[ 'plugin' ],
|
||||
[ 'plugin', 'addToDoc' ],
|
||||
[ 'plugin', 'noChannel', 'setType', 'addToDoc' ],
|
||||
"from_states": [
|
||||
[ "addToDoc" ],
|
||||
[ "plugin" ],
|
||||
[ "plugin", "addToDoc" ],
|
||||
[ "plugin", "noChannel", "setType", "addToDoc" ],
|
||||
[],
|
||||
],
|
||||
// To various combinations of loaded objects
|
||||
'to_states': eachList(
|
||||
[ 'svg', 'image', 'plugin', 'document', '' ],
|
||||
[ 'setType', 'setWrongType', 'setPluginType', '' ],
|
||||
[ 'noChannel', '' ],
|
||||
[ 'displayNone', 'displayInherit', '' ]
|
||||
"to_states": eachList(
|
||||
[ "svg", "image", "plugin", "document", "" ],
|
||||
[ "setType", "setWrongType", "setPluginType", "" ],
|
||||
[ "noChannel", "" ],
|
||||
[ "displayNone", "displayInherit", "" ]
|
||||
)});
|
||||
// Special case test for embed tags with plugin-by-extension
|
||||
// TODO object tags should be tested here too -- they have slightly
|
||||
// different behavior, but waiting on a file load requires a loaded
|
||||
// event handler and wont work with just our event loop spinning.
|
||||
test({
|
||||
'tag_types': [ 'embed' ],
|
||||
'test_modes': [ 'immediate', 'cyclefirst', 'cycle', 'cycleboth' ],
|
||||
'from_states': eachList(
|
||||
[ 'svg', 'plugin', 'image', 'document' ],
|
||||
[ 'addToDoc' ]
|
||||
"tag_types": [ "embed" ],
|
||||
"test_modes": [ "immediate", "cyclefirst", "cycle", "cycleboth" ],
|
||||
"from_states": eachList(
|
||||
[ "svg", "plugin", "image", "document" ],
|
||||
[ "addToDoc" ]
|
||||
),
|
||||
// Set extension along with valid ty
|
||||
'to_states': [
|
||||
[ 'pluginExtension' ]
|
||||
"to_states": [
|
||||
[ "pluginExtension" ],
|
||||
]});
|
||||
// Test plugin add/remove from document with adding/removing frame, with
|
||||
// and without a channel.
|
||||
test({
|
||||
'tag_types': [ 'embed', 'object' ], // Ideally we'd test object too, but this gets exponentially long.
|
||||
'test_modes': [ 'immediate', 'cyclefirst', 'cycle' ],
|
||||
'from_states': [ [ 'displayNone', 'plugin', 'addToDoc' ],
|
||||
[ 'displayNone', 'plugin', 'noChannel', 'addToDoc' ],
|
||||
[ 'plugin', 'noChannel', 'addToDoc' ],
|
||||
[ 'plugin', 'noChannel' ] ],
|
||||
'to_states': eachList(
|
||||
[ 'displayNone', '' ],
|
||||
[ 'removeFromDoc' ],
|
||||
[ 'image', 'displayNone', '' ],
|
||||
[ 'image', 'displayNone', '' ],
|
||||
[ 'addToDoc' ],
|
||||
[ 'displayInherit' ]
|
||||
"tag_types": [ "embed", "object" ], // Ideally we'd test object too, but this gets exponentially long.
|
||||
"test_modes": [ "immediate", "cyclefirst", "cycle" ],
|
||||
"from_states": [ [ "displayNone", "plugin", "addToDoc" ],
|
||||
[ "displayNone", "plugin", "noChannel", "addToDoc" ],
|
||||
[ "plugin", "noChannel", "addToDoc" ],
|
||||
[ "plugin", "noChannel" ] ],
|
||||
"to_states": eachList(
|
||||
[ "displayNone", "" ],
|
||||
[ "removeFromDoc" ],
|
||||
[ "image", "displayNone", "" ],
|
||||
[ "image", "displayNone", "" ],
|
||||
[ "addToDoc" ],
|
||||
[ "displayInherit" ]
|
||||
)});
|
||||
runWhenDone(() => SimpleTest.finish());
|
||||
}
|
||||
|
|
|
@ -68,8 +68,8 @@ function show() {
|
|||
}
|
||||
|
||||
function invalidate() {
|
||||
paintCountIs(clipped, 1, "partially clipped plugin painted once");
|
||||
|
||||
paintCountIs(clipped, 1, "partially clipped plugin painted once");
|
||||
|
||||
clipped.setColor("FF00FF00"); // plugin invalidates
|
||||
|
||||
waitForPaint(done);
|
||||
|
@ -78,7 +78,7 @@ function invalidate() {
|
|||
function done() {
|
||||
paintCountIs(clipped, 2, "painted after invalidate");
|
||||
|
||||
SimpleTest.finish();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
function waitForPaint(func) {
|
||||
|
|
|
@ -46,7 +46,7 @@ function scrollAround() {
|
|||
var paints = getPaintCounts();
|
||||
|
||||
for (var i = 0; i < paints.length; ++i) {
|
||||
isnot(paints[i], 0, "embed " + scrolling_plugins[i].id + " is painted");
|
||||
isnot(paints[i], 0, "embed " + scrolling_plugins[i].id + " is painted");
|
||||
}
|
||||
|
||||
last_paint_counts = paints;
|
||||
|
@ -70,7 +70,7 @@ function done() {
|
|||
for (var i = 0; i < paints.length; ++i) {
|
||||
is(paints[i], last_paint_counts[i], "embed " + scrolling_plugins[i].id + " is not painted on scroll");
|
||||
}
|
||||
SimpleTest.finish();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
// Waits for the paint_waiter plugin to be repainted and then
|
||||
|
@ -83,7 +83,7 @@ function waitForPaint(func) {
|
|||
|
||||
// Fiddle with the style in a way that should force some repainting
|
||||
paint_waiter.style.width =
|
||||
(paint_waiter.getBoundingClientRect().width + 1) + "px";
|
||||
(paint_waiter.getBoundingClientRect().width + 1) + "px";
|
||||
paint_waiter.style.height = "1px";
|
||||
|
||||
function waitForPaintHelper() {
|
||||
|
|
|
@ -22,7 +22,7 @@ Tests for plugin stream error conditions.
|
|||
</div>
|
||||
<div id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
////
|
||||
// //
|
||||
// These tests verify that nothing "bad" happens when a plugin returns an
|
||||
// error from one of the NPP_ stream functions. "Bad" is defined here
|
||||
// as the plugin being terminated, or NPP_ stream functions being
|
||||
|
@ -43,47 +43,47 @@ var tests = [
|
|||
"streammode": "normal",
|
||||
"functiontofail": "npp_newstream",
|
||||
"failurecode": "1",
|
||||
"frame": "testframe"
|
||||
"frame": "testframe",
|
||||
},
|
||||
{
|
||||
"src": "loremipsum.txt",
|
||||
"streammode": "normal",
|
||||
"functiontofail": "npp_newstream",
|
||||
"failurecode": "3",
|
||||
"frame": "testframe"
|
||||
"frame": "testframe",
|
||||
},
|
||||
{
|
||||
"src": "loremipsum.txt",
|
||||
"streammode": "normal",
|
||||
"functiontofail": "npp_newstream",
|
||||
"failurecode": "5",
|
||||
"frame": "testframe"
|
||||
"frame": "testframe",
|
||||
},
|
||||
{
|
||||
"geturl": "loremipsum.txt",
|
||||
"streammode": "normal",
|
||||
"functiontofail": "npp_newstream",
|
||||
"failurecode": "1",
|
||||
"frame": "testframe"
|
||||
"frame": "testframe",
|
||||
},
|
||||
{
|
||||
"src": "loremipsum.txt",
|
||||
"streammode": "normal",
|
||||
"functiontofail": "npp_write",
|
||||
"frame": "testframe"
|
||||
"frame": "testframe",
|
||||
},
|
||||
{
|
||||
"src": "loremipsum.txt",
|
||||
"streammode": "asfile",
|
||||
"functiontofail": "npp_write",
|
||||
"frame": "testframe"
|
||||
"frame": "testframe",
|
||||
},
|
||||
{
|
||||
"src": "loremipsum.txt",
|
||||
"streammode": "normal",
|
||||
"functiontofail": "npp_destroystream",
|
||||
"failurecode": "1",
|
||||
"frame": "testframe"
|
||||
"frame": "testframe",
|
||||
},
|
||||
];
|
||||
|
||||
|
|
|
@ -15,14 +15,14 @@
|
|||
function testDone() {
|
||||
--pending;
|
||||
if (0 == pending)
|
||||
SimpleTest.finish()
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
function runTests() {
|
||||
var p = document.getElementById('plugin1');
|
||||
var p2 = document.getElementById('plugin2');
|
||||
var p = document.getElementById("plugin1");
|
||||
var p2 = document.getElementById("plugin2");
|
||||
|
||||
ok(p.streamTest('plugin-stream-referer.sjs', false, null, null,
|
||||
ok(p.streamTest("plugin-stream-referer.sjs", false, null, null,
|
||||
function(r, t) {
|
||||
is(r, 0, "GET plugin-stream-referer.sjs");
|
||||
is(t, "Referer found: " + window.location,
|
||||
|
@ -30,14 +30,14 @@
|
|||
testDone();
|
||||
}, null, true), "referer GET");
|
||||
|
||||
ok(p.streamTest('plugin-stream-referer.sjs', true, "Dummy Data", null,
|
||||
ok(p.streamTest("plugin-stream-referer.sjs", true, "Dummy Data", null,
|
||||
function(r, t) {
|
||||
is(r, 0, "POST plugin-stream-referer.sjs");
|
||||
is(t, "No Referer found", "POST Referer absent");
|
||||
testDone();
|
||||
}, null, true), "referer POST");
|
||||
|
||||
ok(p2.streamTest('plugin-stream-referer.sjs', false, null, null,
|
||||
ok(p2.streamTest("plugin-stream-referer.sjs", false, null, null,
|
||||
function(r, t) {
|
||||
is(r, 0, "GET plugin-stream-referer.sjs (2)");
|
||||
var expectedreferer = String(window.location).replace("test_pluginstream_referer.html", "loremipsum.xtest");
|
||||
|
@ -45,7 +45,6 @@
|
|||
"GET Referer correct with plugin src");
|
||||
testDone();
|
||||
}, null, true), "referer GET (2)");
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
@ -30,13 +30,13 @@
|
|||
-->
|
||||
|
||||
<script type="text/javascript">
|
||||
var e = document.createElement('object');
|
||||
e.setAttribute('data', 'loremipsum.xtest');
|
||||
e.setAttribute('type', 'application/x-test');
|
||||
e.setAttribute('streammode', 'normal');
|
||||
e.setAttribute('streamchunksize', '100');
|
||||
e.setAttribute('frame', 'testframe');
|
||||
e.setAttribute('style', 'width: 400px; height: 100px;');
|
||||
var e = document.createElement("object");
|
||||
e.setAttribute("data", "loremipsum.xtest");
|
||||
e.setAttribute("type", "application/x-test");
|
||||
e.setAttribute("streammode", "normal");
|
||||
e.setAttribute("streamchunksize", "100");
|
||||
e.setAttribute("frame", "testframe");
|
||||
e.setAttribute("style", "width: 400px; height: 100px;");
|
||||
document.body.appendChild(e);
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
|
||||
|
||||
function frameLoaded() {
|
||||
var testframe = document.getElementById('pluginframe');
|
||||
var testframe = document.getElementById("pluginframe");
|
||||
// We have to use SpecialPowers because nptest.cpp prepends
|
||||
// data: whichs makes the frame cross origin with the including page.
|
||||
var wrappedDoc = SpecialPowers.wrap(testframe).contentDocument;
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
var p = null;
|
||||
|
||||
function startTest() {
|
||||
p = document.getElementById('theplugin');
|
||||
p = document.getElementById("theplugin");
|
||||
|
||||
// Wait for the plugin to have painted once
|
||||
var interval = setInterval(function() {
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
<script class="testbody" type="application/javascript">
|
||||
if (typeof Object.getPrototypeOf !== "function") {
|
||||
if (typeof "test".__proto__ === "object") {
|
||||
if (typeof"test".__proto__ === "object") {
|
||||
Object.getPrototypeOf = function(object) {
|
||||
return object.__proto__;
|
||||
};
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
}
|
||||
|
||||
function runTests() {
|
||||
p = document.getElementById('plugin1');
|
||||
p = document.getElementById("plugin1");
|
||||
|
||||
p.startWatchingInstanceCount();
|
||||
p.callOnDestroy(onDestroy);
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
var pending = 5;
|
||||
function testDone() {
|
||||
dump("testDone: " + pending + "\n")
|
||||
dump("testDone: " + pending + "\n");
|
||||
--pending;
|
||||
|
||||
// Wait for a bit so that any unexpected notifications from the
|
||||
|
@ -21,7 +21,7 @@
|
|||
}
|
||||
|
||||
function runTests() {
|
||||
var p = document.getElementById('plugin1');
|
||||
var p = document.getElementById("plugin1");
|
||||
|
||||
ok(p.streamTest("loremipsum.txt", false, null, null,
|
||||
function(r, t) {
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
var p = null;
|
||||
|
||||
function startTest() {
|
||||
p = document.getElementById('embedtest');
|
||||
p = document.getElementById("embedtest");
|
||||
ok(p.streamTest("neverending.sjs", false, null, null,
|
||||
function(r, t) {
|
||||
is(r, 2, "Stream should have failed");
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
function runTests() {
|
||||
try {
|
||||
var plugin = document.getElementById("plugin1");
|
||||
var badData = 'foo ' + '\x00'.repeat(260000);
|
||||
var badData = "foo " + "\x00".repeat(260000);
|
||||
var ret = plugin.echoString(badData);
|
||||
ok(true, "Did not crash.");
|
||||
is(ret, badData, "Returned string should equal what we passed in.");
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
didPaint = part2;
|
||||
|
||||
p.style.visibility = 'visible';
|
||||
p.style.visibility = "visible";
|
||||
}
|
||||
|
||||
function part2() {
|
||||
|
@ -44,7 +44,7 @@
|
|||
|
||||
didPaint = part3;
|
||||
|
||||
p.setColor('FF0000FF'); // this causes an invalidate/repaint
|
||||
p.setColor("FF0000FF"); // this causes an invalidate/repaint
|
||||
}
|
||||
|
||||
const kTimeout = 5000; // 5 seconds
|
||||
|
@ -59,7 +59,7 @@
|
|||
ok(false, "Plugin should not paint when it is invisible.");
|
||||
};
|
||||
|
||||
p.style.visibility = 'hidden';
|
||||
p.style.visibility = "hidden";
|
||||
|
||||
part4GiveUp = Date.now() + kTimeout;
|
||||
part4Interval = setInterval(part4, 100);
|
||||
|
@ -78,7 +78,7 @@
|
|||
clearInterval(part4Interval);
|
||||
|
||||
ok(true, "Plugin became invisible again.");
|
||||
p.setColor('FF00FF00');
|
||||
p.setColor("FF00FF00");
|
||||
setTimeout(SimpleTest.finish, 500);
|
||||
// wait to make sure we don't actually paint
|
||||
}
|
||||
|
@ -96,5 +96,5 @@
|
|||
<embed id="theplugin" class="hidden" type="application/x-test" drawmode="solid" color="FFFF0000" paintscript="inPaint()"></embed>
|
||||
|
||||
<script type="application/javascript">
|
||||
var p = document.getElementById('theplugin');
|
||||
var p = document.getElementById("theplugin");
|
||||
</script>
|
||||
|
|
|
@ -12,9 +12,9 @@
|
|||
SpecialPowers.setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
|
||||
|
||||
function runTests() {
|
||||
var p1 = document.getElementById('plugin1');
|
||||
var p2 = document.getElementById('plugin2');
|
||||
var p3 = document.getElementById('plugin3');
|
||||
var p1 = document.getElementById("plugin1");
|
||||
var p2 = document.getElementById("plugin2");
|
||||
var p3 = document.getElementById("plugin3");
|
||||
is(p1.hasWidget(), false, "Flash is always windowless mode even if wmode=window");
|
||||
is(p2.hasWidget(), false, "Flash is always windowless mode even if wmode=anything");
|
||||
is(p3.hasWidget(), false, "Flash is always windowless mode even if no wmode");
|
||||
|
|
|
@ -21,10 +21,10 @@ function runTests() {
|
|||
composition: {
|
||||
string: data,
|
||||
clauses: [
|
||||
{ length: data.length, attr: COMPOSITION_ATTR_RAW_CLAUSE }
|
||||
]
|
||||
{ length: data.length, attr: COMPOSITION_ATTR_RAW_CLAUSE },
|
||||
],
|
||||
},
|
||||
caret: {start: data.length, length: 0}
|
||||
caret: {start: data.length, length: 0},
|
||||
});
|
||||
is(plugin.getLastCompositionText(), data, "can get composition string");
|
||||
synthesizeComposition({ type: "compositioncommit", data: "" });
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
window.frameLoaded = function frameLoaded_toCrash() {
|
||||
SimpleTest.expectChildProcessCrash();
|
||||
|
||||
crashAndGetCrashServiceRecord("triggerXError", function (cm, crash) {
|
||||
crashAndGetCrashServiceRecord("triggerXError", function(cm, crash) {
|
||||
var isPluginCrash = crash.isOfType(cm.PROCESS_TYPE_PLUGIN, cm.CRASH_TYPE_CRASH);
|
||||
ok(isPluginCrash, "Record should be a plugin crash");
|
||||
if (!isPluginCrash) {
|
||||
|
@ -21,7 +21,6 @@
|
|||
}
|
||||
SimpleTest.finish();
|
||||
});
|
||||
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<iframe id="iframe1" src="crashing_subpage.html" width="600" height="600"></iframe>
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
var p = null;
|
||||
|
||||
function startTest() {
|
||||
p = document.getElementById('theplugin');
|
||||
p = document.getElementById("theplugin");
|
||||
if (!p.hasWidget()) {
|
||||
todo(false, "This test is only relevant for windowed plugins");
|
||||
SimpleTest.finish();
|
||||
|
@ -35,8 +35,8 @@
|
|||
function doTest() {
|
||||
is(p.getClipRegionRectCount(), 1, "getClipRegionRectCount should be a single rect");
|
||||
var dpr = window.devicePixelRatio;
|
||||
is(p.getClipRegionRectEdge(0,2) - p.getClipRegionRectEdge(0,0), 100 * dpr, "width of clip region rect");
|
||||
is(p.getClipRegionRectEdge(0,3) - p.getClipRegionRectEdge(0,1), 50 * dpr, "height of clip region rect");
|
||||
is(p.getClipRegionRectEdge(0, 2) - p.getClipRegionRectEdge(0, 0), 100 * dpr, "width of clip region rect");
|
||||
is(p.getClipRegionRectEdge(0, 3) - p.getClipRegionRectEdge(0, 1), 50 * dpr, "height of clip region rect");
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче