|
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/. */ |
|
6 |
|
7 const CC = Components.classes; |
|
8 const CI = Components.interfaces; |
|
9 |
|
10 const NS_GFXINFO_CONTRACTID = "@mozilla.org/gfx/info;1"; |
|
11 |
|
12 var gContainingWindow = null; |
|
13 |
|
14 var gBrowser; |
|
15 |
|
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 } |
|
22 |
|
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 } |
|
30 |
|
31 gBrowser = gContainingWindow.document.getElementById("browser"); |
|
32 |
|
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 } |
|
41 |
|
42 gBrowser.addEventListener("load", OnDocumentLoad, true); |
|
43 |
|
44 var args = window.arguments[0].wrappedJSObject; |
|
45 |
|
46 gBrowser.loadURI(args.uri); |
|
47 }; |