summaryrefslogtreecommitdiffstats
path: root/application/basilisk/modules/HiddenFrame.jsm
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2018-02-02 05:06:10 -0500
committerMatt A. Tobin <email@mattatobin.com>2018-02-02 05:06:10 -0500
commit6d614170cbfa958564eb5f824234ad5a9e484344 (patch)
tree3e1eb384382f30987cb2e64bd654afa8b74fd06b /application/basilisk/modules/HiddenFrame.jsm
parent2a6b605d64b19411a300efdbbd7f78c349f90206 (diff)
downloadUXP-6d614170cbfa958564eb5f824234ad5a9e484344.tar
UXP-6d614170cbfa958564eb5f824234ad5a9e484344.tar.gz
UXP-6d614170cbfa958564eb5f824234ad5a9e484344.tar.lz
UXP-6d614170cbfa958564eb5f824234ad5a9e484344.tar.xz
UXP-6d614170cbfa958564eb5f824234ad5a9e484344.zip
Revert "Add Basilisk"
This reverts commit e72ef92b5bdc43cd2584198e2e54e951b70299e8.
Diffstat (limited to 'application/basilisk/modules/HiddenFrame.jsm')
-rw-r--r--application/basilisk/modules/HiddenFrame.jsm86
1 files changed, 0 insertions, 86 deletions
diff --git a/application/basilisk/modules/HiddenFrame.jsm b/application/basilisk/modules/HiddenFrame.jsm
deleted file mode 100644
index 207ffe9bf..000000000
--- a/application/basilisk/modules/HiddenFrame.jsm
+++ /dev/null
@@ -1,86 +0,0 @@
-/* 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";
-
-this.EXPORTED_SYMBOLS = ["HiddenFrame"];
-
-const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
-
-Cu.import("resource://gre/modules/PromiseUtils.jsm");
-Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/Timer.jsm");
-
-const HTML_NS = "http://www.w3.org/1999/xhtml";
-const XUL_PAGE = "data:application/vnd.mozilla.xul+xml;charset=utf-8,<window%20id='win'/>";
-
-/**
- * An hidden frame object. It takes care of creating an IFRAME and attaching it the
- * |hiddenDOMWindow|.
- */
-function HiddenFrame() {}
-
-HiddenFrame.prototype = {
- _frame: null,
- _deferred: null,
- _retryTimerId: null,
-
- get hiddenDOMDocument() {
- return Services.appShell.hiddenDOMWindow.document;
- },
-
- get isReady() {
- return this.hiddenDOMDocument.readyState === "complete";
- },
-
- /**
- * Gets the |contentWindow| of the hidden frame. Creates the frame if needed.
- * @returns Promise Returns a promise which is resolved when the hidden frame has finished
- * loading.
- */
- get() {
- if (!this._deferred) {
- this._deferred = PromiseUtils.defer();
- this._create();
- }
-
- return this._deferred.promise;
- },
-
- destroy() {
- clearTimeout(this._retryTimerId);
-
- if (this._frame) {
- if (!Cu.isDeadWrapper(this._frame)) {
- this._frame.removeEventListener("load", this, true);
- this._frame.remove();
- }
-
- this._frame = null;
- this._deferred = null;
- }
- },
-
- handleEvent() {
- let contentWindow = this._frame.contentWindow;
- if (contentWindow.location.href === XUL_PAGE) {
- this._frame.removeEventListener("load", this, true);
- this._deferred.resolve(contentWindow);
- } else {
- contentWindow.location = XUL_PAGE;
- }
- },
-
- _create() {
- if (this.isReady) {
- let doc = this.hiddenDOMDocument;
- this._frame = doc.createElementNS(HTML_NS, "iframe");
- this._frame.addEventListener("load", this, true);
- doc.documentElement.appendChild(this._frame);
- } else {
- // Check again if |hiddenDOMDocument| is ready as soon as possible.
- this._retryTimerId = setTimeout(this._create.bind(this), 0);
- }
- }
-};