Bug 1675349: Update tests under dom/html/test for the removal of plugins. r=jmathies
authorDavid Parks <daparks@mozilla.com>
Wed, 18 Nov 2020 15:57:45 +0000
changeset 557834 4d3ed7f582f503fb36d3eda50fcc55a3e1d8269e
parent 557833 b712e934ced5d0108dfb9bbf02ec93d61a256405
child 557835 bb1aa4e811e749e1a186d80cbd6ef386534f5b35
push id37962
push userapavel@mozilla.com
push dateWed, 18 Nov 2020 21:51:58 +0000
treeherdermozilla-central@9d797387f57c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmathies
bugs1675349, 1409805, 1330553
milestone85.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1675349: Update tests under dom/html/test for the removal of plugins. r=jmathies UPDATED ------- dom/html/test/test_object_plugin_nav.html Test focus behavior around <object> element. Rename to test_object_nav.html and switch to use image/png instead of application/x-test (test plugin) dom/html/test/test_fullscreen-api.html Test fullscreen, including in the context of a plugin. Remove plugin portion of test and the "skip" list that was added to allow headless/linux tests to skip only the plugin part due to bugs 1409805 and 1330553. REMOVED ------- dom/html/test/test_iframe_sandbox_plugins.html Test that `sandbox` attribute on iframe blocks/loads plugins correctly Differential Revision: https://phabricator.services.mozilla.com/D95909
dom/html/test/file_fullscreen-plugins.html
dom/html/test/file_iframe_sandbox_f_if1.html
dom/html/test/file_iframe_sandbox_f_if2.html
dom/html/test/file_iframe_sandbox_f_if2.html^headers^
dom/html/test/mochitest.ini
dom/html/test/test_fullscreen-api.html
dom/html/test/test_iframe_sandbox_plugins.html
dom/html/test/test_object_nav.html
dom/html/test/test_object_plugin_nav.html
deleted file mode 100644
--- a/dom/html/test/file_fullscreen-plugins.html
+++ /dev/null
@@ -1,162 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=545812
-
-Test plugins with DOM full-screen API:
-* Request for full-screen is denied when windowed plugin in current doc is present.
-* Request for full-screen is denied when windowed plugin in subdocument is present.
-* Request for full-screen is not denied when the only plugin present is windowless.
-* Adding an existing (out-of-doc) windowed plugin to a full-screen document causes document to exit full-screen.
-* Create windowed plugin and adding it to full-screen document caused exit from full-screen.
-* On non-Windows, plugins can only be windowless, so the presence of plugins
-  should have no effect on request for full-screen.
-
--->
-<head>
-  <title>Test for Bug 545812</title>
-  <script src="/tests/SimpleTest/EventUtils.js"></script>
-  <script src="/tests/SimpleTest/SimpleTest.js"></script>
-  <script type="application/javascript" src="plugin-utils.js"></script>
-  <script type="application/javascript">
-    setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
-  </script>
-  <script type="application/javascript" src="file_fullscreen-utils.js"></script>
-  <style>
-  body:fullscreen, div:fullscreen {
-    background-color: red;
-  }
-  </style>
-</head>
-<body>
-
-
-<!-- Windowed plugin, focusing should revoke full-screen. -->
-<embed id="windowed-plugin" type="application/x-test" style="width:200px;height:100px;" wmode="window"></embed>
-
-<!-- Windowless plugin, focusing should not revoke full-screen. -->
-<embed id="windowless-plugin" type="application/x-test" style="width:200px;height:100px;"></embed>
-
-
-<!-- iframe contents:
-
-<html><body><embed id='windowed-plugin' type='application/x-test' style='width:200px;height:100px;' wmode='window'></embed></body></html>
-
--->
-
-<iframe id="subdoc-plugin" srcdoc="<html><body><embed id='windowed-plugin' type='application/x-test' style='width:200px;height:100px;' wmode='window'></embed></body></html>"></iframe>
-
-<script type="application/javascript">
-
-/** Test for Bug 545812 **/
-
-function ok(condition, msg) {
-  opener.ok(condition, "[plugins] " + msg);
-}
-
-function is(a, b, msg) {
-  opener.is(a, b, "[plugins] " + msg);
-}
-
-function e(id) {
-  return document.getElementById(id);
-}
-
-function removeElement(element) {
-  element.remove();
-}
-
-const supportsWindowedMode = navigator.appVersion.includes("Windows");
-
-var windowedPlugin = null;
-
-function begin() {
-  // Delay test startup long enough for the windowed plugin in the subframe to
-  // start up and create its window.
-  opener.SimpleTest.executeSoon(function() {
-    opener.SimpleTest.executeSoon(function() {
-      startTest();
-    })
-  });
-}
-
-function startTest() {
-  ok(!document.fullscreenElement, "Should not be in full-screen mode initially");
-  document.body.requestFullscreen();
-
-  // Focus the windowed plugin. On non-Windows we should still enter
-  // full-screen mode, on Windows the pending request for full-screen should
-  // be denied.
-  e("windowed-plugin").focus();
-
-  if (!supportsWindowedMode) {
-    // If all plugins are effectively windowless, request for full-screen should be granted.
-    // Continue test in the "fullscreenchange" handler.
-    addFullscreenChangeContinuation("enter", windowlessFullScreenChange1);
-  } else {
-    // On Windows, request should be denied, carry on the test after receiving error event.
-    addFullscreenErrorContinuation(windowsTest);
-  }
-}
-
-function windowsTest() {
-  ok(!document.fullscreenElement, "Request for full-screen with focused windowed plugin should be denied.");
-
-  // Focus a regular html element, and re-request full-screen, request should be granted.
-  e("windowless-plugin").focus();
-  addFullscreenChangeContinuation("enter", windowsTest2);
-  document.body.requestFullscreen();
-}
-
-function windowsTest2() {
-  ok(document.fullscreenElement, "Request for full-screen with non-plugin focused should be granted.");
-  // Focus a windowed plugin, full-screen should be revoked.
-  addFullscreenChangeContinuation("exit", windowsTest3);
-  e("windowed-plugin").focus();
-}
-
-function windowsTest3() {
-  ok(!document.fullscreenElement, "Full-screen should have been revoked when windowed-plugin was focused.");
-  // Remove windowed plugins before closing the window
-  // to work around bug 1237853.
-  removeElement(e("windowed-plugin"));
-  removeElement(e("subdoc-plugin").contentDocument.getElementById("windowed-plugin"));
-  opener.nextTest();
-}
-
-var fullScreenChangeCount = 0;
-
-function createWindowedPlugin() {
-  var p = document.createElement("embed");
-  p.setAttribute("type", "application/x-test");
-  p.setAttribute("wmode", "window");
-  return p;
-}
-
-function windowlessFullScreenChange1(event) {
-  ok(document.fullscreenElement, "Requests for full-screen with focused windowed plugins should be granted on non-Windows");
-
-  // Create a new windowed plugin, and add that to the document. Should *not* exit full-screen mode on MacOS/Linux.
-  windowedPlugin = createWindowedPlugin();
-  document.body.appendChild(windowedPlugin);
-
-  // Focus windowed plugin. Should not exit full-screen mode on MacOS/Linux.
-  windowedPlugin.focus();
-
-  setTimeout(
-    function() {
-      ok(document.fullscreenElement, "Adding & focusing a windowed plugin to document should not cause full-screen to exit on MacOS/Linux.");
-      addFullscreenChangeContinuation("exit", windowlessFullScreenChange2);
-      document.exitFullscreen();
-    }, 0);
-}
-
-function windowlessFullScreenChange2(event) {
-  ok(!document.fullscreenElement, "Should have left full-screen mode after calling document.exitFullscreen().");
-  opener.nextTest();
-}
-
-</script>
-</pre>
-</body>
-</html>
deleted file mode 100644
--- a/dom/html/test/file_iframe_sandbox_f_if1.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
-  <meta charset="utf-8">
-  <title>Test for Bug 341604</title>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-</head>
-<body>
-I have 2 plugin instances embedded in me.
-<embed id="plugin1" type="application/x-test" width="200" height="200"></embed>
-<object type="application/x-test" width="200" height="200"></object>
-</body>
-</html>
deleted file mode 100644
--- a/dom/html/test/file_iframe_sandbox_f_if2.html
+++ /dev/null
@@ -1,11 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
-  <meta charset="utf-8">
-  <title>Test for Bug 341604</title>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-</head>
-<body>
-  I am a document that should be handled by a plugin load.
-</body>
-</html>
deleted file mode 100644
--- a/dom/html/test/file_iframe_sandbox_f_if2.html^headers^
+++ /dev/null
@@ -1,1 +0,0 @@
-Content-Type: application/x-test
--- a/dom/html/test/mochitest.ini
+++ b/dom/html/test/mochitest.ini
@@ -120,19 +120,16 @@ support-files =
   file_iframe_sandbox_e_if2.html
   file_iframe_sandbox_e_if3.html
   file_iframe_sandbox_e_if4.html
   file_iframe_sandbox_e_if5.html
   file_iframe_sandbox_e_if6.html
   file_iframe_sandbox_e_if7.html
   file_iframe_sandbox_e_if8.html
   file_iframe_sandbox_e_if9.html
