Bug 1488377 - Use target.getFront to instantiate CssPropertiesFront; r=ochameau

Differential Revision: https://phabricator.services.mozilla.com/D7886

--HG--
extra : moz-landing-system : lando
This commit is contained in:
yulia 2018-10-08 15:01:45 +00:00
Родитель 53d248ebfe
Коммит 3b9941d99e
3 изменённых файлов: 7 добавлений и 5 удалений

Просмотреть файл

@ -1454,7 +1454,6 @@ Inspector.prototype = {
this._search = null; this._search = null;
} }
const cssPropertiesDestroyer = this._cssProperties.front.destroy();
const sidebarDestroyer = this.sidebar.destroy(); const sidebarDestroyer = this.sidebar.destroy();
const ruleViewSideBarDestroyer = this.ruleViewSideBar ? const ruleViewSideBarDestroyer = this.ruleViewSideBar ?
this.ruleViewSideBar.destroy() : null; this.ruleViewSideBar.destroy() : null;
@ -1487,7 +1486,6 @@ Inspector.prototype = {
this.telemetry = null; this.telemetry = null;
this._panelDestroyer = promise.all([ this._panelDestroyer = promise.all([
cssPropertiesDestroyer,
markupDestroyer, markupDestroyer,
sidebarDestroyer, sidebarDestroyer,
ruleViewSideBarDestroyer ruleViewSideBarDestroyer

Просмотреть файл

@ -15,6 +15,8 @@ Bug 1265798 - Replace inIDOMUtils.cssPropertyIsShorthand
window.onload = function() { window.onload = function() {
const { initCssProperties, getCssProperties } = const { initCssProperties, getCssProperties } =
require("devtools/shared/fronts/css-properties"); require("devtools/shared/fronts/css-properties");
const { getFront } =
require("devtools/shared/protocol");
function promiseAttachUrl(url) { function promiseAttachUrl(url) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
@ -41,7 +43,8 @@ window.onload = function() {
target: { target: {
hasActor: () => useActor, hasActor: () => useActor,
client: attachmentA.client, client: attachmentA.client,
form: attachmentA.tab form: attachmentA.tab,
getFront: typeName => getFront(attachmentA.client, typeName, attachmentA.tab)
}, },
// Fake the window for css-properties.js's getClientBrowserVersion to work // Fake the window for css-properties.js's getClientBrowserVersion to work
win: window win: window
@ -50,7 +53,8 @@ window.onload = function() {
target: { target: {
hasActor: () => useActor, hasActor: () => useActor,
client: attachmentB.client, client: attachmentB.client,
form: attachmentB.tab form: attachmentB.tab,
getFront: typeName => getFront(attachmentB.client, typeName, attachmentB.tab)
}, },
win: window win: window
}; };

Просмотреть файл

@ -237,7 +237,7 @@ const initCssProperties = async function(toolbox) {
// Get the list dynamically if the cssProperties actor exists. // Get the list dynamically if the cssProperties actor exists.
if (toolbox.target.hasActor("cssProperties")) { if (toolbox.target.hasActor("cssProperties")) {
front = CssPropertiesFront(client, toolbox.target.form); front = toolbox.target.getFront("cssProperties");
db = await front.getCSSDatabase(); db = await front.getCSSDatabase();
} else { } else {
// The target does not support this actor, so require a static list of supported // The target does not support this actor, so require a static list of supported