diff --git a/devtools/client/webconsole/enhancers/css-error-reporting.js b/devtools/client/webconsole/enhancers/css-error-reporting.js index 6d58ba764ef8..76f0b2d8429d 100644 --- a/devtools/client/webconsole/enhancers/css-error-reporting.js +++ b/devtools/client/webconsole/enhancers/css-error-reporting.js @@ -7,7 +7,7 @@ const { INITIALIZE, FILTER_TOGGLE, - FILTERS, + TARGET_AVAILABLE, } = require("devtools/client/webconsole/constants"); /** @@ -15,23 +15,30 @@ const { * filter is toggled on. */ function ensureCSSErrorReportingEnabled(webConsoleUI) { - let watchingCSSMessages = false; return next => (reducer, initialState, enhancer) => { function ensureErrorReportingEnhancer(state, action) { - state = reducer(state, action); + const proxies = webConsoleUI ? webConsoleUI.getAllProxies() : null; + if (!proxies) { + return reducer(state, action); + } - // If we're already watching CSS messages, or if the CSS filter is disabled, - // we don't do anything. - if (!webConsoleUI || watchingCSSMessages || !state.filters.css) { + state = reducer(state, action); + if (!state.filters.css) { return state; } const cssFilterToggled = - action.type == FILTER_TOGGLE && action.filter == FILTERS.CSS; - - if (cssFilterToggled || action.type == INITIALIZE) { - watchingCSSMessages = true; - webConsoleUI.watchCssMessages(); + action.type == FILTER_TOGGLE && action.filter == "css"; + if ( + cssFilterToggled || + action.type == INITIALIZE || + action.type == TARGET_AVAILABLE + ) { + for (const proxy of proxies) { + if (proxy.target && proxy.target.ensureCSSErrorReportingEnabled) { + proxy.target.ensureCSSErrorReportingEnabled(); + } + } } return state; diff --git a/devtools/client/webconsole/test/browser/browser_webconsole_cached_messages.js b/devtools/client/webconsole/test/browser/browser_webconsole_cached_messages.js index e6a58aecd9aa..8627ad777a4f 100644 --- a/devtools/client/webconsole/test/browser/browser_webconsole_cached_messages.js +++ b/devtools/client/webconsole/test/browser/browser_webconsole_cached_messages.js @@ -59,7 +59,7 @@ add_task(async function() { info("Log different type of messages to fill the cache"); await logMessages(); - info("Select the console"); + info("Open the console"); hud = await openConsole(); await testMessagesVisibility(hud); @@ -177,9 +177,8 @@ async function testMessagesVisibility(hud, checkNetworkMessage = true) { } // We can't assert the CSS warning position, so we only check that it's visible. - await waitFor( - () => findMessage(hud, "cssColorBug611032", ".message.warn.css"), - "Couldn't find the CSS warning message" + await waitFor(() => + findMessage(hud, "cssColorBug611032", ".message.warn.css") ); ok(true, "css warning message is visible"); } diff --git a/devtools/client/webconsole/test/browser/browser_webconsole_filters_persist.js b/devtools/client/webconsole/test/browser/browser_webconsole_filters_persist.js index 8d1a7b228fa8..dc2778402db5 100644 --- a/devtools/client/webconsole/test/browser/browser_webconsole_filters_persist.js +++ b/devtools/client/webconsole/test/browser/browser_webconsole_filters_persist.js @@ -43,10 +43,6 @@ add_task(async function() { filterButtons.forEach(filterButton => { ok(filterIsEnabled(filterButton), "filter is enabled"); }); - - // Wait for the CSS warning to be displayed so we don't have a pending promise. - await waitFor(() => findMessage(hud, "Expected color but found ‘blouge’")); - // Check that the ui settings were persisted. await closeTabAndToolbox(); }); diff --git a/devtools/client/webconsole/test/browser/browser_webconsole_stubs_css_message.js b/devtools/client/webconsole/test/browser/browser_webconsole_stubs_css_message.js index 11e49c666601..ca93070d0e74 100644 --- a/devtools/client/webconsole/test/browser/browser_webconsole_stubs_css_message.js +++ b/devtools/client/webconsole/test/browser/browser_webconsole_stubs_css_message.js @@ -66,19 +66,20 @@ async function generateCssMessageStubs() { // The resource-watcher only supports a single call to watch/unwatch per // instance, so we attach a unique watch callback, which will forward the // resource to `handleErrorMessage`, dynamically updated for each command. - let handleCSSMessage = function() {}; + let handleErrorMessage = function() {}; - const onCSSMessageAvailable = ({ resource }) => { - handleCSSMessage(resource); + const onErrorMessageAvailable = ({ resource }) => { + handleErrorMessage(resource); }; - await resourceWatcher.watchResources([resourceWatcher.TYPES.CSS_MESSAGE], { - onAvailable: onCSSMessageAvailable, + /* CSS errors are considered as pageError on the server */ + await resourceWatcher.watchResources([resourceWatcher.TYPES.ERROR_MESSAGE], { + onAvailable: onErrorMessageAvailable, }); for (const code of getCommands()) { const received = new Promise(resolve => { - handleCSSMessage = function(packet) { + handleErrorMessage = function(packet) { const key = packet.pageError.errorMessage; stubs.set(key, getCleanedPacket(key, packet)); resolve(); @@ -97,8 +98,8 @@ async function generateCssMessageStubs() { await received; } - resourceWatcher.unwatchResources([resourceWatcher.TYPES.CSS_MESSAGE], { - onAvailable: onCSSMessageAvailable, + resourceWatcher.unwatchResources([resourceWatcher.TYPES.ERROR_MESSAGE], { + onAvailable: onErrorMessageAvailable, }); await closeTabAndToolbox().catch(() => {}); diff --git a/devtools/client/webconsole/test/node/fixtures/stubs/cssMessage.js b/devtools/client/webconsole/test/node/fixtures/stubs/cssMessage.js index 922d11e2630c..6e150f848762 100644 --- a/devtools/client/webconsole/test/node/fixtures/stubs/cssMessage.js +++ b/devtools/client/webconsole/test/node/fixtures/stubs/cssMessage.js @@ -37,11 +37,11 @@ rawPackets.set(`Unknown property ‘such-unknown-property’. Declaration dropp "stacktrace": null, "notes": null, "chromeContext": false, + "cssSelectors": "p", "isPromiseRejection": false, "isForwardedFromContentProcess": false }, - "resourceType": "css-message", - "cssSelectors": "p" + "resourceType": "error-message" }); rawPackets.set(`Error in parsing value for ‘padding-top’. Declaration dropped.`, { @@ -63,11 +63,11 @@ rawPackets.set(`Error in parsing value for ‘padding-top’. Declaration dropp "stacktrace": null, "notes": null, "chromeContext": false, + "cssSelectors": "p", "isPromiseRejection": false, "isForwardedFromContentProcess": false }, - "resourceType": "css-message", - "cssSelectors": "p" + "resourceType": "error-message" }); diff --git a/devtools/client/webconsole/test/node/helpers.js b/devtools/client/webconsole/test/node/helpers.js index 48cc7558bb18..cc3929bda093 100644 --- a/devtools/client/webconsole/test/node/helpers.js +++ b/devtools/client/webconsole/test/node/helpers.js @@ -143,7 +143,6 @@ function getWebConsoleUiMock(hud, proxyOverrides) { toolbox: { sessionId: 1, }, - watchCssMessages: () => {}, }; } diff --git a/devtools/client/webconsole/utils/messages.js b/devtools/client/webconsole/utils/messages.js index 15b77e76c776..4144027a1b1d 100644 --- a/devtools/client/webconsole/utils/messages.js +++ b/devtools/client/webconsole/utils/messages.js @@ -111,10 +111,6 @@ function transformResource(resource) { return transformPageErrorResource(resource); } - case ResourceWatcher.TYPES.CSS_MESSAGE: { - return transformCSSMessageResource(resource); - } - case "networkEvent": { return transformNetworkEventResource(resource); } @@ -309,7 +305,7 @@ function transformPlatformMessageResource(platformMessageResource) { }); } -function transformPageErrorResource(pageErrorResource, override = {}) { +function transformPageErrorResource(pageErrorResource) { const { pageError, targetFront } = pageErrorResource; let level = MESSAGE_LEVEL.ERROR; if (pageError.warning) { @@ -327,37 +323,30 @@ function transformPageErrorResource(pageErrorResource, override = {}) { } : null; - return new ConsoleMessage( - Object.assign( - { - targetFront, - innerWindowID: pageError.innerWindowID, - source: MESSAGE_SOURCE.JAVASCRIPT, - type: MESSAGE_TYPE.LOG, - level, - category: pageError.category, - messageText: pageError.errorMessage, - stacktrace: pageError.stacktrace ? pageError.stacktrace : null, - frame, - errorMessageName: pageError.errorMessageName, - exceptionDocURL: pageError.exceptionDocURL, - hasException: pageError.hasException, - parameters: pageError.hasException ? [pageError.exception] : null, - timeStamp: pageError.timeStamp, - notes: pageError.notes, - private: pageError.private, - chromeContext: pageError.chromeContext, - isPromiseRejection: pageError.isPromiseRejection, - }, - override - ) - ); -} - -function transformCSSMessageResource(cssMessageResource) { - return transformPageErrorResource(cssMessageResource, { - cssSelectors: cssMessageResource.cssSelectors, - source: MESSAGE_SOURCE.CSS, + const matchesCSS = pageError.category == "CSS Parser"; + const messageSource = matchesCSS + ? MESSAGE_SOURCE.CSS + : MESSAGE_SOURCE.JAVASCRIPT; + return new ConsoleMessage({ + targetFront, + innerWindowID: pageError.innerWindowID, + source: messageSource, + type: MESSAGE_TYPE.LOG, + level, + category: pageError.category, + messageText: pageError.errorMessage, + stacktrace: pageError.stacktrace ? pageError.stacktrace : null, + frame, + errorMessageName: pageError.errorMessageName, + exceptionDocURL: pageError.exceptionDocURL, + hasException: pageError.hasException, + parameters: pageError.hasException ? [pageError.exception] : null, + timeStamp: pageError.timeStamp, + notes: pageError.notes, + private: pageError.private, + chromeContext: pageError.chromeContext, + cssSelectors: pageError.cssSelectors, + isPromiseRejection: pageError.isPromiseRejection, }); } diff --git a/devtools/client/webconsole/webconsole-ui.js b/devtools/client/webconsole/webconsole-ui.js index 516446642df4..b56c81816930 100644 --- a/devtools/client/webconsole/webconsole-ui.js +++ b/devtools/client/webconsole/webconsole-ui.js @@ -346,23 +346,13 @@ class WebConsoleUI { ); } - async watchCssMessages() { - const { resourceWatcher } = this.hud; - await resourceWatcher.watchResources([resourceWatcher.TYPES.CSS_MESSAGE], { - onAvailable: this._onResourceAvailable, - }); - } - _onResourceAvailable({ resourceType, targetFront, resource }) { - const { TYPES } = this.hud.resourceWatcher; // Ignore messages forwarded from content processes if we're in fission browser toolbox. if ( - !this.wrapper || - ((resourceType === TYPES.ERROR_MESSAGE || - resourceType === TYPES.CSS_MESSAGE) && - resource.pageError?.isForwardedFromContentProcess && - (this.isBrowserToolboxConsole || this.isBrowserConsole) && - this.fissionSupport) + resourceType === this.hud.resourceWatcher.TYPES.ERROR_MESSAGE && + resource.pageError.isForwardedFromContentProcess && + (this.isBrowserToolboxConsole || this.isBrowserConsole) && + this.fissionSupport ) { return; } diff --git a/devtools/server/actors/targets/browsing-context.js b/devtools/server/actors/targets/browsing-context.js index 990ca33e55d4..ae26e8d870e1 100644 --- a/devtools/server/actors/targets/browsing-context.js +++ b/devtools/server/actors/targets/browsing-context.js @@ -1230,8 +1230,7 @@ const browsingContextTargetPrototype = { /** * Ensure that CSS error reporting is enabled. */ - async ensureCSSErrorReportingEnabled(request) { - const promises = []; + ensureCSSErrorReportingEnabled(request) { for (const docShell of this.docShells) { if (docShell.cssErrorReportingEnabled) { continue; @@ -1254,15 +1253,12 @@ const browsingContextTargetPrototype = { continue; } // Reparse the sheet so that we see the existing errors. - const onStyleSheetParsed = getSheetText(sheet, this._consoleActor) - .then(text => { - InspectorUtils.parseStyleSheet(sheet, text, /* aUpdate = */ false); - }) - .catch(e => console.error("Error while parsing stylesheet")); - promises.push(onStyleSheetParsed); + getSheetText(sheet, this._consoleActor).then(text => { + InspectorUtils.parseStyleSheet(sheet, text, /* aUpdate = */ false); + }); } } - await Promise.all(promises); + return {}; }, diff --git a/devtools/shared/resources/legacy-listeners/css-messages.js b/devtools/shared/resources/legacy-listeners/css-messages.js deleted file mode 100644 index 893dd4b34e1d..000000000000 --- a/devtools/shared/resources/legacy-listeners/css-messages.js +++ /dev/null @@ -1,77 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -"use strict"; - -const { - ResourceWatcher, -} = require("devtools/shared/resources/resource-watcher"); - -module.exports = async function({ - targetList, - targetFront, - isFissionEnabledOnContentToolbox, - onAvailable, -}) { - // Allow the top level target if the targetFront has an `ensureCSSErrorREportingEnabled` - // function. Also allow frame in non-content toolbox and in content toolbox when the - // fission toolbox pref is set. - const isContentToolbox = targetList.targetFront.isLocalTab; - const listenForFrames = !isContentToolbox || isFissionEnabledOnContentToolbox; - const isAllowed = - typeof targetFront.ensureCSSErrorReportingEnabled == "function" && - (targetFront.isTopLevel || - (targetFront.targetType === targetList.TYPES.FRAME && listenForFrames)); - - if (!isAllowed) { - return; - } - - const webConsoleFront = await targetFront.getFront("console"); - - // Request notifying about new CSS messages (they're emitted from the "PageError listener"). - await webConsoleFront.startListeners(["PageError"]); - - // Fetch already existing messages - // /!\ The actor implementation requires to call startListeners("PageError") first /!\ - const { messages } = await webConsoleFront.getCachedMessages(["PageError"]); - - const cachedMessages = []; - for (let message of messages) { - if (message.pageError?.category !== "CSS Parser") { - continue; - } - - // Handling cached messages for servers older than Firefox 78. - // Wrap the message into a `pageError` attribute, to match `pageError` behavior - if (message._type) { - message = { - pageError: message, - }; - } - message.resourceType = ResourceWatcher.TYPES.CSS_MESSAGE; - message.cssSelectors = message.pageError.cssSelectors; - delete message.pageError.cssSelectors; - cachedMessages.push(message); - } - - onAvailable(cachedMessages); - - // Calling ensureCSSErrorReportingEnabled will make the server parse the stylesheets to - // retrieve the warnings if the docShell wasn't already watching for CSS messages. - await targetFront.ensureCSSErrorReportingEnabled(); - - // CSS Messages are emited fron the PageError listener, which also send regular errors - // that we need to filter out. - webConsoleFront.on("pageError", message => { - if (message.pageError.category !== "CSS Parser") { - return; - } - - message.resourceType = ResourceWatcher.TYPES.CSS_MESSAGE; - message.cssSelectors = message.pageError.cssSelectors; - delete message.pageError.cssSelectors; - onAvailable([message]); - }); -}; diff --git a/devtools/shared/resources/legacy-listeners/error-messages.js b/devtools/shared/resources/legacy-listeners/error-messages.js index dee36d4a68e9..2910bc78deab 100644 --- a/devtools/shared/resources/legacy-listeners/error-messages.js +++ b/devtools/shared/resources/legacy-listeners/error-messages.js @@ -44,13 +44,11 @@ module.exports = async function({ // On older server (< v77), we're also getting LogMessage cached messages, so we need // to ignore those. - // On server < v79, we're also getting CSS Messages that we need to filter out. messages = messages.filter(message => { return ( - (webConsoleFront.traits.newCacheStructure || - !message._type || - message._type == "PageError") && - message.pageError.category !== "CSS Parser" + webConsoleFront.traits.newCacheStructure || + !message._type || + message._type == "PageError" ); }); @@ -71,11 +69,6 @@ module.exports = async function({ onAvailable(messages); webConsoleFront.on("pageError", message => { - // On server < v79, we're getting CSS Messages that we need to filter out. - if (message.pageError.category === "CSS Parser") { - return; - } - message.resourceType = ResourceWatcher.TYPES.ERROR_MESSAGE; onAvailable([message]); }); diff --git a/devtools/shared/resources/legacy-listeners/moz.build b/devtools/shared/resources/legacy-listeners/moz.build index dad8dd062971..7e6ab7557426 100644 --- a/devtools/shared/resources/legacy-listeners/moz.build +++ b/devtools/shared/resources/legacy-listeners/moz.build @@ -5,7 +5,6 @@ DevToolsModules( 'console-messages.js', 'css-changes.js', - 'css-messages.js', 'error-messages.js', 'platform-messages.js', 'root-node.js', diff --git a/devtools/shared/resources/resource-watcher.js b/devtools/shared/resources/resource-watcher.js index f5c350b3c4c4..814c9c2a5c45 100644 --- a/devtools/shared/resources/resource-watcher.js +++ b/devtools/shared/resources/resource-watcher.js @@ -422,7 +422,6 @@ class ResourceWatcher { ResourceWatcher.TYPES = ResourceWatcher.prototype.TYPES = { CONSOLE_MESSAGE: "console-message", CSS_CHANGE: "css-change", - CSS_MESSAGE: "css-message", ERROR_MESSAGE: "error-message", PLATFORM_MESSAGE: "platform-message", DOCUMENT_EVENT: "document-event", @@ -438,8 +437,6 @@ const LegacyListeners = { .CONSOLE_MESSAGE]: require("devtools/shared/resources/legacy-listeners/console-messages"), [ResourceWatcher.TYPES .CSS_CHANGE]: require("devtools/shared/resources/legacy-listeners/css-changes"), - [ResourceWatcher.TYPES - .CSS_MESSAGE]: require("devtools/shared/resources/legacy-listeners/css-messages"), [ResourceWatcher.TYPES .ERROR_MESSAGE]: require("devtools/shared/resources/legacy-listeners/error-messages"), [ResourceWatcher.TYPES diff --git a/devtools/shared/resources/tests/browser.ini b/devtools/shared/resources/tests/browser.ini index e3b788b2a269..9d59162a8547 100644 --- a/devtools/shared/resources/tests/browser.ini +++ b/devtools/shared/resources/tests/browser.ini @@ -16,7 +16,6 @@ support-files = [browser_resources_client_caching.js] [browser_resources_console_messages.js] [browser_resources_css_changes.js] -[browser_resources_css_messages.js] [browser_resources_document_events.js] [browser_resources_error_messages.js] [browser_resources_platform_messages.js] diff --git a/devtools/shared/resources/tests/browser_resources_css_messages.js b/devtools/shared/resources/tests/browser_resources_css_messages.js deleted file mode 100644 index 545fbe56b31a..000000000000 --- a/devtools/shared/resources/tests/browser_resources_css_messages.js +++ /dev/null @@ -1,196 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -"use strict"; - -// Test the ResourceWatcher API around CSS_MESSAGE -// Reproduces the CSS message assertions from devtools/shared/webconsole/test/chrome/test_page_errors.html - -const { - ResourceWatcher, -} = require("devtools/shared/resources/resource-watcher"); - -// Create a simple server so we have a nice sourceName in the resources packets. -const httpServer = createTestHTTPServer(); -httpServer.registerPathHandler(`/test_css_messages.html`, (req, res) => { - res.setStatusLine(req.httpVersion, 200, "OK"); - res.write(` - Test CSS Messages`); -}); - -const TEST_URI = `http://localhost:${httpServer.identity.primaryPort}/test_css_messages.html`; - -add_task(async function testWatchingCssMessages() { - // Disable the preloaded process as it creates processes intermittently - // which forces the emission of RDP requests we aren't correctly waiting for. - await pushPref("dom.ipc.processPrelaunch.enabled", false); - - // Open a test tab - const tab = await addTab(TEST_URI); - - const { - client, - resourceWatcher, - targetList, - } = await initResourceWatcherAndTarget(tab); - - const receivedMessages = []; - const { onAvailable, onAllMessagesReceived } = setupOnAvailableFunction( - targetList, - receivedMessages - ); - await resourceWatcher.watchResources([ResourceWatcher.TYPES.CSS_MESSAGE], { - onAvailable, - }); - - info( - "Now log CSS warning *after* the call to ResourceWatcher.watchResources and after " + - "having received the existing message" - ); - // We need to wait for the first CSS Warning as it is not a cached message; when we - // start watching, the `cssErrorReportingEnabled` is checked on the target docShell, and - // if it is false, we re-parse the stylesheets to get the messages. - await BrowserTestUtils.waitForCondition(() => receivedMessages.length === 1); - - info("Trigger a CSS Warning"); - triggerCSSWarning(tab); - - info("Waiting for all expected CSS messages to be received"); - await onAllMessagesReceived; - ok(true, "All the expected CSS messages were received"); - - Services.console.reset(); - targetList.stopListening(); - await client.close(); -}); - -add_task(async function testWatchingCachedCssMessages() { - // Disable the preloaded process as it creates processes intermittently - // which forces the emission of RDP requests we aren't correctly waiting for. - await pushPref("dom.ipc.processPrelaunch.enabled", false); - - // Open a test tab - const tab = await addTab(TEST_URI); - - // By default, the CSS Parser does not emit warnings at all, for performance matter. - // Since we actually want the Parser to emit those messages _before_ we start listening - // for CSS messages, we need to set the cssErrorReportingEnabled flag on the docShell. - await SpecialPowers.spawn(gBrowser.selectedBrowser, [], function() { - content.docShell.cssErrorReportingEnabled = true; - }); - - // Setting the docShell flag only indicates to the Parser that from now on, it should - // emit warnings. But it does not automatically emit warnings for the existing CSS - // errors in the stylesheets. So here we reload the tab, which will make the Parser - // parse the stylesheets again, this time emitting warnings. - const loaded = BrowserTestUtils.browserLoaded(tab.linkedBrowser); - tab.linkedBrowser.reload(); - // wait for the tab to be fully loaded - await loaded; - // and trigger more CSS warnings - await triggerCSSWarning(tab); - - // At this point, all messages should be in the ConsoleService cache, and we can begin - // to watch and check that we do retrieve those messages. - const { - client, - resourceWatcher, - targetList, - } = await initResourceWatcherAndTarget(tab); - - const receivedMessages = []; - const { onAvailable } = setupOnAvailableFunction( - targetList, - receivedMessages - ); - await resourceWatcher.watchResources([ResourceWatcher.TYPES.CSS_MESSAGE], { - onAvailable, - }); - is(receivedMessages.length, 3, "Cached messages were retrieved as expected"); - - Services.console.reset(); - targetList.stopListening(); - await client.close(); -}); - -function setupOnAvailableFunction(targetList, receivedMessages) { - // The expected messages are the CSS warnings: - // - one for the rule in the style element - // - two for the JS modified style we're doing in the test. - const expectedMessages = [ - { - pageError: { - errorMessage: /Expected color but found ‘bloup’/, - sourceName: /test_css_messages/, - category: "CSS Parser", - timeStamp: /^\d+$/, - error: false, - warning: true, - }, - cssSelectors: "html", - }, - { - pageError: { - errorMessage: /Error in parsing value for ‘width’/, - sourceName: /test_css_messages/, - category: "CSS Parser", - timeStamp: /^\d+$/, - error: false, - warning: true, - }, - }, - { - pageError: { - errorMessage: /Error in parsing value for ‘height’/, - sourceName: /test_css_messages/, - category: "CSS Parser", - timeStamp: /^\d+$/, - error: false, - warning: true, - }, - }, - ]; - - let done; - const onAllMessagesReceived = new Promise(resolve => (done = resolve)); - const onAvailable = ({ resourceType, targetFront, resource }) => { - const { pageError } = resource; - - is( - resource.targetFront, - targetList.targetFront, - "The targetFront property is the expected one" - ); - - if (!pageError.sourceName.includes("test_css_messages")) { - info(`Ignore error from unknown source: "${pageError.sourceName}"`); - return; - } - - const index = receivedMessages.length; - receivedMessages.push(pageError); - - info(`checking received css message #${index}: ${pageError.errorMessage}`); - ok(pageError, "The resource has a pageError attribute"); - checkObject(resource, expectedMessages[index]); - - if (receivedMessages.length == expectedMessages.length) { - done(); - } - }; - return { onAvailable, onAllMessagesReceived }; -} - -/** - * Sets invalid values for width and height on the document's body style attribute. - */ -function triggerCSSWarning(tab) { - return ContentTask.spawn(tab.linkedBrowser, null, function frameScript() { - content.document.body.style.width = "red"; - content.document.body.style.height = "blue"; - }); -}