зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset b6ba2b9fbe8a (bug 1265730) for bc7 failures in browser_parsable_script.js
This commit is contained in:
Родитель
84e10fced2
Коммит
b9a80d272d
|
@ -17,7 +17,8 @@ const protocol = require("devtools/shared/protocol");
|
|||
const {Arg, Option, method, RetVal, types} = protocol;
|
||||
const {LongStringActor} = require("devtools/server/actors/string");
|
||||
const {fetch} = require("devtools/shared/DevToolsUtils");
|
||||
const {oldStyleSheetSpec, styleEditorSpec} = require("devtools/shared/specs/styleeditor");
|
||||
const {OldStyleSheetFront} = require("devtools/shared/fronts/styleeditor");
|
||||
const {oldStyleSheetSpec} = require("devtools/shared/specs/styleeditor");
|
||||
|
||||
loader.lazyGetter(this, "CssLogic", () => require("devtools/shared/inspector/css-logic").CssLogic);
|
||||
|
||||
|
@ -553,13 +554,13 @@ var StyleEditorFront = protocol.FrontClass(StyleEditorActor, {
|
|||
}
|
||||
});
|
||||
|
||||
exports.OldStyleSheetActor = OldStyleSheetActor;
|
||||
|
||||
/**
|
||||
* Creates a StyleEditorActor. StyleEditorActor provides remote access to the
|
||||
* stylesheets of a document.
|
||||
*/
|
||||
var StyleEditorActor = exports.StyleEditorActor = protocol.ActorClassWithSpec(styleEditorSpec, {
|
||||
var StyleEditorActor = exports.StyleEditorActor = protocol.ActorClass({
|
||||
typeName: "styleeditor",
|
||||
|
||||
/**
|
||||
* The window we work with, taken from the parent actor.
|
||||
*/
|
||||
|
@ -574,6 +575,13 @@ var StyleEditorActor = exports.StyleEditorActor = protocol.ActorClassWithSpec(st
|
|||
return this.window.document;
|
||||
},
|
||||
|
||||
events: {
|
||||
"document-load" : {
|
||||
type: "documentLoad",
|
||||
styleSheets: Arg(0, "array:old-stylesheet")
|
||||
}
|
||||
},
|
||||
|
||||
form: function ()
|
||||
{
|
||||
return { actor: this.actorID };
|
||||
|
@ -601,7 +609,6 @@ var StyleEditorActor = exports.StyleEditorActor = protocol.ActorClassWithSpec(st
|
|||
* Adds load listeners to document.
|
||||
*/
|
||||
newDocument: method(function () {
|
||||
newDocument: function () {
|
||||
// delete previous document's actors
|
||||
this._clearStyleSheetActors();
|
||||
|
||||
|
@ -614,7 +621,7 @@ var StyleEditorActor = exports.StyleEditorActor = protocol.ActorClassWithSpec(st
|
|||
this.window.addEventListener("load", this._onDocumentLoaded, false);
|
||||
}
|
||||
return {};
|
||||
},
|
||||
}),
|
||||
|
||||
/**
|
||||
* Event handler for document loaded event. Add actor for each stylesheet
|
||||
|
@ -736,7 +743,7 @@ var StyleEditorActor = exports.StyleEditorActor = protocol.ActorClassWithSpec(st
|
|||
* @return {object}
|
||||
* Object with 'styelSheet' property for form on new actor.
|
||||
*/
|
||||
newStyleSheet: function (text) {
|
||||
newStyleSheet: method(function (text) {
|
||||
let parent = this.document.documentElement;
|
||||
let style = this.document.createElementNS("http://www.w3.org/1999/xhtml", "style");
|
||||
style.setAttribute("type", "text/css");
|
||||
|
@ -748,6 +755,35 @@ var StyleEditorActor = exports.StyleEditorActor = protocol.ActorClassWithSpec(st
|
|||
|
||||
let actor = this._createStyleSheetActor(style.sheet);
|
||||
return actor;
|
||||
}, {
|
||||
request: { text: Arg(0, "string") },
|
||||
response: { styleSheet: RetVal("old-stylesheet") }
|
||||
})
|
||||
});
|
||||
|
||||
/**
|
||||
* The corresponding Front object for the StyleEditorActor.
|
||||
*/
|
||||
var StyleEditorFront = protocol.FrontClass(StyleEditorActor, {
|
||||
initialize: function (client, tabForm) {
|
||||
protocol.Front.prototype.initialize.call(this, client);
|
||||
this.actorID = tabForm.styleEditorActor;
|
||||
this.manage(this);
|
||||
},
|
||||
|
||||
getStyleSheets: function () {
|
||||
let deferred = promise.defer();
|
||||
|
||||
events.once(this, "document-load", (styleSheets) => {
|
||||
deferred.resolve(styleSheets);
|
||||
});
|
||||
this.newDocument();
|
||||
|
||||
return deferred.promise;
|
||||
},
|
||||
|
||||
addStyleSheet: function (text) {
|
||||
return this.newStyleSheet(text);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -756,6 +792,10 @@ XPCOMUtils.defineLazyGetter(this, "DOMUtils", function () {
|
|||
});
|
||||
|
||||
exports.StyleEditorActor = StyleEditorActor;
|
||||
exports.StyleEditorFront = StyleEditorFront;
|
||||
|
||||
exports.OldStyleSheetActor = OldStyleSheetActor;
|
||||
exports.OldStyleSheetFront = OldStyleSheetFront;
|
||||
|
||||
/**
|
||||
* Normalize multiple relative paths towards the base paths on the right.
|
||||
|
|
|
@ -5,10 +5,7 @@
|
|||
|
||||
const { SimpleStringFront } = require("devtools/server/actors/string");
|
||||
const { Front, FrontClassWithSpec } = require("devtools/shared/protocol");
|
||||
const {
|
||||
oldStyleSheetSpec,
|
||||
styleEditorSpec
|
||||
} = require("devtools/shared/specs/styleeditor");
|
||||
const { oldStyleSheetSpec } = require("devtools/shared/specs/styleeditor");
|
||||
const promise = require("promise");
|
||||
const events = require("sdk/event/core");
|
||||
|
||||
|
@ -82,31 +79,3 @@ const OldStyleSheetFront = FrontClassWithSpec(oldStyleSheetSpec, {
|
|||
});
|
||||
|
||||
exports.OldStyleSheetFront = OldStyleSheetFront;
|
||||
|
||||
/**
|
||||
* The corresponding Front object for the StyleEditorActor.
|
||||
*/
|
||||
const StyleEditorFront = FrontClassWithSpec(styleEditorSpec, {
|
||||
initialize: function (client, tabForm) {
|
||||
Front.prototype.initialize.call(this, client);
|
||||
this.actorID = tabForm.styleEditorActor;
|
||||
this.manage(this);
|
||||
},
|
||||
|
||||
getStyleSheets: function () {
|
||||
let deferred = promise.defer();
|
||||
|
||||
events.once(this, "document-load", (styleSheets) => {
|
||||
deferred.resolve(styleSheets);
|
||||
});
|
||||
this.newDocument();
|
||||
|
||||
return deferred.promise;
|
||||
},
|
||||
|
||||
addStyleSheet: function (text) {
|
||||
return this.newStyleSheet(text);
|
||||
}
|
||||
});
|
||||
|
||||
exports.StyleEditorFront = StyleEditorFront;
|
||||
|
|
|
@ -38,24 +38,3 @@ const oldStyleSheetSpec = generateActorSpec({
|
|||
});
|
||||
|
||||
exports.oldStyleSheetSpec = oldStyleSheetSpec;
|
||||
|
||||
const styleEditorSpec = generateActorSpec({
|
||||
typeName: "styleeditor",
|
||||
|
||||
events: {
|
||||
"document-load": {
|
||||
type: "documentLoad",
|
||||
styleSheets: Arg(0, "array:old-stylesheet")
|
||||
}
|
||||
},
|
||||
|
||||
method: {
|
||||
newDocument: {},
|
||||
newStyleSheet: {
|
||||
request: { text: Arg(0, "string") },
|
||||
response: { styleSheet: RetVal("old-stylesheet") }
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
exports.styleEditorSpec = styleEditorSpec;
|
||||
|
|
Загрузка…
Ссылка в новой задаче