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