-  file_iframe_sandbox_f_if1.html
-  file_iframe_sandbox_f_if2.html
-  file_iframe_sandbox_f_if2.html^headers^
   file_iframe_sandbox_fail.js
   file_iframe_sandbox_form_fail.html
   file_iframe_sandbox_form_pass.html
   file_iframe_sandbox_g_if1.html
   file_iframe_sandbox_h_if1.html
   file_iframe_sandbox_k_if1.html
   file_iframe_sandbox_k_if2.html
   file_iframe_sandbox_k_if3.html
@@ -455,17 +452,16 @@ support-files =
   file_fullscreen-featurePolicy-inner.html
   file_fullscreen-hidden.html
   file_fullscreen-lenient-setters.html
   file_fullscreen-multiple-inner.html
   file_fullscreen-multiple.html
   file_fullscreen-navigation.html
   file_fullscreen-nested.html
   file_fullscreen-prefixed.html
-  file_fullscreen-plugins.html
   file_fullscreen-rollback.html
   file_fullscreen-scrollbar.html
   file_fullscreen-selector.html
   file_fullscreen-shadowdom.html
   file_fullscreen-sub-iframe.html
   file_fullscreen-svg-element.html
   file_fullscreen-table.html
   file_fullscreen-top-layer.html
@@ -481,18 +477,16 @@ support-files =
 [test_iframe_sandbox_general.html]
 tags = openwindow
 [test_iframe_sandbox_inheritance.html]
 tags = openwindow
 [test_iframe_sandbox_navigation.html]
 tags = openwindow
 [test_iframe_sandbox_navigation2.html]
 tags = openwindow
