michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: function test() { michael@0: let doc; michael@0: let div; michael@0: let inspector; michael@0: michael@0: function createDocument() { michael@0: div = doc.createElement("div"); michael@0: div.setAttribute("style", "width: 100px; height: 100px; background:yellow;"); michael@0: doc.body.appendChild(div); michael@0: michael@0: openInspector(aInspector => { michael@0: inspector = aInspector; michael@0: inspector.toolbox.highlighter.showBoxModel(getNodeFront(div)).then(runTest); michael@0: }); michael@0: } michael@0: michael@0: function runTest() { michael@0: let rect = getSimpleBorderRect(); michael@0: is(rect.width, 100, "outline has the right width"); michael@0: michael@0: div.style.width = "200px"; michael@0: inspector.toolbox.once("highlighter-ready", testRectWidth); michael@0: } michael@0: michael@0: function testRectWidth() { michael@0: let rect = getSimpleBorderRect(); michael@0: is(rect.width, 200, "outline updated"); michael@0: finishUp(); michael@0: } michael@0: michael@0: function finishUp() { michael@0: inspector.toolbox.highlighter.hideBoxModel().then(() => { michael@0: doc = div = inspector = null; michael@0: gBrowser.removeCurrentTab(); michael@0: finish(); michael@0: }); michael@0: } michael@0: michael@0: waitForExplicitFinish(); michael@0: gBrowser.selectedTab = gBrowser.addTab(); michael@0: gBrowser.selectedBrowser.addEventListener("load", function() { michael@0: gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true); michael@0: doc = content.document; michael@0: waitForFocus(createDocument, content); michael@0: }, true); michael@0: michael@0: content.location = "data:text/html;charset=utf-8,browser_inspector_invalidate.js"; michael@0: }