зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset e74192b1a9c8 (bug 1202458)
--HG-- extra : rebase_source : 95f662b3116ce3c9dc5357578a65672a1f3d5b2a
This commit is contained in:
Родитель
a5d777df66
Коммит
eb67af1f6f
|
@ -51,7 +51,7 @@ const TEST_DATA = [{
|
||||||
selector: "#longtext-and-node",
|
selector: "#longtext-and-node",
|
||||||
inline: false,
|
inline: false,
|
||||||
value: LONG_VALUE,
|
value: LONG_VALUE,
|
||||||
}];
|
}, ];
|
||||||
|
|
||||||
add_task(function* () {
|
add_task(function* () {
|
||||||
let {inspector, testActor} = yield openInspectorForURL(TEST_URL);
|
let {inspector, testActor} = yield openInspectorForURL(TEST_URL);
|
||||||
|
|
|
@ -52,11 +52,13 @@ exports.LongStringActor = protocol.ActorClass({
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When a caller is expecting a LongString actor but the string is already available on
|
* When a LongString on the server is short enough to be passed
|
||||||
* client, the SimpleStringFront can be used as it shares the same API as a
|
* as a full string, the client will get a ShortLongString instead of
|
||||||
* LongStringFront but will not make unnecessary trips to the server.
|
* a LongStringFront. Its API should match.
|
||||||
|
*
|
||||||
|
* I'm very proud of this name.
|
||||||
*/
|
*/
|
||||||
exports.SimpleStringFront = Class({
|
exports.ShortLongString = Class({
|
||||||
initialize: function (str) {
|
initialize: function (str) {
|
||||||
this.str = str;
|
this.str = str;
|
||||||
},
|
},
|
||||||
|
@ -139,7 +141,7 @@ protocol.types.addType("longstring", {
|
||||||
throw Error("Passing a longstring as an argument isn't supported.");
|
throw Error("Passing a longstring as an argument isn't supported.");
|
||||||
}
|
}
|
||||||
if (typeof (value) === "string") {
|
if (typeof (value) === "string") {
|
||||||
return exports.SimpleStringFront(value);
|
return exports.ShortLongString(value);
|
||||||
}
|
}
|
||||||
return stringActorType.read(value, context, detail);
|
return stringActorType.read(value, context, detail);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ const promise = require("promise");
|
||||||
const events = require("sdk/event/core");
|
const events = require("sdk/event/core");
|
||||||
const protocol = require("devtools/shared/protocol");
|
const protocol = require("devtools/shared/protocol");
|
||||||
const {Arg, Option, method, RetVal, types} = protocol;
|
const {Arg, Option, method, RetVal, types} = protocol;
|
||||||
const {LongStringActor} = require("devtools/server/actors/string");
|
const {LongStringActor, ShortLongString} = require("devtools/server/actors/string");
|
||||||
const {fetch} = require("devtools/shared/DevToolsUtils");
|
const {fetch} = require("devtools/shared/DevToolsUtils");
|
||||||
const {OldStyleSheetFront} = require("devtools/shared/fronts/styleeditor");
|
const {OldStyleSheetFront} = require("devtools/shared/fronts/styleeditor");
|
||||||
const {oldStyleSheetSpec} = require("devtools/shared/specs/styleeditor");
|
const {oldStyleSheetSpec} = require("devtools/shared/specs/styleeditor");
|
||||||
|
|
|
@ -16,7 +16,7 @@ const {Task} = require("devtools/shared/task");
|
||||||
const events = require("sdk/event/core");
|
const events = require("sdk/event/core");
|
||||||
const protocol = require("devtools/shared/protocol");
|
const protocol = require("devtools/shared/protocol");
|
||||||
const {Arg, Option, method, RetVal, types} = protocol;
|
const {Arg, Option, method, RetVal, types} = protocol;
|
||||||
const {LongStringActor} = require("devtools/server/actors/string");
|
const {LongStringActor, ShortLongString} = require("devtools/server/actors/string");
|
||||||
const {fetch} = require("devtools/shared/DevToolsUtils");
|
const {fetch} = require("devtools/shared/DevToolsUtils");
|
||||||
const {listenOnce} = require("devtools/shared/async-utils");
|
const {listenOnce} = require("devtools/shared/async-utils");
|
||||||
const {originalSourceSpec, mediaRuleSpec, styleSheetSpec,
|
const {originalSourceSpec, mediaRuleSpec, styleSheetSpec,
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
const { Ci } = require("chrome");
|
const { Ci } = require("chrome");
|
||||||
require("devtools/shared/fronts/styles");
|
require("devtools/shared/fronts/styles");
|
||||||
require("devtools/shared/fronts/highlighters");
|
require("devtools/shared/fronts/highlighters");
|
||||||
const { SimpleStringFront } = require("devtools/server/actors/string");
|
const { ShortLongString } = require("devtools/server/actors/string");
|
||||||
const {
|
const {
|
||||||
Front,
|
Front,
|
||||||
FrontClassWithSpec,
|
FrontClassWithSpec,
|
||||||
|
@ -321,7 +321,7 @@ const NodeFront = FrontClassWithSpec(nodeSpec, {
|
||||||
}
|
}
|
||||||
|
|
||||||
let str = this._form.nodeValue || "";
|
let str = this._form.nodeValue || "";
|
||||||
return promise.resolve(new SimpleStringFront(str));
|
return promise.resolve(new ShortLongString(str));
|
||||||
}, {
|
}, {
|
||||||
impl: "_getNodeValue"
|
impl: "_getNodeValue"
|
||||||
}),
|
}),
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const { SimpleStringFront } = require("devtools/server/actors/string");
|
const { ShortLongString } = require("devtools/server/actors/string");
|
||||||
const { Front, FrontClassWithSpec } = require("devtools/shared/protocol");
|
const { Front, FrontClassWithSpec } = require("devtools/shared/protocol");
|
||||||
const { oldStyleSheetSpec } = require("devtools/shared/specs/styleeditor");
|
const { oldStyleSheetSpec } = require("devtools/shared/specs/styleeditor");
|
||||||
const promise = require("promise");
|
const promise = require("promise");
|
||||||
|
@ -43,7 +43,7 @@ const OldStyleSheetFront = FrontClassWithSpec(oldStyleSheetSpec, {
|
||||||
let deferred = promise.defer();
|
let deferred = promise.defer();
|
||||||
|
|
||||||
events.once(this, "source-load", (source) => {
|
events.once(this, "source-load", (source) => {
|
||||||
let longStr = new SimpleStringFront(source);
|
let longStr = new ShortLongString(source);
|
||||||
deferred.resolve(longStr);
|
deferred.resolve(longStr);
|
||||||
});
|
});
|
||||||
this.fetchSource();
|
this.fetchSource();
|
||||||
|
|
Загрузка…
Ссылка в новой задаче