Thu, 15 Jan 2015 15:59:08 +0100
Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4 "use strict";
6 // Opening new windows in Fennec causes issues
7 module.metadata = {
8 engines: {
9 'Firefox': '*'
10 }
11 };
13 const { Loader } = require("sdk/test/loader");
14 const { open, getMostRecentBrowserWindow, getOuterId } = require("sdk/window/utils");
16 exports["test browser events"] = function(assert, done) {
17 let loader = Loader(module);
18 let { events } = loader.require("sdk/window/events");
19 let { on, off } = loader.require("sdk/event/core");
20 let actual = [];
22 on(events, "data", function handler(e) {
23 actual.push(e);
25 if (e.type === "open") {
26 assert.pass("window open has occured");
27 }
28 else if (e.type === "DOMContentLoaded") {
29 assert.pass("window DOMContentLoaded has occured");
30 }
31 else if (e.type === "load") {
32 assert.pass("window load has occured");
33 window.close();
34 }
35 else if (e.type === "close") {
36 // confirm the ordering of events
37 let [ open, ready, load, close ] = actual;
38 assert.equal(open.type, "open")
39 assert.equal(open.target, window, "window is open")
41 assert.equal(ready.type, "DOMContentLoaded")
42 assert.equal(ready.target, window, "window ready")
44 assert.equal(load.type, "load")
45 assert.equal(load.target, window, "window load")
47 assert.equal(close.type, "close")
48 assert.equal(close.target, window, "window load")
50 // Note: If window is closed right after this GC won't have time
51 // to claim loader and there for this listener. It's better to remove
52 // remove listener here to avoid race conditions.
53 off(events, "data", handler);
54 loader.unload();
55 done();
56 }
57 });
59 // Open window and close it to trigger observers.
60 let window = open();
61 };
63 require("sdk/test").run(exports);