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.
1 /* vim:set ts=2 sw=2 sts=2 et: */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 const TEST_URI = "http://example.com/browser/dom/tests/browser/test_bug1004814.html";
8 function test() {
9 waitForExplicitFinish();
11 ConsoleObserver.init();
13 var tab = gBrowser.addTab(TEST_URI);
14 gBrowser.selectedTab = tab;
16 registerCleanupFunction(function () {
17 gBrowser.removeTab(tab);
18 });
19 }
21 var ConsoleObserver = {
22 QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]),
24 init: function() {
25 Services.obs.addObserver(this, "console-api-log-event", false);
26 },
28 destroy: function() {
29 Services.obs.removeObserver(this, "console-api-log-event");
30 },
32 observe: function(aSubject, aTopic, aData) {
33 var obj = aSubject.wrappedJSObject;
34 if (obj.arguments.length != 1 || obj.arguments[0] != 'bug1004814' ||
35 obj.level != 'timeEnd') {
36 return;
37 }
39 ok("timer" in obj, "ConsoleEvent contains 'timer' property");
40 ok("duration" in obj.timer, "ConsoleEvent.timer contains 'duration' property");
41 ok(obj.timer.duration > 0, "ConsoleEvent.timer.duration > 0: " + obj.timer.duration + " ~ 200ms");
43 this.destroy();
44 finish();
45 }
46 };