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 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=783129
5 -->
6 <head>
7 <title>Test for document.registerElement lifecycle callback</title>
8 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
10 <script>
11 var p = Object.create(HTMLElement.prototype);
13 var createdCallbackCallCount = 0;
15 // By the time the base element queue is processed via the microtask,
16 // both x-hello elements should be in the document.
17 p.createdCallback = function() {
18 var one = document.getElementById("one");
19 var two = document.getElementById("two");
20 isnot(one, null, "First x-hello element should be in the tree.");
21 isnot(two, null, "Second x-hello element should be in the tree.");
22 createdCallbackCallCount++;
23 if (createdCallbackCallCount == 2) {
24 SimpleTest.finish();
25 }
27 if (createdCallbackCallCount > 2) {
28 ok(false, "Created callback called too much.");
29 }
30 };
32 p.attributeChangedCallback = function(name, oldValue, newValue) {
33 ok(false, "Attribute changed callback should not be called because callbacks should not be queued until created callback invoked.");
34 };
36 document.registerElement("x-hello", { prototype: p });
38 SimpleTest.waitForExplicitFinish();
39 </script>
40 </head>
41 <body>
42 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=783129">Bug 783129</a>
43 <x-hello id="one"></x-hello>
44 <x-hello id="two"></x-hello>
45 <script>
46 </script>
47 </body>
48 </html>