Example #1
0
    return new Promise(resolve => {
      const flags = "chrome,centerscreen,resizable,dialog=no";
      const win = Services.ww.openWindow(null, this.WINDOW_URL, "_blank",
                                      flags, null);

      const frameLoad = () => {
        win.removeEventListener("load", frameLoad, true);
        win.focus();

        this.frame = createDevToolsFrame(win.document, "devtools-toolbox-window-iframe");
        win.document.getElementById("devtools-toolbox-window").appendChild(this.frame);

        // The forceOwnRefreshDriver attribute is set to avoid Windows only issues with
        // CSS transitions when switching from docked to window hosts.
        // Added in Bug 832920, should be reviewed in Bug 1542468.
        this.frame.setAttribute("forceOwnRefreshDriver", "");

        this.frame.setAttribute("src", "about:blank");
        resolve(this.frame);
      };

      win.addEventListener("load", frameLoad, true);
      win.addEventListener("unload", this._boundUnload);

      this._window = win;
    });
Example #2
0
  create: function () {
    let deferred = defer();

    let flags = "chrome,centerscreen,resizable,dialog=no";
    let win = Services.ww.openWindow(null, this.WINDOW_URL, "_blank",
                                     flags, null);

    let frameLoad = () => {
      win.removeEventListener("load", frameLoad, true);
      win.focus();

      let key;
      if (system.constants.platform === "macosx") {
        key = win.document.getElementById("toolbox-key-toggle-osx");
      } else {
        key = win.document.getElementById("toolbox-key-toggle");
      }
      key.removeAttribute("disabled");

      this.frame = win.document.getElementById("toolbox-iframe");
      this.emit("ready", this.frame);

      deferred.resolve(this.frame);
    };

    win.addEventListener("load", frameLoad, true);
    win.addEventListener("unload", this._boundUnload);

    this._window = win;

    return deferred.promise;
  },
function ContentProcessTargetActor(connection) {
  this.conn = connection;
  this._contextPool = new ActorPool(this.conn);
  this.conn.addActorPool(this._contextPool);
  this.threadActor = null;

  // Use a see-everything debugger
  this.makeDebugger = makeDebugger.bind(null, {
    findDebuggees: dbg => dbg.findAllGlobals(),
    shouldAddNewGlobalAsDebuggee: global => true
  });

  const sandboxPrototype = {
    get tabs() {
      return Array.from(Services.ww.getWindowEnumerator(),
                        win => win.docShell.messageManager);
    },
  };

  // Scope into which the webconsole executes:
  // A sandbox with chrome privileges with a `tabs` getter.
  const systemPrincipal = Cc["@mozilla.org/systemprincipal;1"]
    .createInstance(Ci.nsIPrincipal);
  const sandbox = Cu.Sandbox(systemPrincipal, {
    sandboxPrototype,
    wantGlobalProperties: ["ChromeUtils"],
  });
  this._consoleScope = sandbox;

  this._workerList = null;
  this._workerTargetActorPool = null;
  this._onWorkerListChanged = this._onWorkerListChanged.bind(this);
}
Example #4
0
ChromeActor.prototype._attach = function () {
  if (this.attached) {
    return false;
  }

  TabActor.prototype._attach.call(this);

  // Listen for any new/destroyed chrome docshell
  Services.obs.addObserver(this, "chrome-webnavigation-create");
  Services.obs.addObserver(this, "chrome-webnavigation-destroy");

  // Iterate over all top-level windows.
  let e = Services.ww.getWindowEnumerator();
  while (e.hasMoreElements()) {
    let window = e.getNext();
    let docShell = window.QueryInterface(Ci.nsIInterfaceRequestor)
                         .getInterface(Ci.nsIWebNavigation)
                         .QueryInterface(Ci.nsIDocShell);
    if (docShell == this.docShell) {
      continue;
    }
    this._progressListener.watch(docShell);
  }
  return undefined;
};
 openWebIDE: function () {
   let win = Services.wm.getMostRecentWindow("devtools:webide");
   if (win) {
     win.focus();
   } else {
     Services.ww.openWindow(null, "chrome://webide/content/", "webide", "chrome,centerscreen,resizable", null);
   }
 },
