layout/tools/recording/recording.js

Wed, 31 Dec 2014 06:55:46 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:46 +0100
changeset 1
ca08bd8f51b2
permissions
-rw-r--r--

Added tag TORBROWSER_REPLICA for changeset 6474c204b198

     1 /* -*- Mode: js; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- /
     2 /* vim: set shiftwidth=4 tabstop=8 autoindent cindent expandtab: */
     3 /* This Source Code Form is subject to the terms of the Mozilla Public
     4  * License, v. 2.0. If a copy of the MPL was not distributed with this
     5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     7 const CC = Components.classes;
     8 const CI = Components.interfaces;
    10 const NS_GFXINFO_CONTRACTID = "@mozilla.org/gfx/info;1";
    12 var gContainingWindow = null;
    14 var gBrowser;
    16 function OnDocumentLoad(evt) {
    17     if (evt.target != gBrowser.contentDocument || evt.target.location == "about:blank")
    18         return;
    19     gBrowser.removeEventListener("load", OnDocumentLoad, true);
    20     gContainingWindow.close();
    21 }
    23 this.OnRecordingLoad = function OnRecordingLoad(win) {
    24     if (win === undefined || win == null) {
    25         win = window;
    26     }
    27     if (gContainingWindow == null && win != null) {
    28         gContainingWindow = win;
    29     }
    31     gBrowser = gContainingWindow.document.getElementById("browser");
    33     var gfxInfo = (NS_GFXINFO_CONTRACTID in CC) && CC[NS_GFXINFO_CONTRACTID].getService(CI.nsIGfxInfo);
    34     var info = gfxInfo.getInfo();
    35     dump(info.AzureContentBackend + "\n");
    36     if (info.AzureContentBackend == "none") {
    37         alert("Page recordings may only be made with Azure content enabled.");
    38         gContainingWindow.close();
    39         return;
    40     }
    42     gBrowser.addEventListener("load", OnDocumentLoad, true);
    44     var args = window.arguments[0].wrappedJSObject;
    46     gBrowser.loadURI(args.uri);
    47 };

mercurial