зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 2 changesets (bug 1659376) for dt failures on browser_dbg-content-script-sources.js. CLOSED TREE
Backed out changeset 61e3dea03a62 (bug 1659376) Backed out changeset 86e77b35c75d (bug 1659376)
This commit is contained in:
Родитель
c5953d1c1a
Коммит
cb798e0f9e
|
@ -20,12 +20,6 @@ loader.lazyRequireGetter(
|
|||
"devtools/server/actors/highlighters/utils/markup",
|
||||
true
|
||||
);
|
||||
loader.lazyRequireGetter(
|
||||
this,
|
||||
"isDocumentReady",
|
||||
"devtools/server/actors/inspector/utils",
|
||||
true
|
||||
);
|
||||
loader.lazyRequireGetter(
|
||||
this,
|
||||
"BoxModelHighlighter",
|
||||
|
@ -130,10 +124,10 @@ exports.HighlighterActor = protocol.ActorClassWithSpec(highlighterSpec, {
|
|||
const onInitialized = new Promise(resolve => {
|
||||
this._initialized = resolve;
|
||||
});
|
||||
// Only try to create the highlighter instance when the document is loaded,
|
||||
// Only try to create the highlighter isntance when the document is loaded,
|
||||
// otherwise, wait for the navigate event to fire.
|
||||
const doc = this._targetActor.window.document;
|
||||
if (doc.documentElement && isDocumentReady(doc)) {
|
||||
if (doc.documentElement && doc.readyState != "uninitialized") {
|
||||
this._createHighlighter();
|
||||
}
|
||||
|
||||
|
|
|
@ -23,13 +23,6 @@ loader.lazyRequireGetter(
|
|||
"devtools/server/actors/inspector/css-logic",
|
||||
true
|
||||
);
|
||||
loader.lazyRequireGetter(
|
||||
this,
|
||||
"isDocumentReady",
|
||||
"devtools/server/actors/inspector/utils",
|
||||
true
|
||||
);
|
||||
|
||||
exports.getComputedStyle = node =>
|
||||
lazyContainer.CssLogic.getComputedStyle(node);
|
||||
|
||||
|
@ -217,7 +210,7 @@ CanvasFrameAnonymousContentHelper.prototype = {
|
|||
// Only try to create the highlighter when the document is loaded,
|
||||
// otherwise, wait for the window-ready event to fire.
|
||||
const doc = this.highlighterEnv.document;
|
||||
if (doc.documentElement && isDocumentReady(doc)) {
|
||||
if (doc.documentElement && doc.readyState != "uninitialized") {
|
||||
this._insert();
|
||||
}
|
||||
|
||||
|
@ -715,7 +708,7 @@ function waitForContentLoaded(iframeOrWindow) {
|
|||
}
|
||||
|
||||
const doc = iframeOrWindow.contentDocument || iframeOrWindow.document;
|
||||
if (isDocumentReady(doc)) {
|
||||
if (doc.readyState == "interactive" || doc.readyState == "complete") {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { Cu, Ci } = require("chrome");
|
||||
const { Cu } = require("chrome");
|
||||
|
||||
loader.lazyRequireGetter(this, "colorUtils", "devtools/shared/css/color", true);
|
||||
loader.lazyRequireGetter(this, "AsyncUtils", "devtools/shared/async-utils");
|
||||
|
@ -543,34 +543,8 @@ async function getBackgroundColor({ rawNode: node, walker }) {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates if a document is ready (i.e. if it's not loading anymore)
|
||||
*
|
||||
* @param {HTMLDocument} document: The document we want to check
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
function isDocumentReady(document) {
|
||||
if (!document) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const { readyState } = document;
|
||||
if (readyState == "interactive" || readyState == "complete") {
|
||||
return true;
|
||||
}
|
||||
|
||||
// A document might stay forever in unitialized state.
|
||||
// If the target actor is not currently loading a document,
|
||||
// assume the document is ready.
|
||||
const webProgress = document.defaultView.docShell.QueryInterface(
|
||||
Ci.nsIWebProgress
|
||||
);
|
||||
return !webProgress.isLoadingDocument;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
allAnonymousContentTreeWalkerFilter,
|
||||
isDocumentReady,
|
||||
isWhitespaceTextNode,
|
||||
findGridParentContainerForNode,
|
||||
getBackgroundColor,
|
||||
|
|
|
@ -41,7 +41,6 @@ loader.lazyRequireGetter(
|
|||
[
|
||||
"allAnonymousContentTreeWalkerFilter",
|
||||
"findGridParentContainerForNode",
|
||||
"isDocumentReady",
|
||||
"isNodeDead",
|
||||
"noAnonymousContentTreeWalkerFilter",
|
||||
"nodeDocument",
|
||||
|
@ -296,7 +295,7 @@ var WalkerActor = protocol.ActorClassWithSpec(walkerSpec, {
|
|||
}
|
||||
|
||||
this._isWatchingRootNode = true;
|
||||
if (this.rootNode && isDocumentReady(this.rootDoc)) {
|
||||
if (this.rootNode && this._isRootDocumentReady()) {
|
||||
this._emitNewRoot(this.rootNode, { isTopLevelDocument: true });
|
||||
}
|
||||
},
|
||||
|
@ -319,6 +318,23 @@ var WalkerActor = protocol.ActorClassWithSpec(walkerSpec, {
|
|||
this.emit("root-available", rootNode);
|
||||
},
|
||||
|
||||
_isRootDocumentReady() {
|
||||
if (this.rootDoc) {
|
||||
const { readyState } = this.rootDoc;
|
||||
if (readyState == "interactive" || readyState == "complete") {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// A document might stay forever in unitialized state.
|
||||
// If the target actor is not currently loading a document,
|
||||
// assume the document is ready.
|
||||
const webProgress = this.rootDoc.defaultView.docShell.QueryInterface(
|
||||
Ci.nsIWebProgress
|
||||
);
|
||||
return !webProgress.isLoadingDocument;
|
||||
},
|
||||
|
||||
/**
|
||||
* Callback for eventListenerService.addListenerChangeListener
|
||||
* @param nsISimpleEnumerator changesEnum
|
||||
|
|
Загрузка…
Ссылка в новой задаче