Example #6
0
webExtensionTargetPrototype._searchForExtensionWindow = function() {
  for (const window of Services.ww.getWindowEnumerator(null)) {
    if (window.document.nodePrincipal.addonId == this.addonId) {
      return window;
    }
  }

  return this._searchFallbackWindow();
};
  get: function() {
    // Iterate over all top-level windows and all their docshells.
    let docShells = [];
    for (const {docShell} of Services.ww.getWindowEnumerator()) {
      docShells = docShells.concat(getChildDocShells(docShell));
    }

    return docShells;
  }
Example #8
0
  get: function() {
    // Iterate over all top-level windows and all their docshells.
    let docShells = [];
    const e = Services.ww.getWindowEnumerator();
    while (e.hasMoreElements()) {
      const window = e.getNext();
      const docShell = window.docShell;
      docShells = docShells.concat(getChildDocShells(docShell));
    }

    return docShells;
  }
Example #9
0
    async function openWindow(t) {
      const win = Services.ww.openWindow(null, Tools.webConsole.url,
                                       "_blank", BC_WINDOW_FEATURES, null);

      await new Promise(resolve => {
        win.addEventListener("DOMContentLoaded", resolve, {once: true});
      });

      win.document.title = l10n.getStr("browserConsole.title");

      return {iframeWindow: win, chromeWindow: win};
    }
Example #10
0
  get: function () {
    // Iterate over all top-level windows and all their docshells.
    let docShells = [];
    let e = Services.ww.getWindowEnumerator();
    while (e.hasMoreElements()) {
      let window = e.getNext();
      let docShell = window.QueryInterface(Ci.nsIInterfaceRequestor)
                           .getInterface(Ci.nsIWebNavigation)
                           .QueryInterface(Ci.nsIDocShell);
      docShells = docShells.concat(getChildDocShells(docShell));
    }

    return docShells;
  }
Example #11
0
 function openWindow(aTarget)
 {
   target = aTarget;
   let deferred = defer();
   // Using the old frontend for now in the browser console.  This can be switched to
   // Tools.webConsole.url to use whatever is preffed on.
   let url = Tools.webConsole.oldWebConsoleURL;
   let win = Services.ww.openWindow(null, url, "_blank",
                                    BROWSER_CONSOLE_WINDOW_FEATURES, null);
   win.addEventListener("DOMContentLoaded", function () {
       win.document.title = l10n.getStr("browserConsole.title");
     deferred.resolve(win);
   }, {once: true});
   return deferred.promise;
 }
Example #12
0
    return new Promise(resolve => {
      const flags = "chrome,centerscreen,resizable,dialog=no";
      const win = Services.ww.openWindow(null, this.WINDOW_URL, "_blank",
                                      flags, null);

      const frameLoad = () => {
        win.removeEventListener("load", frameLoad, true);
        win.focus();

        this.frame = win.document.getElementById("toolbox-iframe");
        this.emit("ready", this.frame);
        resolve(this.frame);
      };

      win.addEventListener("load", frameLoad, true);
      win.addEventListener("unload", this._boundUnload);

      this._window = win;
    });
