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.
michael@0 | 1 | /* Any copyright is dedicated to the Public Domain. |
michael@0 | 2 | http://creativecommons.org/publicdomain/zero/1.0/ */ |
michael@0 | 3 | |
michael@0 | 4 | function test() { |
michael@0 | 5 | let doc; |
michael@0 | 6 | let div; |
michael@0 | 7 | let inspector; |
michael@0 | 8 | |
michael@0 | 9 | function createDocument() { |
michael@0 | 10 | div = doc.createElement("div"); |
michael@0 | 11 | div.setAttribute("style", "width: 100px; height: 100px; background:yellow;"); |
michael@0 | 12 | doc.body.appendChild(div); |
michael@0 | 13 | |
michael@0 | 14 | openInspector(aInspector => { |
michael@0 | 15 | inspector = aInspector; |
michael@0 | 16 | inspector.toolbox.highlighter.showBoxModel(getNodeFront(div)).then(runTest); |
michael@0 | 17 | }); |
michael@0 | 18 | } |
michael@0 | 19 | |
michael@0 | 20 | function runTest() { |
michael@0 | 21 | let rect = getSimpleBorderRect(); |
michael@0 | 22 | is(rect.width, 100, "outline has the right width"); |
michael@0 | 23 | |
michael@0 | 24 | div.style.width = "200px"; |
michael@0 | 25 | inspector.toolbox.once("highlighter-ready", testRectWidth); |
michael@0 | 26 | } |
michael@0 | 27 | |
michael@0 | 28 | function testRectWidth() { |
michael@0 | 29 | let rect = getSimpleBorderRect(); |
michael@0 | 30 | is(rect.width, 200, "outline updated"); |
michael@0 | 31 | finishUp(); |
michael@0 | 32 | } |
michael@0 | 33 | |
michael@0 | 34 | function finishUp() { |
michael@0 | 35 | inspector.toolbox.highlighter.hideBoxModel().then(() => { |
michael@0 | 36 | doc = div = inspector = null; |
michael@0 | 37 | gBrowser.removeCurrentTab(); |
michael@0 | 38 | finish(); |
michael@0 | 39 | }); |
michael@0 | 40 | } |
michael@0 | 41 | |
michael@0 | 42 | waitForExplicitFinish(); |
michael@0 | 43 | gBrowser.selectedTab = gBrowser.addTab(); |
michael@0 | 44 | gBrowser.selectedBrowser.addEventListener("load", function() { |
michael@0 | 45 | gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true); |
michael@0 | 46 | doc = content.document; |
michael@0 | 47 | waitForFocus(createDocument, content); |
michael@0 | 48 | }, true); |
michael@0 | 49 | |
michael@0 | 50 | content.location = "data:text/html;charset=utf-8,browser_inspector_invalidate.js"; |
michael@0 | 51 | } |