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