browser/devtools/styleeditor/test/browser_styleeditor_bug_870339.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

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 {
     6   const SIMPLE = TEST_BASE_HTTP + "simple.css";
     7   const DOCUMENT_WITH_ONE_STYLESHEET = "data:text/html;charset=UTF-8," +
     8           encodeURIComponent(
     9             ["<!DOCTYPE html>",
    10              "<html>",
    11              " <head>",
    12              "  <title>Bug 870339</title>",
    13              '  <link rel="stylesheet" type="text/css" href="'+SIMPLE+'">',
    14              " </head>",
    15              " <body>",
    16              " </body>",
    17              "</html>"
    18             ].join("\n"));
    20   waitForExplicitFinish();
    21   addTabAndOpenStyleEditors(1, function (aPanel) {
    22     let UI = aPanel.UI;
    24     // Spam the _onNewDocument callback multiple times before the
    25     // StyleEditorActor has a chance to respond to the first one.
    26     const SPAM_COUNT = 2;
    27     for (let i=0; i<SPAM_COUNT; ++i) {
    28       UI._onNewDocument();
    29     }
    31     // Wait for the StyleEditorActor to respond to each "newDocument"
    32     // message.
    33     let loadCount = 0;
    34     UI.on("stylesheets-reset", function () {
    35       ++loadCount;
    36       if (loadCount == SPAM_COUNT) {
    37         // No matter how large SPAM_COUNT is, the number of style
    38         // sheets should never be more than the number of style sheets
    39         // in the document.
    40         is(UI.editors.length, 1, "correct style sheet count");
    41         finish();
    42       }
    43     });
    44   });
    45   content.location = DOCUMENT_WITH_ONE_STYLESHEET;
    46 }

mercurial