Bug 1360166 - Clean up global handling for accessible/tests/. r=surkov
authorMark Banner <standard8@mozilla.com>
Thu, 27 Apr 2017 12:07:04 +0100
changeset 357216 e231df5f9506f3daa489361d5a05568d5e9d6ce0
parent 357215 c609f849afc68e60d2440decfb01d01f7ceb6a3e
child 357217 452b80f72738f9756af758039fe56559281eb222
push id31788
push userkwierso@gmail.com
push dateTue, 09 May 2017 20:48:49 +0000
treeherdermozilla-central@2b6f6881a24a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssurkov
bugs1360166
milestone55.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 1360166 - Clean up global handling for accessible/tests/. r=surkov Now that we inherit the recommended configurations, many definitions are handled semi-automatically. MozReview-Commit-ID: 1H2MXzk6VdQ
accessible/tests/browser/.eslintrc.js
accessible/tests/browser/e10s/browser_caching_attributes.js
accessible/tests/browser/e10s/browser_caching_description.js
accessible/tests/browser/e10s/browser_caching_name.js
accessible/tests/browser/e10s/browser_caching_relations.js
accessible/tests/browser/e10s/browser_caching_states.js
accessible/tests/browser/e10s/browser_caching_value.js
accessible/tests/browser/e10s/browser_events_caretmove.js
accessible/tests/browser/e10s/browser_events_hide.js
accessible/tests/browser/e10s/browser_events_show.js
accessible/tests/browser/e10s/browser_events_statechange.js
accessible/tests/browser/e10s/browser_events_textchange.js
accessible/tests/browser/e10s/browser_treeupdate_ariadialog.js
accessible/tests/browser/e10s/browser_treeupdate_ariaowns.js
accessible/tests/browser/e10s/browser_treeupdate_canvas.js
accessible/tests/browser/e10s/browser_treeupdate_cssoverflow.js
accessible/tests/browser/e10s/browser_treeupdate_doc.js
accessible/tests/browser/e10s/browser_treeupdate_gencontent.js
accessible/tests/browser/e10s/browser_treeupdate_hidden.js
accessible/tests/browser/e10s/browser_treeupdate_imagemap.js
accessible/tests/browser/e10s/browser_treeupdate_list.js
accessible/tests/browser/e10s/browser_treeupdate_list_editabledoc.js
accessible/tests/browser/e10s/browser_treeupdate_listener.js
accessible/tests/browser/e10s/browser_treeupdate_optgroup.js
accessible/tests/browser/e10s/browser_treeupdate_removal.js
accessible/tests/browser/e10s/browser_treeupdate_table.js
accessible/tests/browser/e10s/browser_treeupdate_textleaf.js
accessible/tests/browser/e10s/browser_treeupdate_visibility.js
accessible/tests/browser/e10s/browser_treeupdate_whitespace.js
accessible/tests/browser/e10s/events.js
accessible/tests/browser/e10s/head.js
accessible/tests/browser/head.js
accessible/tests/browser/shared-head.js
accessible/tests/mochitest/jsat/dom_helper.js
accessible/tests/mochitest/treeupdate/test_ariaowns.html
--- a/accessible/tests/browser/.eslintrc.js
+++ b/accessible/tests/browser/.eslintrc.js
@@ -1,60 +1,14 @@
 "use strict";
 
 module.exports = {
   "extends": [
     "plugin:mozilla/browser-test"
   ],
-  // All globals made available in the test environment.
-  "globals": {
-    // Content scripts have global 'content' object
-    "content": true,
-
-    "add_task": true,
-
-    // Defined in accessible/tests/mochitest/ common.js, name.js, states.js
-    "prettyName": true,
-    "statesToString": true,
-    "eventTypeToString": true,
-    "testAttrs": true,
-    "testAbsentAttrs": true,
-    "testName": true,
-    "testDescr": true,
-    "testStates": true,
-    "testRelation": true,
-    "testValue": true,
-    "testAccessibleTree": true,
-    "isAccessible": true,
-    "getAccessibleDOMNodeID": true,
-
-    // Defined for all top level accessibility browser tests.
-    "setE10sPrefs": true,
-    "unsetE10sPrefs": true,
-    "initPromise": true,
-    "shutdownPromise": true,
-    "forceGC": true,
-
-    // Defined for all e10s accessibility browser tests.
-    "addAccessibleTask": true,
-    "BrowserTestUtils": true,
-    "ContentTask": true,
-    "gBrowser": true,
-    "isDefunct": true,
-    "loadScripts": true,
-    "loadFrameScripts": true,
-    "Logger": true,
-    "MOCHITESTS_DIR": true,
-    "waitForEvent": true,
-    "waitForMultipleEvents": true,
-    "invokeSetAttribute": true,
-    "invokeSetStyle": true,
-    "invokeFocus": true,
-    "findAccessibleChildByID": true
-  },
   "rules": {
     "mozilla/no-aArgs": "error",
     "mozilla/no-cpows-in-tests": "error",
     "mozilla/reject-importGlobalProperties": "error",
     "mozilla/var-only-at-top-level": "error",
 
     "block-scoped-var": "error",
     "camelcase": "error",
--- a/accessible/tests/browser/e10s/browser_caching_attributes.js
+++ b/accessible/tests/browser/e10s/browser_caching_attributes.js
@@ -1,16 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 'use strict';
 
-/* global EVENT_FOCUS */
-
+/* import-globals-from ../../mochitest/attributes.js */
 loadScripts({ name: 'attributes.js', dir: MOCHITESTS_DIR });
 
 /**
  * Default textbox accessible attributes.
  */
 const defaultAttributes = {
   'margin-top': '0px',
   'margin-right': '0px',
--- a/accessible/tests/browser/e10s/browser_caching_description.js
+++ b/accessible/tests/browser/e10s/browser_caching_description.js
@@ -1,16 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 'use strict';
 
-/* global EVENT_DESCRIPTION_CHANGE, EVENT_NAME_CHANGE, EVENT_REORDER */
-
+/* import-globals-from ../../mochitest/name.js */
 loadScripts({ name: 'name.js', dir: MOCHITESTS_DIR });
 
 /**
  * Test data has the format of:
  * {
  *   desc      {String}   description for better logging
  *   expected  {String}   expected description value for a given accessible
  *   attrs     {?Array}   an optional list of attributes to update
--- a/accessible/tests/browser/e10s/browser_caching_name.js
+++ b/accessible/tests/browser/e10s/browser_caching_name.js
@@ -1,16 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 'use strict';
 
-/* global EVENT_REORDER, EVENT_TEXT_INSERTED */
-
+/* import-globals-from ../../mochitest/name.js */
 loadScripts({ name: 'name.js', dir: MOCHITESTS_DIR });
 
 /**
  * Rules for name tests that are inspired by
  *   accessible/tests/mochitest/name/markuprules.xul
  *
  * Each element in the list of rules represents a name calculation rule for a
  * particular test case.
--- a/accessible/tests/browser/e10s/browser_caching_relations.js
+++ b/accessible/tests/browser/e10s/browser_caching_relations.js
@@ -1,18 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 'use strict';
 
-/* global RELATION_LABELLED_BY, RELATION_LABEL_FOR, RELATION_DESCRIBED_BY,
-          RELATION_DESCRIPTION_FOR, RELATION_CONTROLLER_FOR,
-          RELATION_CONTROLLED_BY, RELATION_FLOWS_TO, RELATION_FLOWS_FROM */
-
+/* import-globals-from ../../mochitest/relations.js */
 loadScripts({ name: 'relations.js', dir: MOCHITESTS_DIR });
 
 /**
  * A test specification that has the following format:
  * [
  *   attr                 relevant aria attribute
  *   hostRelation         corresponding host relation type
  *   dependantRelation    corresponding dependant relation type
--- a/accessible/tests/browser/e10s/browser_caching_states.js
+++ b/accessible/tests/browser/e10s/browser_caching_states.js
@@ -1,17 +1,16 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 'use strict';
 
-/* global EVENT_STATE_CHANGE, STATE_CHECKED, STATE_BUSY, STATE_REQUIRED,
-          STATE_INVALID, EXT_STATE_ENABLED */
-
+/* import-globals-from ../../mochitest/role.js */
+/* import-globals-from ../../mochitest/states.js */
 loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR },
             { name: 'states.js', dir: MOCHITESTS_DIR });
 
 /**
  * Test data has the format of:
  * {
  *   desc      {String}   description for better logging
  *   expected  {Array}    expected states for a given accessible that have the
--- a/accessible/tests/browser/e10s/browser_caching_value.js
+++ b/accessible/tests/browser/e10s/browser_caching_value.js
@@ -1,16 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 'use strict';
 
-/* global nsIAccessibleValue, EVENT_VALUE_CHANGE, EVENT_TEXT_VALUE_CHANGE */
-
+/* import-globals-from ../../mochitest/value.js */
 loadScripts({ name: 'value.js', dir: MOCHITESTS_DIR });
 
 /**
  * Test data has the format of:
  * {
  *   desc      {String}       description for better logging
  *   id        {String}       given accessible DOMNode ID
  *   expected  {String}       expected value for a given accessible
--- a/accessible/tests/browser/e10s/browser_events_caretmove.js
+++ b/accessible/tests/browser/e10s/browser_events_caretmove.js
@@ -1,14 +1,12 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-/* global EVENT_TEXT_CARET_MOVED, nsIAccessibleCaretMoveEvent */
-
 'use strict';
 
 /**
  * Test caret move event and its interface:
  *   - caretOffset
  */
 addAccessibleTask('<input id="textbox" value="hello"/>', function*(browser) {
   let onCaretMoved = waitForEvent(EVENT_TEXT_CARET_MOVED, 'textbox');
--- a/accessible/tests/browser/e10s/browser_events_hide.js
+++ b/accessible/tests/browser/e10s/browser_events_hide.js
@@ -1,14 +1,12 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-/* global EVENT_HIDE */
-
 'use strict';
 
 /**
  * Test hide event and its interface:
  *   - targetParent
  *   - targetNextSibling
  *   - targetPrevSibling
  */
--- a/accessible/tests/browser/e10s/browser_events_show.js
+++ b/accessible/tests/browser/e10s/browser_events_show.js
@@ -1,14 +1,12 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-/* global EVENT_SHOW */
-
 'use strict';
 
 /**
  * Test show event
  */
 addAccessibleTask('<div id="div" style="visibility: hidden;"></div>',
   function*(browser) {
     let onShow = waitForEvent(EVENT_SHOW, 'div');
--- a/accessible/tests/browser/e10s/browser_events_statechange.js
+++ b/accessible/tests/browser/e10s/browser_events_statechange.js
@@ -1,17 +1,16 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-/* global STATE_CHECKED, EXT_STATE_EDITABLE, nsIAccessibleStateChangeEvent,
-          EVENT_STATE_CHANGE */
-
 'use strict';
 
+/* import-globals-from ../../mochitest/role.js */
+/* import-globals-from ../../mochitest/states.js */
 loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR },
             { name: 'states.js', dir: MOCHITESTS_DIR });
 
 function checkStateChangeEvent(event, state, isExtraState, isEnabled) {
   let scEvent = event.QueryInterface(nsIAccessibleStateChangeEvent);
   is(scEvent.state, state, 'Correct state of the statechange event.');
   is(scEvent.isExtraState, isExtraState,
     'Correct extra state bit of the statechange event.');
--- a/accessible/tests/browser/e10s/browser_events_textchange.js
+++ b/accessible/tests/browser/e10s/browser_events_textchange.js
@@ -1,15 +1,12 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-/* global EVENT_TEXT_INSERTED, EVENT_TEXT_REMOVED,
-          nsIAccessibleTextChangeEvent */
-
 'use strict';
 
 function checkTextChangeEvent(event, id, text, start, end, isInserted, isFromUserInput) {
   let tcEvent = event.QueryInterface(nsIAccessibleTextChangeEvent);
   is(tcEvent.start, start, `Correct start offset for ${prettyName(id)}`);
   is(tcEvent.length, end - start, `Correct length for ${prettyName(id)}`);
   is(tcEvent.isInserted, isInserted,
     `Correct isInserted flag for ${prettyName(id)}`);
--- a/accessible/tests/browser/e10s/browser_treeupdate_ariadialog.js
+++ b/accessible/tests/browser/e10s/browser_treeupdate_ariadialog.js
@@ -1,17 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 'use strict';
 
-/* global EVENT_SHOW, ROLE_DIALOG, ROLE_PUSHBUTTON, ROLE_TEXT_LEAF, ROLE_ENTRY,
-          ROLE_DOCUMENT */
-
+/* import-globals-from ../../mochitest/role.js */
 loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR });
 
 // Test ARIA Dialog
 addAccessibleTask('doc_treeupdate_ariadialog.html', function*(browser, accDoc) {
   testAccessibleTree(accDoc, {
     role: ROLE_DOCUMENT,
     children: [ ]
   });
--- a/accessible/tests/browser/e10s/browser_treeupdate_ariaowns.js
+++ b/accessible/tests/browser/e10s/browser_treeupdate_ariaowns.js
@@ -1,16 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 'use strict';
 
-/* global EVENT_REORDER */
-
+/* import-globals-from ../../mochitest/role.js */
 loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR });
 
 function* testContainer1(browser, accDoc) {
   const id = 't1_container';
   const docID = getAccessibleDOMNodeID(accDoc);
   const acc = findAccessibleChildByID(accDoc, id);
 
   /* ================= Initial tree test ==================================== */
--- a/accessible/tests/browser/e10s/browser_treeupdate_canvas.js
+++ b/accessible/tests/browser/e10s/browser_treeupdate_canvas.js
@@ -1,16 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 'use strict';
 
-/* global EVENT_SHOW */
-
+/* import-globals-from ../../mochitest/role.js */
 loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR });
 
 addAccessibleTask(`
   <canvas id="canvas">
     <div id="dialog" role="dialog" style="display: none;"></div>
   </canvas>`, function*(browser, accDoc) {
   let canvas = findAccessibleChildByID(accDoc, 'canvas');
   let dialog = findAccessibleChildByID(accDoc, 'dialog');
--- a/accessible/tests/browser/e10s/browser_treeupdate_cssoverflow.js
+++ b/accessible/tests/browser/e10s/browser_treeupdate_cssoverflow.js
@@ -1,16 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 'use strict';
 
-/* global EVENT_REORDER */
-
+/* import-globals-from ../../mochitest/role.js */
 loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR });
 
 addAccessibleTask(`
   <div id="container"><div id="scrollarea" style="overflow:auto;"><input>
   </div></div>
   <div id="container2"><div id="scrollarea2" style="overflow:hidden;">
   </div></div>`, function*(browser, accDoc) {
   const id1 = 'container';
--- a/accessible/tests/browser/e10s/browser_treeupdate_doc.js
+++ b/accessible/tests/browser/e10s/browser_treeupdate_doc.js
@@ -1,17 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 'use strict';
 
-/* global ROLE_PUSHBUTTON, ROLE_TEXT_LEAF, EVENT_REORDER, ROLE_DOCUMENT,
-          nsIAccessibleDocument */
-
+/* import-globals-from ../../mochitest/role.js */
 loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR });
 
 const iframeSrc = `data:text/html,
   <html>
     <head>
       <meta charset='utf-8'/>
       <title>Inner Iframe</title>
     </head>
--- a/accessible/tests/browser/e10s/browser_treeupdate_gencontent.js
+++ b/accessible/tests/browser/e10s/browser_treeupdate_gencontent.js
@@ -1,16 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 'use strict';
 
-/* global EVENT_REORDER */
-
+/* import-globals-from ../../mochitest/role.js */
 loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR });
 
 addAccessibleTask(`
   <style>
     .gentext:before {
       content: "START"
     }
     .gentext:after {
--- a/accessible/tests/browser/e10s/browser_treeupdate_hidden.js
+++ b/accessible/tests/browser/e10s/browser_treeupdate_hidden.js
@@ -1,16 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 'use strict';
 
-/* global EVENT_REORDER */
-
+/* import-globals-from ../../mochitest/role.js */
 loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR });
 
 function* setHidden(browser, value) {
   let onReorder = waitForEvent(EVENT_REORDER, 'container');
   yield invokeSetAttribute(browser, 'child', 'hidden', value);
   yield onReorder;
 }
 
--- a/accessible/tests/browser/e10s/browser_treeupdate_imagemap.js
+++ b/accessible/tests/browser/e10s/browser_treeupdate_imagemap.js
@@ -1,16 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 'use strict';
 
-/* global EVENT_REORDER, ROLE_LINK */
-
+/* import-globals-from ../../mochitest/role.js */
 loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR });
 
 function* testImageMap(browser, accDoc) {
   const id = 'imgmap';
   const acc = findAccessibleChildByID(accDoc, id);
 
   /* ================= Initial tree test ==================================== */
   let tree = {
--- a/accessible/tests/browser/e10s/browser_treeupdate_list.js
+++ b/accessible/tests/browser/e10s/browser_treeupdate_list.js
@@ -1,16 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 'use strict';
 
-/* global ROLE_TEXT_LEAF, EVENT_REORDER, ROLE_STATICTEXT, ROLE_LISTITEM */
-
+/* import-globals-from ../../mochitest/role.js */
 loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR });
 
 function* setDisplayAndWaitForReorder(browser, value) {
   let onReorder = waitForEvent(EVENT_REORDER, 'ul');
   yield invokeSetStyle(browser, 'li', 'display', value);
   return yield onReorder;
 }
 
