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