2012-10-02 00:33:26 +04:00
|
|
|
/* 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/. */
|
|
|
|
|
2017-04-27 13:53:38 +03:00
|
|
|
/* eslint-env mozilla/frame-script */
|
|
|
|
|
2018-01-30 02:20:18 +03:00
|
|
|
ChromeUtils.defineModuleGetter(this, "Logger",
|
2017-08-01 19:13:27 +03:00
|
|
|
"resource://gre/modules/accessibility/Utils.jsm");
|
2018-01-30 02:20:18 +03:00
|
|
|
ChromeUtils.defineModuleGetter(this, "Utils",
|
2017-08-01 19:13:27 +03:00
|
|
|
"resource://gre/modules/accessibility/Utils.jsm");
|
2018-01-30 02:20:18 +03:00
|
|
|
ChromeUtils.defineModuleGetter(this, "EventManager",
|
2017-08-01 19:13:27 +03:00
|
|
|
"resource://gre/modules/accessibility/EventManager.jsm");
|
2018-01-30 02:20:18 +03:00
|
|
|
ChromeUtils.defineModuleGetter(this, "ContentControl",
|
2017-08-01 19:13:27 +03:00
|
|
|
"resource://gre/modules/accessibility/ContentControl.jsm");
|
2018-01-30 02:20:18 +03:00
|
|
|
ChromeUtils.defineModuleGetter(this, "States",
|
2017-08-01 19:13:27 +03:00
|
|
|
"resource://gre/modules/accessibility/Constants.jsm");
|
|
|
|
|
|
|
|
Logger.info("content-script.js", content.document.location);
|
2012-10-02 00:33:26 +04:00
|
|
|
|
2018-07-27 15:19:00 +03:00
|
|
|
function onStop(m) {
|
|
|
|
Logger.debug("AccessFu:Stop");
|
2013-07-16 22:45:17 +04:00
|
|
|
|
2018-07-27 15:19:00 +03:00
|
|
|
removeMessageListener("AccessFu:Stop", onStop);
|
2013-07-16 22:45:17 +04:00
|
|
|
|
2018-07-27 15:19:00 +03:00
|
|
|
this._jsat_eventManager.stop();
|
|
|
|
this._jsat_contentControl.stop();
|
|
|
|
}
|
2014-02-11 22:41:02 +04:00
|
|
|
|
2018-07-27 15:19:00 +03:00
|
|
|
addMessageListener("AccessFu:Stop", onStop);
|
2014-02-11 22:41:02 +04:00
|
|
|
|
2018-07-27 15:19:00 +03:00
|
|
|
if (!this._jsat_contentControl) {
|
|
|
|
this._jsat_contentControl = new ContentControl(this);
|
2012-10-02 00:33:26 +04:00
|
|
|
}
|
2018-07-27 15:19:00 +03:00
|
|
|
this._jsat_contentControl.start();
|
2012-10-02 00:33:26 +04:00
|
|
|
|
2018-07-27 15:19:00 +03:00
|
|
|
if (!this._jsat_eventManager) {
|
|
|
|
this._jsat_eventManager = new EventManager(this);
|
2013-06-20 00:11:46 +04:00
|
|
|
}
|
2018-07-27 15:19:00 +03:00
|
|
|
this._jsat_eventManager.start();
|
|
|
|
|
|
|
|
function contentStarted() {
|
|
|
|
let accDoc = Utils.AccService.getAccessibleFor(content.document);
|
|
|
|
if (accDoc && !Utils.getState(accDoc).contains(States.BUSY)) {
|
|
|
|
sendAsyncMessage("AccessFu:ContentStarted");
|
|
|
|
} else {
|
|
|
|
content.setTimeout(contentStarted, 0);
|
2012-10-02 00:33:26 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-27 15:19:00 +03:00
|
|
|
if (Utils.inTest) {
|
|
|
|
// During a test we want to wait for the document to finish loading for
|
|
|
|
// consistency.
|
|
|
|
contentStarted();
|
|
|
|
}
|