Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
4 function test() {
5 let doc;
6 let div;
7 let inspector;
9 function createDocument() {
10 div = doc.createElement("div");
11 div.setAttribute("style", "width: 100px; height: 100px; background:yellow;");
12 doc.body.appendChild(div);
14 openInspector(aInspector => {
15 inspector = aInspector;
16 inspector.toolbox.highlighter.showBoxModel(getNodeFront(div)).then(runTest);
17 });
18 }
20 function runTest() {
21 let rect = getSimpleBorderRect();
22 is(rect.width, 100, "outline has the right width");
24 div.style.width = "200px";
25 inspector.toolbox.once("highlighter-ready", testRectWidth);
26 }
28 function testRectWidth() {
29 let rect = getSimpleBorderRect();
30 is(rect.width, 200, "outline updated");
31 finishUp();
32 }
34 function finishUp() {
35 inspector.toolbox.highlighter.hideBoxModel().then(() => {
36 doc = div = inspector = null;
37 gBrowser.removeCurrentTab();
38 finish();
39 });
40 }
42 waitForExplicitFinish();
43 gBrowser.selectedTab = gBrowser.addTab();
44 gBrowser.selectedBrowser.addEventListener("load", function() {
45 gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
46 doc = content.document;
47 waitForFocus(createDocument, content);
48 }, true);
50 content.location = "data:text/html;charset=utf-8,browser_inspector_invalidate.js";
51 }