-[test_iframe_sandbox_plugins.html]
-skip-if = (toolkit == 'android') || debug # plugins not supported on android, bug 1388764 for debug
 [test_iframe_sandbox_popups.html]
 tags = openwindow
 [test_iframe_sandbox_popups_inheritance.html]
 tags = openwindow
 [test_iframe_sandbox_redirect.html]
 [test_iframe_sandbox_refresh.html]
 [test_iframe_sandbox_same_origin.html]
 [test_iframe_sandbox_workers.html]
@@ -504,18 +498,18 @@ skip-if = fission
 [test_link_attributes_reflection.html]
 [test_link_sizes.html]
 [test_map_attributes_reflection.html]
 [test_meta_attributes_reflection.html]
 [test_mod_attributes_reflection.html]
 [test_named_options.html]
 [test_nested_invalid_fieldsets.html]
 [test_object_attributes_reflection.html]
-[test_object_plugin_nav.html]
-skip-if = (toolkit == 'android') || ((os == 'win' || os == 'linux') && debug) # plugins not supported on android, bug 1388764 for debug
+[test_object_nav.html]
+skip-if = ((os == 'win' || os == 'linux') && debug) # bug 1388764
 [test_ol_attributes_reflection.html]
 [test_option_defaultSelected.html]
 [test_option_selected_state.html]
 [test_param_attributes_reflection.html]
 [test_q_attributes_reflection.html]
 [test_restore_from_parser_fragment.html]
 [test_rowscollection.html]
 [test_srcdoc-2.html]