Example #13
0
parentProcessTargetPrototype._detach = function() {
  if (!this.attached) {
    return false;
  }

  Services.obs.removeObserver(this, "chrome-webnavigation-create");
  Services.obs.removeObserver(this, "chrome-webnavigation-destroy");

  // Iterate over all top-level windows.
  for (const {docShell} of Services.ww.getWindowEnumerator()) {
    if (docShell == this.docShell) {
      continue;
    }
    this._progressListener.unwatch(docShell);
  }

  BrowsingContextTargetActor.prototype._detach.call(this);
  return undefined;
};
Example #14
0
function ContentProcessTargetActor(connection) {
  this.conn = connection;
  this._contextPool = new ActorPool(this.conn);
  this.conn.addActorPool(this._contextPool);
  this.threadActor = null;

  // Use a see-everything debugger
  this.makeDebugger = makeDebugger.bind(null, {
    findDebuggees: dbg => dbg.findAllGlobals(),
    shouldAddNewGlobalAsDebuggee: global => true
  });

  const sandboxPrototype = {
    get tabs() {
      const tabs = [];
      const windowEnumerator = Services.ww.getWindowEnumerator();
      while (windowEnumerator.hasMoreElements()) {
        const window = windowEnumerator.getNext().QueryInterface(Ci.nsIDOMWindow);
        const tabChildGlobal = window.QueryInterface(Ci.nsIInterfaceRequestor)
                                     .getInterface(Ci.nsIDocShell)
                                     .sameTypeRootTreeItem
                                     .QueryInterface(Ci.nsIInterfaceRequestor)
                                     .getInterface(Ci.nsIContentFrameMessageManager);
        tabs.push(tabChildGlobal);
      }
      return tabs;
    },
  };

  // Scope into which the webconsole executes:
  // A sandbox with chrome privileges with a `tabs` getter.
  const systemPrincipal = Cc["@mozilla.org/systemprincipal;1"]
    .createInstance(Ci.nsIPrincipal);
  const sandbox = Cu.Sandbox(systemPrincipal, {
    sandboxPrototype,
  });
  this._consoleScope = sandbox;

  this._workerList = null;
  this._workerTargetActorPool = null;
  this._onWorkerListChanged = this._onWorkerListChanged.bind(this);
}
Example #15
0
    function openWindow(aTarget)
    {
      target = aTarget;

      let deferred = promise.defer();

      let win = Services.ww.openWindow(null, Tools.webConsole.url, "_blank",
                                       BROWSER_CONSOLE_WINDOW_FEATURES, null);
      win.addEventListener("DOMContentLoaded", function onLoad() {
        win.removeEventListener("DOMContentLoaded", onLoad);

        // Set the correct Browser Console title.
        let root = win.document.documentElement;
        root.setAttribute("title", root.getAttribute("browserConsoleTitle"));

        deferred.resolve(win);
      });

      return deferred.promise;
    }
Example #16
0
var openWebIDE = async function({ autoInstallAddons, showDeprecationMessage } = {}) {
  info("opening WebIDE");

  Services.prefs.setBoolPref("devtools.webide.autoinstallADBExtension", !!autoInstallAddons);
  Services.prefs.setBoolPref("devtools.webide.showDeprecationMessage", !!showDeprecationMessage);

  const win = Services.ww.openWindow(null, "chrome://webide/content/", "webide",
                                   "chrome,centerscreen,resizable", null);

  await new Promise(resolve => {
    win.addEventListener("load", function() {
      SimpleTest.requestCompleteLog();
      SimpleTest.executeSoon(resolve);
    }, {once: true});
  });

  info("WebIDE open");

  return win;
};
Example #17
0
parentProcessTargetPrototype._attach = function() {
  if (this.attached) {
    return false;
  }

  BrowsingContextTargetActor.prototype._attach.call(this);

  // Listen for any new/destroyed chrome docshell
  Services.obs.addObserver(this, "chrome-webnavigation-create");
  Services.obs.addObserver(this, "chrome-webnavigation-destroy");

  // Iterate over all top-level windows.
  const e = Services.ww.getWindowEnumerator();
  while (e.hasMoreElements()) {
    const window = e.getNext();
    const docShell = window.docShell;
    if (docShell == this.docShell) {
      continue;
    }
    this._progressListener.watch(docShell);
  }
  return undefined;
};
Example #18
0
   // Used by browser-sets.inc, command
  openConnectScreen(gBrowser) {
    gBrowser.selectedTab = gBrowser.addTab("chrome://devtools/content/framework/connect/connect.xhtml");
  },

  /**
   * Open WebIDE
   */
   // Used by browser-sets.inc, command
   //         itself, webide widget
  openWebIDE() {
    const win = Services.wm.getMostRecentWindow("devtools:webide");
    if (win) {
      win.focus();
    } else {
      Services.ww.openWindow(null, "chrome://webide/content/", "webide", "chrome,centerscreen,resizable", null);
    }
  },

  _getContentProcessTarget(processId) {
    // Create a DebuggerServer in order to connect locally to it
    DebuggerServer.init();
    DebuggerServer.registerAllActors();
    DebuggerServer.allowChromeProcess = true;

    const transport = DebuggerServer.connectPipe();
    const client = new DebuggerClient(transport);

    return new Promise(resolve => {
      client.connect().then(() => {
        client.getProcess(processId)