summaryrefslogtreecommitdiff
path: root/browser/devtools/inspector/test/browser_inspector_bug_665880.js
blob: 6d990d5c8bbd08dcb51a45d6ef3af00371d4ac5d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/* Any copyright is dedicated to the Public Domain.
   http://creativecommons.org/publicdomain/zero/1.0/ */


function test()
{
  waitForExplicitFinish();
  ignoreAllUncaughtExceptions();

  let doc;
  let objectNode;

  gBrowser.selectedTab = gBrowser.addTab();
  gBrowser.selectedBrowser.addEventListener("load", function() {
    gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
    doc = content.document;
    waitForFocus(setupObjectInspectionTest, content);
  }, true);

  content.location = "data:text/html,<object style='padding: 100px'><p>foobar</p></object>";

  function setupObjectInspectionTest()
  {
    objectNode = doc.querySelector("object");
    ok(objectNode, "we have the object node");
    openInspector(runObjectInspectionTest);
  }

  function runObjectInspectionTest(inspector)
  {
    inspector.highlighter.once("locked", performTestComparison);
    inspector.selection.setNode(objectNode, "");
  }

  function performTestComparison()
  {
    is(getActiveInspector().selection.node, objectNode, "selection matches node");
    let target = TargetFactory.forTab(gBrowser.selectedTab);
    executeSoon(function() {
      gDevTools.closeToolbox(target);
      finishUp();
    });
  }


  function finishUp() {
    doc = objectNode = null;
    gBrowser.removeCurrentTab();
    finish();
  }
}