--- a/dom/html/test/test_fullscreen-api.html
+++ b/dom/html/test/test_fullscreen-api.html
@@ -30,17 +30,16 @@ SimpleTest.requestFlakyTimeout("untriage
 var gTestWindows = [
   { test: "file_fullscreen-multiple.html",
     prefs: [["full-screen-api.exit-on.windowRaise", false],
             ["full-screen-api.exit-on.windowOpen", false]] },
   { test: "file_fullscreen-rollback.html" },
   { test: "file_fullscreen-esc-exit.html" },
   { test: "file_fullscreen-denied.html" },
   { test: "file_fullscreen-api.html" },
-  { test: "file_fullscreen-plugins.html" },
   { test: "file_fullscreen-hidden.html" },
   { test: "file_fullscreen-svg-element.html" },
   { test: "file_fullscreen-navigation.html" },
   { test: "file_fullscreen-scrollbar.html" },
   { test: "file_fullscreen-selector.html" },
   { test: "file_fullscreen-shadowdom.html" },
   { test: "file_fullscreen-top-layer.html" },
   { test: "file_fullscreen-backdrop.html" },
@@ -71,93 +70,56 @@ function nextTest() {
       SimpleTest.executeSoon(runNextTest);
     }, {once: true});
     testWindow.close();
   } else {
     SimpleTest.executeSoon(runNextTest);
   }
 }
 
