зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1738012 - Fetch content meta data only after the page is loaded. r=mconley
Differential Revision: https://phabricator.services.mozilla.com/D129733
This commit is contained in:
Родитель
76e0c58814
Коммит
18e9725997
|
@ -99,11 +99,21 @@ class ContentMetaChild extends JSWindowActorChild {
|
|||
}
|
||||
|
||||
handleEvent(event) {
|
||||
if (event.type != "DOMMetaAdded") {
|
||||
return;
|
||||
switch (event.type) {
|
||||
case "DOMContentLoaded":
|
||||
const metaTags = this.contentWindow.document.querySelectorAll("meta");
|
||||
for (let metaTag of metaTags) {
|
||||
this.onMetaTag(metaTag);
|
||||
}
|
||||
break;
|
||||
case "DOMMetaAdded":
|
||||
this.onMetaTag(event.originalTarget);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
const metaTag = event.originalTarget;
|
||||
onMetaTag(metaTag) {
|
||||
const window = metaTag.ownerGlobal;
|
||||
|
||||
// If there's no meta tag, ignore this. Also verify that the window
|
||||
|
|
|
@ -197,7 +197,8 @@ let JSWINDOWACTORS = {
|
|||
child: {
|
||||
moduleURI: "resource://gre/actors/ContentMetaChild.jsm",
|
||||
events: {
|
||||
DOMMetaAdded: {},
|
||||
DOMContentLoaded: {},
|
||||
DOMMetaAdded: { createActor: false },
|
||||
},
|
||||
},
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче