michael@0: /* -*- Mode: js; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- / michael@0: /* vim: set shiftwidth=4 tabstop=8 autoindent cindent expandtab: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: const CC = Components.classes; michael@0: const CI = Components.interfaces; michael@0: michael@0: const NS_GFXINFO_CONTRACTID = "@mozilla.org/gfx/info;1"; michael@0: michael@0: var gContainingWindow = null; michael@0: michael@0: var gBrowser; michael@0: michael@0: function OnDocumentLoad(evt) { michael@0: if (evt.target != gBrowser.contentDocument || evt.target.location == "about:blank") michael@0: return; michael@0: gBrowser.removeEventListener("load", OnDocumentLoad, true); michael@0: gContainingWindow.close(); michael@0: } michael@0: michael@0: this.OnRecordingLoad = function OnRecordingLoad(win) { michael@0: if (win === undefined || win == null) { michael@0: win = window; michael@0: } michael@0: if (gContainingWindow == null && win != null) { michael@0: gContainingWindow = win; michael@0: } michael@0: michael@0: gBrowser = gContainingWindow.document.getElementById("browser"); michael@0: michael@0: var gfxInfo = (NS_GFXINFO_CONTRACTID in CC) && CC[NS_GFXINFO_CONTRACTID].getService(CI.nsIGfxInfo); michael@0: var info = gfxInfo.getInfo(); michael@0: dump(info.AzureContentBackend + "\n"); michael@0: if (info.AzureContentBackend == "none") { michael@0: alert("Page recordings may only be made with Azure content enabled."); michael@0: gContainingWindow.close(); michael@0: return; michael@0: } michael@0: michael@0: gBrowser.addEventListener("load", OnDocumentLoad, true); michael@0: michael@0: var args = window.arguments[0].wrappedJSObject; michael@0: michael@0: gBrowser.loadURI(args.uri); michael@0: };