-var gHeadlessSkipList = [
-  { test: "file_fullscreen-plugins.html", reason: "bug 1409805" },
-];
-
-var gLinuxE10sSkipList = [
-  { "test": "file_fullscreen-plugins.html", "reason": "bug 1330553" },
-];
-
-function shouldSkipTest(test) {
-  function checkList(list) {
-    for (let item of list) {
-      if (item.test == test) {
-        todo(false, `${test} skipped due to ${item.reason}`);
-        return true;
-      }
-    }
-    return false;
-  }
-
-  if (SpecialPowers.Cc["@mozilla.org/gfx/info;1"].getService(SpecialPowers.Ci.nsIGfxInfo).isHeadless &&
-      checkList(gHeadlessSkipList)) {
-    return true;
-  }
-
-  if (!SpecialPowers.isMainProcess() &&
-      navigator.platform.includes('Linux') &&
-      checkList(gLinuxE10sSkipList)) {
-    return true;
-  }
-  return false;
-}
-
 function waitForEvent(eventTarget, eventName, checkFn, callback) {
   eventTarget.addEventListener(eventName, function listener(event) {
     if (checkFn && !checkFn(event)) {
       return;
     }
     eventTarget.removeEventListener(eventName, listener);
     callback();
   });
 }
 
 function runNextTest() {
   if (gTestIndex < gTestWindows.length) {
     let test = gTestWindows[gTestIndex];
-    if (shouldSkipTest(test.test)) {
-      info(`Skip test ${test.test}`);
-      SimpleTest.executeSoon(runNextTest);
-    } else {
-      let promise = ("prefs" in test)
-                      ? SpecialPowers.pushPrefEnv({"set": test.prefs})
-                      : Promise.resolve();
-      promise.then(function() {
-        info(`Run test ${test.test}`);
-        testWindow = window.open(test.test, "", "width=500,height=500,scrollbars=yes");
-        // We'll wait for the window to load, then make sure our window is refocused
-        // before starting the test, which will get kicked off on "focus".
-        // This ensures that we're essentially back on the primary "desktop" on
-        // OS X Lion before we run the test.
-        waitForLoadAndPaint(testWindow, function() {
-          SimpleTest.waitForFocus(function() {
-            info("Were focused");
-            // For the platforms that support reporting occlusion state (e.g. Mac),
-            // we should wait until the docshell has been activated again,
-            // otherwise, the fullscreen request might be denied.
-            if (testWindow.document.hidden) {
-              info("Waiting for document to unhide");
-              waitForEvent(testWindow.document, "visibilitychange", (event) => {
-                return !testWindow.document.hidden;
-              }, testWindow.begin);
-              return;
-            }
-            testWindow.begin();
-          }, testWindow);
-        });
+    let promise = ("prefs" in test)
+                    ? SpecialPowers.pushPrefEnv({"set": test.prefs})
+                    : Promise.resolve();
+    promise.then(function() {
+      info(`Run test ${test.test}`);
+      testWindow = window.open(test.test, "", "width=500,height=500,scrollbars=yes");
+      // We'll wait for the window to load, then make sure our window is refocused
+      // before starting the test, which will get kicked off on "focus".
+      // This ensures that we're essentially back on the primary "desktop" on
+      // OS X Lion before we run the test.
+      waitForLoadAndPaint(testWindow, function() {
+        SimpleTest.waitForFocus(function() {
+          info("Were focused");
+          // For the platforms that support reporting occlusion state (e.g. Mac),
+          // we should wait until the docshell has been activated again,
+          // otherwise, the fullscreen request might be denied.
+          if (testWindow.document.hidden) {
+            info("Waiting for document to unhide");
+            waitForEvent(testWindow.document, "visibilitychange", (event) => {
+              return !testWindow.document.hidden;
+            }, testWindow.begin);
+            return;
+          }
+          testWindow.begin();
+        }, testWindow);
       });
-    }
+    });
     gTestIndex++;
   } else {
     SimpleTest.finish();
   }
 }
 
 try {
   window.fullScreen = true;
deleted file mode 100644
--- a/dom/html/test/test_iframe_sandbox_plugins.html
+++ /dev/null
@@ -1,141 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=341604
-Implement HTML5 sandbox attribute for IFRAMEs
--->
-<head>
-  <meta charset="utf-8">
-  <title>Test for Bug 341604 - plugins</title>
-  <script src="/tests/SimpleTest/SimpleTest.js"></script>
-  <script type="application/javascript" src="plugin-utils.js"></script>
-  <script type="application/javascript">
-    setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
-  </script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-</head>
-<script type="application/javascript">
-/** Test for Bug 341604 - Implement HTML5 sandbox attribute for IFRAMEs **/
-/** Plugin tests **/
-SimpleTest.waitForExplicitFinish();
-
-function doTest() {
-  // 1) test that a plugin can't be loaded with <embed> inside a sandboxed <iframe>
-  // (done by file_iframe_sandbox_f_if1.html loaded in if1 below)
-  // 2) test that a plugin can't be loaded with <object> inside a sandboxed <iframe>
-  // (done by file_iframe_sandbox_f_if1.html loaded in if1 below)
-  // 3) test that plugin can't be loaded by a sandboxed <iframe> with src pointing to
-  // a document that is handled by a plugin (done by if_2 below)
-  // 4) test that when a plugin is loaded in an unsandboxed iframe, a sandbox attribute
-  // is then added to the iframe and the document containing the plugin is reloaded,
-  // the plugin does not load in the sandboxed iframe (done with if_3 below)
-  // 5) test that when when a sandboxed iframe's sandbox attribute is removed,
-  // and a new document is loaded into the iframe, the plugin loads
-  // (done with if_4 below)
-
-  // these are all handled by checking how many instances of the test plugin are loaded
-  // when this script runs as the onload handler - there should be two instances,
-  // initially the one loaded directly by this page itself, and the one loaded during
-  // test #4 above.
-  var p = document.getElementById('plugin1');
-  var if_1 = document.getElementById('if_1');
-  p.startWatchingInstanceCount();
-
-  if_1.src = 'file_iframe_sandbox_f_if1.html';
-}
-
-function if_1_load() {
-  var if_1 = document.getElementById('if_1');
-
-  if (if_1.src == "about:blank")
-    return;
-
-  // need to wait for plugin to load, if the test fails...
-  SimpleTest.executeSoon(if_1_continue);
-}
-
-function if_1_continue() {
-  // instance count should be 0 (tests #1 and #2 above)
-  var p = document.getElementById('plugin1');
-  is(p.getInstanceCount(), 0, "plugins should not be loaded via <object> or <embed> by a sandboxed iframe");
-
-  var if_2 = document.getElementById('if_2');
-  if_2.src = 'file_iframe_sandbox_f_if2.html';
-
-  SimpleTest.executeSoon(if_2_continue);
-}
-
-function if_2_continue() {
-  // instance count should be 0 (test #3 above)
-  var p = document.getElementById('plugin1');
-
-  is(p.getInstanceCount(), 0, "plugins should not be loaded via a document of a type that requires a plugin embedded in a sandboxed iframe");
-
-  SimpleTest.executeSoon(if_3_test);
-}
-
-function if_3_test() {
-  var if_3 = document.getElementById('if_3');
-  // add sandbox attribute
-  if_3.sandbox = '';
-  if_3.src = 'file_iframe_sandbox_f_if1.html';
-}
-
-function if_3_load() {
-  if (if_3.src == "about:blank")
-    return;
-
-  SimpleTest.executeSoon(if_3_continue);
-}
-
-function if_3_continue() {
-  var p = document.getElementById('plugin1');
-  is(p.getInstanceCount(), 0, "plugins should not be loaded when a sandbox attribute is added" +
-     "to an iframe and a document containing a plugin is then loaded into the iframe");
-
-  SimpleTest.executeSoon(if_4_test);
-}
-
-function if_4_test() {
-  var if_4 = document.getElementById('if_4');
-  // remove sandbox attribute
-  if_4.removeAttribute('sandbox');
-  if_4.src = 'file_iframe_sandbox_f_if1.html';
-}
-
-function if_4_load() {
-  if (if_4.src == "about:blank")
-    return;
-
-  SimpleTest.executeSoon(if_4_continue);
-}
-
-function if_4_continue() {
-  var p = document.getElementById('plugin1');
-  // there are 2 plugin instances in file_iframe_sandbox_if1.html loaded by
-  // if_1, they should successfully load.
-  is(p.getInstanceCount(), 2, "plugins should be loaded when a sandbox attribute is removed " +
-     "from an iframe and a document containing a plugin is then loaded into the iframe");
-
-  p.stopWatchingInstanceCount();
-  SimpleTest.executeSoon(finish_test);
-}
-
-function finish_test() {
-  SimpleTest.finish();
-}
-
-addLoadEvent(doTest);
-</script>
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=341604">Mozilla Bug 341604</a> - Implement HTML5 sandbox attribute for IFRAMEs
-<p id="display"></p>
-<div id="content">
-<embed id="plugin1" type="application/x-test" width="200" height="200"></embed>
-<iframe id="if_1" sandbox='allow-same-origin' onLoad='if_1_load()' src="about:blank" height="400" width="400"></iframe>
-<iframe id="if_2" sandbox='allow-same-origin' src="about:blank" height="400" width="400"></iframe>
-<iframe id="if_3" src="about:blank" onload='if_3_load()' height="400" width="400"></iframe>
-<iframe id="if_4" sandbox='allow-same-origin' onload='if_4_load()' src="about:blank" height="400" width="400"></iframe>
-</div>
-</body>
-</html>
rename from dom/html/test/test_object_plugin_nav.html
rename to dom/html/test/test_object_nav.html
--- a/dom/html/test/test_object_plugin_nav.html
+++ b/dom/html/test/test_object_nav.html
@@ -3,30 +3,29 @@
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=720130
 -->
 <head>
   <meta charset="utf-8">
   <title>Test for Bug 720130</title>
   <script src="/tests/SimpleTest/SimpleTest.js"></script>
   <script src="/tests/SimpleTest/EventUtils.js"></script>
-  <script type="application/javascript" src="plugin-utils.js"></script>
-  <script type="application/javascript">
-    setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
-  </script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=720130">Mozilla Bug 720130</a>
 <p id="display"></p>
 <div id="content">
   <input>
-  <object type="application/x-test"></object>
+  <object data="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAATklEQVRYhe3SIQ4AIBADwf7/04elBAtrVlSduGnSTDJ7cuT1PQJwwO+Hl7sAGAA07gjAAfgIBeAAoHFHAA7ARygABwCNOwJwAD5CATRgAYXh+kypw86nAAAAAElFTkSuQmCC"></object>
   <button>foo</button>
-  <object tabindex='0' type="application/x-test"></object>
+  <object type="application/x-shockwave-flash"></object>
+  <object tabindex='0' type="application/x-shockwave-flash"></object>
+  <object data="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAATklEQVRYhe3SIQ4AIBADwf7/04elBAtrVlSduGnSTDJ7cuT1PQJwwO+Hl7sAGAA07gjAAfgIBeAAoHFHAA7ARygABwCNOwJwAD5CATRgAYXh+kypw86nAAAAAElFTkSuQmCC"></object>
+  <object tabindex='0' data="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAATklEQVRYhe3SIQ4AIBADwf7/04elBAtrVlSduGnSTDJ7cuT1PQJwwO+Hl7sAGAA07gjAAfgIBeAAoHFHAA7ARygABwCNOwJwAD5CATRgAYXh+kypw86nAAAAAElFTkSuQmCC"></object>
 </div>
 <pre id="test">
 <script type="application/javascript">
 
 /** Test for Bug 720130 **/
 
 var gFocusCount = 0;
 var gFocusNb    = 4;
@@ -44,50 +43,49 @@ function checkFocus() {
       is(document.activeElement, document.getElementsByTagName('input')[0],
          "second focused element should be the text field");
       break;
     case 2:
       is(document.activeElement, document.getElementsByTagName('button')[0],
          "third focused element should be the button");
       break;
     case 3:
-      is(document.activeElement, document.getElementsByTagName('object')[1],
-         "fourth focused element should be the object");
+      ok(document.activeElement != document.getElementsByTagName('object')[1],
+         "fourth focused element should not be the plugin object");
+      ok(document.activeElement != document.getElementsByTagName('object')[2],
+         "fourth focused element should not be the plugin object with tabindex");
+      ok(document.activeElement != document.getElementsByTagName('object')[3],
+         "fourth focused element should not be the image object without tabindex");
+      is(document.activeElement, document.getElementsByTagName('object')[4],
+         "fourth focused element should be the image object with tabindex");
       break;
   }
 
   gFocusCount++;
 }
 
 SimpleTest.waitForExplicitFinish();
 
 function doTest() {
   is(document.activeElement, document.body);
 
   // Preliminary check: tabindex should be 0 on the object.
   is(document.getElementsByTagName('object')[0].tabIndex, 0,
-     "the plugin shouldn't get focus while navigating in the document");
+     "the element shouldn't get focus while navigating in the document");
 
   document.addEventListener("focus", function() {
     checkFocus();
 
     if (gFocusCount != gFocusNb) {
       synthesizeKey("KEY_Tab");
       return;
     }
 
     document.removeEventListener("focus", arguments.callee, true);
-
-    // Just make sure that .focus() still works.
-    var o = document.getElementsByTagName('object')[0];
-    o.onfocus = function() {
-      SimpleTest.finish();
-      o.onfocus = null;
-    };
-    o.focus();
+    SimpleTest.finish();
   }, true);
 
   synthesizeKey("KEY_Tab");
 }
 
 SimpleTest.waitForFocus(function () {
   // Set the focus model so that links are focusable by the tab key even on Mac
   SpecialPowers.pushPrefEnv({'set': [['accessibility.tabfocus', 7]]}, doTest);