diff options
author | Matt A. Tobin <email@mattatobin.com> | 2021-11-22 11:41:22 -0500 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2021-11-22 11:41:22 -0500 |
commit | 7572f6fb227f67f5f820019fe8afa899aa700862 (patch) | |
tree | 33e53aa11ae6107f5048f313a0e7b1e748baad0f /docshell/test/browser/file_bug422543_script.js | |
parent | 3bcef0ff65fa2ab6a482543afd1b1e00dd31cfee (diff) | |
download | aura-central-7572f6fb227f67f5f820019fe8afa899aa700862.tar.gz |
Issue %3005 - Move docshell/ to system/
Diffstat (limited to 'docshell/test/browser/file_bug422543_script.js')
-rw-r--r-- | docshell/test/browser/file_bug422543_script.js | 98 |
1 files changed, 0 insertions, 98 deletions
diff --git a/docshell/test/browser/file_bug422543_script.js b/docshell/test/browser/file_bug422543_script.js deleted file mode 100644 index cd69df1ec..000000000 --- a/docshell/test/browser/file_bug422543_script.js +++ /dev/null @@ -1,98 +0,0 @@ -const { utils: Cu, interfaces: Ci } = Components; -Cu.import("resource://gre/modules/XPCOMUtils.jsm"); - -function SHistoryListener() { -} - -SHistoryListener.prototype = { - retval: true, - last: "initial", - - OnHistoryNewEntry: function (aNewURI) { - this.last = "newentry"; - }, - - OnHistoryGoBack: function (aBackURI) { - this.last = "goback"; - return this.retval; - }, - - OnHistoryGoForward: function (aForwardURI) { - this.last = "goforward"; - return this.retval; - }, - - OnHistoryGotoIndex: function (aIndex, aGotoURI) { - this.last = "gotoindex"; - return this.retval; - }, - - OnHistoryPurge: function (aNumEntries) { - this.last = "purge"; - return this.retval; - }, - - OnHistoryReload: function (aReloadURI, aReloadFlags) { - this.last = "reload"; - return this.retval; - }, - - OnHistoryReplaceEntry: function (aIndex) {}, - - QueryInterface: XPCOMUtils.generateQI([Ci.nsISHistoryListener, - Ci.nsISupportsWeakReference]) -}; - -let testAPI = { - shistory: null, - listeners: [ new SHistoryListener(), - new SHistoryListener() ], - - init() { - this.shistory = docShell.QueryInterface(Ci.nsIWebNavigation).sessionHistory; - for (let listener of this.listeners) { - this.shistory.addSHistoryListener(listener); - } - }, - - cleanup() { - for (let listener of this.listeners) { - this.shistory.removeSHistoryListener(listener); - } - this.shistory = null; - sendAsyncMessage("bug422543:cleanup:return", {}); - }, - - getListenerStatus() { - sendAsyncMessage("bug422543:getListenerStatus:return", - this.listeners.map(l => l.last)); - }, - - resetListeners() { - for (let listener of this.listeners) { - listener.last = "initial"; - } - - sendAsyncMessage("bug422543:resetListeners:return", {}); - }, - - notifyReload() { - let internal = this.shistory.QueryInterface(Ci.nsISHistoryInternal); - let rval = - internal.notifyOnHistoryReload(content.document.documentURIObject, 0); - sendAsyncMessage("bug422543:notifyReload:return", { rval }); - }, - - setRetval({ num, val }) { - this.listeners[num].retval = val; - sendAsyncMessage("bug422543:setRetval:return", {}); - }, -}; - -addMessageListener("bug422543:cleanup", () => { testAPI.cleanup(); }); -addMessageListener("bug422543:getListenerStatus", () => { testAPI.getListenerStatus(); }); -addMessageListener("bug422543:notifyReload", () => { testAPI.notifyReload(); }); -addMessageListener("bug422543:resetListeners", () => { testAPI.resetListeners(); }); -addMessageListener("bug422543:setRetval", (msg) => { testAPI.setRetval(msg.data); }); - -testAPI.init(); |