--- a/accessible/tests/browser/e10s/browser_treeupdate_list_editabledoc.js
+++ b/accessible/tests/browser/e10s/browser_treeupdate_list_editabledoc.js
@@ -1,17 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 'use strict';
 
-/* global ROLE_TEXT_LEAF, EVENT_REORDER, ROLE_LISTITEM, ROLE_LIST,
-          ROLE_STATICTEXT */
-
+/* import-globals-from ../../mochitest/role.js */
 loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR });
 
 addAccessibleTask('<ol id="list"></ol>', function*(browser, accDoc) {
   let list = findAccessibleChildByID(accDoc, 'list');
 
   testAccessibleTree(list, {
     role: ROLE_LIST,
     children: [ ]
--- a/accessible/tests/browser/e10s/browser_treeupdate_listener.js
+++ b/accessible/tests/browser/e10s/browser_treeupdate_listener.js
@@ -1,16 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 'use strict';
 
-/* global EVENT_REORDER */
-
+/* import-globals-from ../../mochitest/role.js */
 loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR });
 
 addAccessibleTask('<span id="parent"><span id="child"></span></span>',
   function*(browser, accDoc) {
     is(findAccessibleChildByID(accDoc, 'parent'), null,
       'Check that parent is not accessible.');
     is(findAccessibleChildByID(accDoc, 'child'), null,
       'Check that child is not accessible.');
--- a/accessible/tests/browser/e10s/browser_treeupdate_optgroup.js
+++ b/accessible/tests/browser/e10s/browser_treeupdate_optgroup.js
@@ -1,16 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 'use strict';
 
-/* global EVENT_REORDER */
-
+/* import-globals-from ../../mochitest/role.js */
 loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR });
 
 addAccessibleTask('<select id="select"></select>', function*(browser, accDoc) {
   let select = findAccessibleChildByID(accDoc, 'select');
 
   let onEvent = waitForEvent(EVENT_REORDER, 'select');
   // Create a combobox with grouping and 2 standalone options
   yield ContentTask.spawn(browser, {}, () => {
--- a/accessible/tests/browser/e10s/browser_treeupdate_removal.js
+++ b/accessible/tests/browser/e10s/browser_treeupdate_removal.js
@@ -1,16 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 'use strict';
 
-/* global EVENT_REORDER */
-
+/* import-globals-from ../../mochitest/role.js */
 loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR });
 
 addAccessibleTask('doc_treeupdate_removal.xhtml', function*(browser, accDoc) {
   ok(isAccessible(findAccessibleChildByID(accDoc, 'the_table')),
     'table should be accessible');
 
   // Move the_table element into hidden subtree.
   let onReorder = waitForEvent(EVENT_REORDER, 'body');
--- a/accessible/tests/browser/e10s/browser_treeupdate_table.js
+++ b/accessible/tests/browser/e10s/browser_treeupdate_table.js
@@ -1,16 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 'use strict';
 
-/* global EVENT_REORDER */
-
+/* import-globals-from ../../mochitest/role.js */
 loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR });
 
 addAccessibleTask(`
   <table id="table">
     <tr>
       <td>cell1</td>
       <td>cell2</td>
     </tr>
--- a/accessible/tests/browser/e10s/browser_treeupdate_textleaf.js
+++ b/accessible/tests/browser/e10s/browser_treeupdate_textleaf.js
@@ -1,16 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 'use strict';
 
-/* global EVENT_REORDER, ROLE_TEXT_CONTAINER ROLE_PARAGRAPH, ROLE_TEXT_LEAF */
-
+/* import-globals-from ../../mochitest/role.js */
 loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR });
 
 function* removeTextData(browser, accessible, id, role) {
   let tree = {
     role: role,
     children: [ { role: ROLE_TEXT_LEAF, name: "text" } ]
   };
   testAccessibleTree(accessible, tree);
--- a/accessible/tests/browser/e10s/browser_treeupdate_visibility.js
+++ b/accessible/tests/browser/e10s/browser_treeupdate_visibility.js
@@ -1,16 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 'use strict';
 
-/* global EVENT_REORDER */
-
+/* import-globals-from ../../mochitest/role.js */
 loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR });
 
 function* testTreeOnHide(browser, accDoc, containerID, id, before, after) {
   let acc = findAccessibleChildByID(accDoc, containerID);
   testAccessibleTree(acc, before);
 
   let onReorder = waitForEvent(EVENT_REORDER, containerID);
   yield invokeSetStyle(browser, id, 'visibility', 'hidden');
--- a/accessible/tests/browser/e10s/browser_treeupdate_whitespace.js
+++ b/accessible/tests/browser/e10s/browser_treeupdate_whitespace.js
@@ -1,16 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 'use strict';
 
-/* global EVENT_REORDER */
-
+/* import-globals-from ../../mochitest/role.js */
 loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR });
 
 addAccessibleTask('doc_treeupdate_whitespace.html', function*(browser, accDoc) {
   let container1 = findAccessibleChildByID(accDoc, 'container1');
   let container2Parent = findAccessibleChildByID(accDoc, 'container2-parent');
 
   let tree = {
     SECTION: [
--- a/accessible/tests/browser/e10s/events.js
+++ b/accessible/tests/browser/e10s/events.js
@@ -1,16 +1,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 'use strict';
 
-/* global nsIAccessibleEvent, nsIAccessibleDocument,
-          nsIAccessibleStateChangeEvent, nsIAccessibleTextChangeEvent */
+// This is loaded by head.js, so has the same globals, hence we import the
+// globals from there.
+/* import-globals-from head.js */
 
 /* exported EVENT_REORDER, EVENT_SHOW, EVENT_TEXT_INSERTED, EVENT_TEXT_REMOVED,
             EVENT_DOCUMENT_LOAD_COMPLETE, EVENT_HIDE, EVENT_TEXT_CARET_MOVED,
             EVENT_DESCRIPTION_CHANGE, EVENT_NAME_CHANGE, EVENT_STATE_CHANGE,
             EVENT_VALUE_CHANGE, EVENT_TEXT_VALUE_CHANGE, EVENT_FOCUS,
             waitForEvent, waitForMultipleEvents */
 
 const EVENT_DOCUMENT_LOAD_COMPLETE = nsIAccessibleEvent.EVENT_DOCUMENT_LOAD_COMPLETE;
--- a/accessible/tests/browser/e10s/head.js
+++ b/accessible/tests/browser/e10s/head.js
@@ -1,19 +1,18 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 'use strict';
 
-/* global EVENT_DOCUMENT_LOAD_COMPLETE, CURRENT_CONTENT_DIR, loadFrameScripts */
-
-/* exported addAccessibleTask */
+/* exported addAccessibleTask, findAccessibleChildByID, isDefunct */
 
 // Load the shared-head file first.
+/* import-globals-from ../shared-head.js */
 Services.scriptloader.loadSubScript(
   'chrome://mochitests/content/browser/accessible/tests/browser/shared-head.js',
   this);
 
 /**
  * A wrapper around browser test add_task that triggers an accessible test task
  * as a new browser test task with given document, data URL or markup snippet.
  * @param  {String}             doc    URL (relative to current directory) or
@@ -74,11 +73,53 @@ function addAccessibleTask(doc, task) {
       Logger.log(`Actually remote browser: ${browser.isRemoteBrowser}`);
 
       let event = yield onDocLoad;
       yield task(browser, event.accessible);
     });
   });
 }
 
+/**
+ * Check if an accessible object has a defunct test.
+ * @param  {nsIAccessible}  accessible object to test defunct state for
+ * @return {Boolean}        flag indicating defunct state
+ */
+function isDefunct(accessible) {
+  let defunct = false;
+  try {
+    let extState = {};
+    accessible.getState({}, extState);
+    defunct = extState.value & Ci.nsIAccessibleStates.EXT_STATE_DEFUNCT;
+  } catch (x) {
+    defunct = true;
+  } finally {
+    if (defunct) {
+      Logger.log(`Defunct accessible: ${prettyName(accessible)}`);
+    }
+  }
+  return defunct;
+}
+
+/**
+ * Traverses the accessible tree starting from a given accessible as a root and
+ * looks for an accessible that matches based on its DOMNode id.
+ * @param  {nsIAccessible}  accessible root accessible
+ * @param  {String}         id         id to look up accessible for
+ * @return {nsIAccessible?}            found accessible if any
+ */
+function findAccessibleChildByID(accessible, id) {
+  if (getAccessibleDOMNodeID(accessible) === id) {
+    return accessible;
+  }
+  for (let i = 0; i < accessible.children.length; ++i) {
+    let found = findAccessibleChildByID(accessible.getChildAt(i), id);
+    if (found) {
+      return found;
+    }
+  }
+}
+
 // Loading and common.js from accessible/tests/mochitest/ for all tests, as
 // well as events.js.
+/* import-globals-from ../../mochitest/common.js */
+/* import-globals-from events.js */
 loadScripts({ name: 'common.js', dir: MOCHITESTS_DIR }, 'e10s/events.js');
--- a/accessible/tests/browser/head.js
+++ b/accessible/tests/browser/head.js
@@ -28,16 +28,17 @@ function setE10sPrefs() {
  */
 function unsetE10sPrefs() {
   return new Promise(resolve => {
     SpecialPowers.popPrefEnv(resolve);
   });
 }
 
 // Load the shared-head file first.
+/* import-globals-from shared-head.js */
 Services.scriptloader.loadSubScript(
   'chrome://mochitests/content/browser/accessible/tests/browser/shared-head.js',
   this);
 
 /**
  * Returns a promise that resolves when 'a11y-init-or-shutdown' event is fired.
  * @return {Promise} event promise evaluating to event's data
  */
--- a/accessible/tests/browser/shared-head.js
+++ b/accessible/tests/browser/shared-head.js
@@ -1,16 +1,16 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 'use strict';
 
-/* exported Logger, MOCHITESTS_DIR, isDefunct, invokeSetAttribute, invokeFocus,
-            invokeSetStyle, findAccessibleChildByID, getAccessibleDOMNodeID,
+/* exported Logger, MOCHITESTS_DIR, invokeSetAttribute, invokeFocus,
+            invokeSetStyle, getAccessibleDOMNodeID,
             CURRENT_CONTENT_DIR, loadScripts, loadFrameScripts, Cc, Cu */
 
 const { interfaces: Ci, utils: Cu, classes: Cc } = Components;
 
 /**
  * Current browser test directory path used to load subscripts.
  */
 const CURRENT_DIR =
@@ -73,37 +73,16 @@ let Logger = {
   logToAppConsole(msg) {
     if (this.dumpToAppConsole) {
       Services.console.logStringMessage(`${msg}`);
     }
   }
 };
 
 /**
- * Check if an accessible object has a defunct test.
- * @param  {nsIAccessible}  accessible object to test defunct state for
- * @return {Boolean}        flag indicating defunct state
- */
-function isDefunct(accessible) {
-  let defunct = false;
-  try {
-    let extState = {};
-    accessible.getState({}, extState);
-    defunct = extState.value & Ci.nsIAccessibleStates.EXT_STATE_DEFUNCT;
-  } catch (x) {
-    defunct = true;
-  } finally {
-    if (defunct) {
-      Logger.log(`Defunct accessible: ${prettyName(accessible)}`);
-    }
-  }
-  return defunct;
-}
-
-/**
  * Asynchronously set or remove content element's attribute (in content process
  * if e10s is enabled).
  * @param  {Object}  browser  current "tabbrowser" element
  * @param  {String}  id       content element id
  * @param  {String}  attr     attribute name
  * @param  {String?} value    optional attribute value, if not present, remove
  *                            attribute
  * @return {Promise}          promise indicating that attribute is set/removed
@@ -167,35 +146,16 @@ function invokeFocus(browser, id) {
         elm instanceof Ci.nsIDOMXULTextBoxElement) {
       elm.selectionStart = elm.selectionEnd = elm.value.length;
     }
     elm.focus();
   });
 }
 
 /**
- * Traverses the accessible tree starting from a given accessible as a root and
- * looks for an accessible that matches based on its DOMNode id.
- * @param  {nsIAccessible}  accessible root accessible
- * @param  {String}         id         id to look up accessible for
- * @return {nsIAccessible?}            found accessible if any
- */
-function findAccessibleChildByID(accessible, id) {
-  if (getAccessibleDOMNodeID(accessible) === id) {
-    return accessible;
-  }
-  for (let i = 0; i < accessible.children.length; ++i) {
-    let found = findAccessibleChildByID(accessible.getChildAt(i), id);
-    if (found) {
-      return found;
-    }
-  }
-}
-
-/**
  * Load a list of scripts into the test
  * @param {Array} scripts  a list of scripts to load
  */
 function loadScripts(...scripts) {
   for (let script of scripts) {
     let path = typeof script === 'string' ? `${CURRENT_DIR}${script}` :
       `${script.dir}${script.name}`;
     Services.scriptloader.loadSubScript(path, this);
--- a/accessible/tests/mochitest/jsat/dom_helper.js
+++ b/accessible/tests/mochitest/jsat/dom_helper.js
@@ -1,12 +1,10 @@
 'use strict';
 
-/* global getMainChromeWindow, AccessFuTest, GestureSettings, GestureTracker,
-   SimpleTest, getBoundsForDOMElm, Point, Utils */
 /* exported loadJSON, eventMap */
 
 var Ci = Components.interfaces;
 var Cu = Components.utils;
 
 Cu.import('resource://gre/modules/Geometry.jsm');
 
 var win = getMainChromeWindow(window);
--- a/accessible/tests/mochitest/treeupdate/test_ariaowns.html
+++ b/accessible/tests/mochitest/treeupdate/test_ariaowns.html
@@ -582,25 +582,26 @@
       this.eventSeq = [
         new invokerChecker(EVENT_SHOW, () => {
           let doc = getNode('t9_container').contentDocument;
           return doc && doc.getElementById('container');
         })
       ];
 
       this.invoke = () => {
-        getNode('t9_container').src =
-          `data:text/html,
-            <html><body></body>
-            <script>
-              let el = document.createElement('div');
-              el.id = 'container';
-              el.innerHTML = "<input id='input'>";
-              document.documentElement.appendChild(el);
-            </` + `script></html>`;
+        // The \ before the final /script avoids the script from being terminated
+        // by the html parser.
+        getNode('t9_container').src = `data:text/html,
+          <html><body></body>
+          <script>
+            let el = document.createElement('div');
+            el.id = 'container';
+            el.innerHTML = "<input id='input'>";
+            document.documentElement.appendChild(el);
+          <\/script></html>`;
       }
 
       this.finalCheck = () => {
         var tree =
           { INTERNAL_FRAME: [
             { DOCUMENT: [
               { SECTION: [
                 { ENTRY: [] }