1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/tools/recording/recording.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,47 @@ 1.4 +/* -*- Mode: js; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- / 1.5 +/* vim: set shiftwidth=4 tabstop=8 autoindent cindent expandtab: */ 1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +const CC = Components.classes; 1.11 +const CI = Components.interfaces; 1.12 + 1.13 +const NS_GFXINFO_CONTRACTID = "@mozilla.org/gfx/info;1"; 1.14 + 1.15 +var gContainingWindow = null; 1.16 + 1.17 +var gBrowser; 1.18 + 1.19 +function OnDocumentLoad(evt) { 1.20 + if (evt.target != gBrowser.contentDocument || evt.target.location == "about:blank") 1.21 + return; 1.22 + gBrowser.removeEventListener("load", OnDocumentLoad, true); 1.23 + gContainingWindow.close(); 1.24 +} 1.25 + 1.26 +this.OnRecordingLoad = function OnRecordingLoad(win) { 1.27 + if (win === undefined || win == null) { 1.28 + win = window; 1.29 + } 1.30 + if (gContainingWindow == null && win != null) { 1.31 + gContainingWindow = win; 1.32 + } 1.33 + 1.34 + gBrowser = gContainingWindow.document.getElementById("browser"); 1.35 + 1.36 + var gfxInfo = (NS_GFXINFO_CONTRACTID in CC) && CC[NS_GFXINFO_CONTRACTID].getService(CI.nsIGfxInfo); 1.37 + var info = gfxInfo.getInfo(); 1.38 + dump(info.AzureContentBackend + "\n"); 1.39 + if (info.AzureContentBackend == "none") { 1.40 + alert("Page recordings may only be made with Azure content enabled."); 1.41 + gContainingWindow.close(); 1.42 + return; 1.43 + } 1.44 + 1.45 + gBrowser.addEventListener("load", OnDocumentLoad, true); 1.46 + 1.47 + var args = window.arguments[0].wrappedJSObject; 1.48 + 1.49 + gBrowser.loadURI(args.uri); 1.50 +};