зеркало из https://github.com/mozilla/gecko-dev.git
merge fx-team to mozilla-central a=merge
This commit is contained in:
Коммит
d60d2af75a
|
@ -108,6 +108,7 @@ devtools/client/webconsole/**
|
||||||
!devtools/client/webconsole/jsterm.js
|
!devtools/client/webconsole/jsterm.js
|
||||||
devtools/client/webide/**
|
devtools/client/webide/**
|
||||||
devtools/server/**
|
devtools/server/**
|
||||||
|
!devtools/server/actors/webbrowser.js
|
||||||
devtools/shared/*.js
|
devtools/shared/*.js
|
||||||
!devtools/shared/css-color.js
|
!devtools/shared/css-color.js
|
||||||
devtools/shared/*.jsm
|
devtools/shared/*.jsm
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
%filter substitution
|
%filter substitution
|
||||||
|
|
||||||
%define toolbarHighlight hsla(0,0%,100%,.05)
|
%define toolbarHighlight hsla(0,0%,100%,.15)
|
||||||
%define toolbarHighlightLWT rgba(255,255,255,.4)
|
%define toolbarHighlightLWT rgba(255,255,255,.4)
|
||||||
/* navbarInsetHighlight is tightly coupled to the toolbarHighlight constant. */
|
/* navbarInsetHighlight is tightly coupled to the toolbarHighlight constant. */
|
||||||
%define navbarInsetHighlight hsla(0,0%,100%,.4)
|
%define navbarInsetHighlight hsla(0,0%,100%,.4)
|
||||||
|
|
|
@ -33,7 +33,7 @@ buildscript {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:1.5.0'
|
classpath 'com.android.tools.build:gradle:2.0.0'
|
||||||
classpath('com.stanfy.spoon:spoon-gradle-plugin:1.0.4') {
|
classpath('com.stanfy.spoon:spoon-gradle-plugin:1.0.4') {
|
||||||
// Without these, we get errors linting.
|
// Without these, we get errors linting.
|
||||||
exclude module: 'guava'
|
exclude module: 'guava'
|
||||||
|
|
|
@ -461,6 +461,7 @@ skip-if = e10s && debug
|
||||||
[browser_dbg_sources-eval-01.js]
|
[browser_dbg_sources-eval-01.js]
|
||||||
skip-if = true # non-named eval sources turned off for now, bug 1124106
|
skip-if = true # non-named eval sources turned off for now, bug 1124106
|
||||||
[browser_dbg_sources-eval-02.js]
|
[browser_dbg_sources-eval-02.js]
|
||||||
|
[browser_dbg_sources-iframe-reload.js]
|
||||||
[browser_dbg_sources-keybindings.js]
|
[browser_dbg_sources-keybindings.js]
|
||||||
skip-if = e10s && debug
|
skip-if = e10s && debug
|
||||||
[browser_dbg_sources-labels.js]
|
[browser_dbg_sources-labels.js]
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||||
|
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||||
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
|
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make sure iframe scripts don't disappear after few reloads (bug 1259743)
|
||||||
|
*/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
const IFRAME_URL = "data:text/html;charset=utf-8," +
|
||||||
|
"<script>function fn() { console.log('hello'); }</script>" +
|
||||||
|
"<div onclick='fn()'>hello</div>";
|
||||||
|
const TAB_URL = `data:text/html;charset=utf-8,<iframe src="${IFRAME_URL}"/>`;
|
||||||
|
|
||||||
|
add_task(function* () {
|
||||||
|
let [,, panel] = yield initDebugger("about:blank");
|
||||||
|
let dbg = panel.panelWin;
|
||||||
|
let newSource;
|
||||||
|
|
||||||
|
newSource = waitForDebuggerEvents(panel, dbg.EVENTS.NEW_SOURCE);
|
||||||
|
reload(panel, TAB_URL);
|
||||||
|
yield newSource;
|
||||||
|
ok(true, "Source event fired on initial load");
|
||||||
|
|
||||||
|
for (let i = 0; i < 5; i++) {
|
||||||
|
newSource = waitForDebuggerEvents(panel, dbg.EVENTS.NEW_SOURCE);
|
||||||
|
reload(panel);
|
||||||
|
yield newSource;
|
||||||
|
ok(true, `Source event fired after ${i + 1} reloads`);
|
||||||
|
}
|
||||||
|
|
||||||
|
yield closeDebuggerAndFinish(panel);
|
||||||
|
});
|
|
@ -12,7 +12,7 @@ const Services = require("Services");
|
||||||
|
|
||||||
const { XPCOMUtils } = Cu.import("resource://gre/modules/XPCOMUtils.jsm", {});
|
const { XPCOMUtils } = Cu.import("resource://gre/modules/XPCOMUtils.jsm", {});
|
||||||
|
|
||||||
XPCOMUtils.defineLazyGetter(this, "JsonViewService", function () {
|
XPCOMUtils.defineLazyGetter(this, "JsonViewUtils", function () {
|
||||||
return require("devtools/client/jsonview/utils");
|
return require("devtools/client/jsonview/utils");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -22,3 +22,4 @@ support-files =
|
||||||
[browser_jsonview_filter.js]
|
[browser_jsonview_filter.js]
|
||||||
[browser_jsonview_invalid_json.js]
|
[browser_jsonview_invalid_json.js]
|
||||||
[browser_jsonview_valid_json.js]
|
[browser_jsonview_valid_json.js]
|
||||||
|
[browser_jsonview_save_json.js]
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||||
|
/* vim: set ts=2 et sw=2 tw=80: */
|
||||||
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
|
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
const TEST_JSON_URL = URL_ROOT + "valid_json.json";
|
||||||
|
|
||||||
|
let { MockFilePicker } = SpecialPowers;
|
||||||
|
|
||||||
|
MockFilePicker.init(window);
|
||||||
|
MockFilePicker.returnValue = MockFilePicker.returnCancel;
|
||||||
|
|
||||||
|
registerCleanupFunction(function () {
|
||||||
|
MockFilePicker.cleanup();
|
||||||
|
});
|
||||||
|
|
||||||
|
add_task(function* () {
|
||||||
|
info("Test save JSON started");
|
||||||
|
|
||||||
|
yield addJsonViewTab(TEST_JSON_URL);
|
||||||
|
|
||||||
|
let promise = new Promise((resolve) => {
|
||||||
|
MockFilePicker.showCallback = () => {
|
||||||
|
MockFilePicker.showCallback = null;
|
||||||
|
ok(true, "File picker was opened");
|
||||||
|
resolve();
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
let browser = gBrowser.selectedBrowser;
|
||||||
|
yield BrowserTestUtils.synthesizeMouseAtCenter(
|
||||||
|
".jsonPanelBox button.save",
|
||||||
|
{}, browser);
|
||||||
|
|
||||||
|
yield promise;
|
||||||
|
});
|
|
@ -50,7 +50,7 @@
|
||||||
* we connect it up through its parents.
|
* we connect it up through its parents.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const {Cc, Ci, Cu, Cr} = require("chrome");
|
const {Cc, Ci, Cu} = require("chrome");
|
||||||
const Services = require("Services");
|
const Services = require("Services");
|
||||||
const protocol = require("devtools/server/protocol");
|
const protocol = require("devtools/server/protocol");
|
||||||
const {Arg, Option, method, RetVal, types} = protocol;
|
const {Arg, Option, method, RetVal, types} = protocol;
|
||||||
|
@ -59,7 +59,6 @@ const promise = require("promise");
|
||||||
const {Task} = Cu.import("resource://gre/modules/Task.jsm", {});
|
const {Task} = Cu.import("resource://gre/modules/Task.jsm", {});
|
||||||
const object = require("sdk/util/object");
|
const object = require("sdk/util/object");
|
||||||
const events = require("sdk/event/core");
|
const events = require("sdk/event/core");
|
||||||
const {Unknown} = require("sdk/platform/xpcom");
|
|
||||||
const {Class} = require("sdk/core/heritage");
|
const {Class} = require("sdk/core/heritage");
|
||||||
const {WalkerSearch} = require("devtools/server/actors/utils/walker-search");
|
const {WalkerSearch} = require("devtools/server/actors/utils/walker-search");
|
||||||
const {PageStyleActor, getFontPreviewData} = require("devtools/server/actors/styles");
|
const {PageStyleActor, getFontPreviewData} = require("devtools/server/actors/styles");
|
||||||
|
@ -89,7 +88,8 @@ const HIDDEN_CLASS = "__fx-devtools-hide-shortcut__";
|
||||||
const XHTML_NS = "http://www.w3.org/1999/xhtml";
|
const XHTML_NS = "http://www.w3.org/1999/xhtml";
|
||||||
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||||
const IMAGE_FETCHING_TIMEOUT = 500;
|
const IMAGE_FETCHING_TIMEOUT = 500;
|
||||||
const RX_FUNC_NAME = /((var|const|let)\s+)?([\w$.]+\s*[:=]\s*)*(function)?\s*\*?\s*([\w$]+)?\s*$/;
|
const RX_FUNC_NAME =
|
||||||
|
/((var|const|let)\s+)?([\w$.]+\s*[:=]\s*)*(function)?\s*\*?\s*([\w$]+)?\s*$/;
|
||||||
|
|
||||||
// The possible completions to a ':' with added score to give certain values
|
// The possible completions to a ':' with added score to give certain values
|
||||||
// some preference.
|
// some preference.
|
||||||
|
@ -123,8 +123,16 @@ const PSEUDO_SELECTORS = [
|
||||||
["::selection", 0]
|
["::selection", 0]
|
||||||
];
|
];
|
||||||
|
|
||||||
var HELPER_SHEET = ".__fx-devtools-hide-shortcut__ { visibility: hidden !important } ";
|
var HELPER_SHEET = `
|
||||||
HELPER_SHEET += ":-moz-devtools-highlighted { outline: 2px dashed #F06!important; outline-offset: -2px!important } ";
|
.__fx-devtools-hide-shortcut__ {
|
||||||
|
visibility: hidden !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
:-moz-devtools-highlighted {
|
||||||
|
outline: 2px dashed #F06!important;
|
||||||
|
outline-offset: -2px !important;
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
loader.lazyRequireGetter(this, "DevToolsUtils",
|
loader.lazyRequireGetter(this, "DevToolsUtils",
|
||||||
"devtools/shared/DevToolsUtils");
|
"devtools/shared/DevToolsUtils");
|
||||||
|
@ -132,7 +140,8 @@ loader.lazyRequireGetter(this, "DevToolsUtils",
|
||||||
loader.lazyRequireGetter(this, "AsyncUtils", "devtools/shared/async-utils");
|
loader.lazyRequireGetter(this, "AsyncUtils", "devtools/shared/async-utils");
|
||||||
|
|
||||||
loader.lazyGetter(this, "DOMParser", function () {
|
loader.lazyGetter(this, "DOMParser", function () {
|
||||||
return Cc["@mozilla.org/xmlextras/domparser;1"].createInstance(Ci.nsIDOMParser);
|
return Cc["@mozilla.org/xmlextras/domparser;1"]
|
||||||
|
.createInstance(Ci.nsIDOMParser);
|
||||||
});
|
});
|
||||||
|
|
||||||
loader.lazyGetter(this, "eventListenerService", function () {
|
loader.lazyGetter(this, "eventListenerService", function () {
|
||||||
|
@ -152,13 +161,13 @@ function makeInfallible(handler) {
|
||||||
console.error(ex);
|
console.error(ex);
|
||||||
}
|
}
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// A resolve that hits the main loop first.
|
// A resolve that hits the main loop first.
|
||||||
function delayedResolve(value) {
|
function delayedResolve(value) {
|
||||||
let deferred = promise.defer();
|
let deferred = promise.defer();
|
||||||
Services.tm.mainThread.dispatch(makeInfallible(function delayedResolveHandler() {
|
Services.tm.mainThread.dispatch(makeInfallible(() => {
|
||||||
deferred.resolve(value);
|
deferred.resolve(value);
|
||||||
}), 0);
|
}), 0);
|
||||||
return deferred.promise;
|
return deferred.promise;
|
||||||
|
@ -218,7 +227,8 @@ var NodeActor = exports.NodeActor = protocol.ActorClass({
|
||||||
},
|
},
|
||||||
|
|
||||||
toString: function () {
|
toString: function () {
|
||||||
return "[NodeActor " + this.actorID + " for " + this.rawNode.toString() + "]";
|
return "[NodeActor " + this.actorID + " for " +
|
||||||
|
this.rawNode.toString() + "]";
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -294,7 +304,8 @@ var NodeActor = exports.NodeActor = protocol.ActorClass({
|
||||||
// We only include a short version of the value if it's longer than
|
// We only include a short version of the value if it's longer than
|
||||||
// gValueSummaryLength
|
// gValueSummaryLength
|
||||||
if (this.rawNode.nodeValue.length > gValueSummaryLength) {
|
if (this.rawNode.nodeValue.length > gValueSummaryLength) {
|
||||||
form.shortValue = this.rawNode.nodeValue.substring(0, gValueSummaryLength);
|
form.shortValue = this.rawNode.nodeValue
|
||||||
|
.substring(0, gValueSummaryLength);
|
||||||
form.incompleteValue = true;
|
form.incompleteValue = true;
|
||||||
} else {
|
} else {
|
||||||
form.shortValue = this.rawNode.nodeValue;
|
form.shortValue = this.rawNode.nodeValue;
|
||||||
|
@ -341,11 +352,11 @@ var NodeActor = exports.NodeActor = protocol.ActorClass({
|
||||||
},
|
},
|
||||||
|
|
||||||
get isBeforePseudoElement() {
|
get isBeforePseudoElement() {
|
||||||
return this.rawNode.nodeName === "_moz_generated_content_before"
|
return this.rawNode.nodeName === "_moz_generated_content_before";
|
||||||
},
|
},
|
||||||
|
|
||||||
get isAfterPseudoElement() {
|
get isAfterPseudoElement() {
|
||||||
return this.rawNode.nodeName === "_moz_generated_content_after"
|
return this.rawNode.nodeName === "_moz_generated_content_after";
|
||||||
},
|
},
|
||||||
|
|
||||||
// Estimate the number of children that the walker will return without making
|
// Estimate the number of children that the walker will return without making
|
||||||
|
@ -396,9 +407,9 @@ var NodeActor = exports.NodeActor = protocol.ActorClass({
|
||||||
let style = this.computedStyle;
|
let style = this.computedStyle;
|
||||||
if (!style) {
|
if (!style) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
|
||||||
return style.display !== "none";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return style.display !== "none";
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -712,18 +723,18 @@ var NodeActor = exports.NodeActor = protocol.ActorClass({
|
||||||
for (let change of modifications) {
|
for (let change of modifications) {
|
||||||
if (change.newValue == null) {
|
if (change.newValue == null) {
|
||||||
if (change.attributeNamespace) {
|
if (change.attributeNamespace) {
|
||||||
rawNode.removeAttributeNS(change.attributeNamespace, change.attributeName);
|
rawNode.removeAttributeNS(change.attributeNamespace,
|
||||||
|
change.attributeName);
|
||||||
} else {
|
} else {
|
||||||
rawNode.removeAttribute(change.attributeName);
|
rawNode.removeAttribute(change.attributeName);
|
||||||
}
|
}
|
||||||
} else {
|
} else if (change.attributeNamespace) {
|
||||||
if (change.attributeNamespace) {
|
rawNode.setAttributeNS(change.attributeNamespace, change.attributeName,
|
||||||
rawNode.setAttributeNS(change.attributeNamespace, change.attributeName, change.newValue);
|
change.newValue);
|
||||||
} else {
|
} else {
|
||||||
rawNode.setAttribute(change.attributeName, change.newValue);
|
rawNode.setAttribute(change.attributeName, change.newValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}, {
|
}, {
|
||||||
request: {
|
request: {
|
||||||
modifications: Arg(0, "array:json")
|
modifications: Arg(0, "array:json")
|
||||||
|
@ -744,7 +755,7 @@ var NodeActor = exports.NodeActor = protocol.ActorClass({
|
||||||
previewText: FONT_FAMILY_PREVIEW_TEXT,
|
previewText: FONT_FAMILY_PREVIEW_TEXT,
|
||||||
previewFontSize: FONT_FAMILY_PREVIEW_TEXT_SIZE,
|
previewFontSize: FONT_FAMILY_PREVIEW_TEXT_SIZE,
|
||||||
fillStyle: fillStyle
|
fillStyle: fillStyle
|
||||||
}
|
};
|
||||||
let { dataURL, size } = getFontPreviewData(font, doc, options);
|
let { dataURL, size } = getFontPreviewData(font, doc, options);
|
||||||
|
|
||||||
return { data: LongStringActor(this.conn, dataURL), size: size };
|
return { data: LongStringActor(this.conn, dataURL), size: size };
|
||||||
|
@ -770,10 +781,14 @@ var NodeActor = exports.NodeActor = protocol.ActorClass({
|
||||||
*/
|
*/
|
||||||
var NodeFront = protocol.FrontClass(NodeActor, {
|
var NodeFront = protocol.FrontClass(NodeActor, {
|
||||||
initialize: function (conn, form, detail, ctx) {
|
initialize: function (conn, form, detail, ctx) {
|
||||||
this._parent = null; // The parent node
|
// The parent node
|
||||||
this._child = null; // The first child of this node.
|
this._parent = null;
|
||||||
this._next = null; // The next sibling of this node.
|
// The first child of this node.
|
||||||
this._prev = null; // The previous sibling of this node.
|
this._child = null;
|
||||||
|
// The next sibling of this node.
|
||||||
|
this._next = null;
|
||||||
|
// The previous sibling of this node.
|
||||||
|
this._prev = null;
|
||||||
protocol.Front.prototype.initialize.call(this, conn, form, detail, ctx);
|
protocol.Front.prototype.initialize.call(this, conn, form, detail, ctx);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -881,10 +896,10 @@ var NodeFront = protocol.FrontClass(NodeActor, {
|
||||||
return this._form.nodeName;
|
return this._form.nodeName;
|
||||||
},
|
},
|
||||||
get doctypeString() {
|
get doctypeString() {
|
||||||
return '<!DOCTYPE ' + this._form.name +
|
return "<!DOCTYPE " + this._form.name +
|
||||||
(this._form.publicId ? ' PUBLIC "' + this._form.publicId + '"': '') +
|
(this._form.publicId ? " PUBLIC \"" + this._form.publicId + "\"" : "") +
|
||||||
(this._form.systemId ? ' "' + this._form.systemId + '"' : '') +
|
(this._form.systemId ? " \"" + this._form.systemId + "\"" : "") +
|
||||||
'>';
|
">";
|
||||||
},
|
},
|
||||||
|
|
||||||
get baseURI() {
|
get baseURI() {
|
||||||
|
@ -892,7 +907,7 @@ var NodeFront = protocol.FrontClass(NodeActor, {
|
||||||
},
|
},
|
||||||
|
|
||||||
get className() {
|
get className() {
|
||||||
return this.getAttribute("class") || '';
|
return this.getAttribute("class") || "";
|
||||||
},
|
},
|
||||||
|
|
||||||
get hasChildren() {
|
get hasChildren() {
|
||||||
|
@ -990,9 +1005,9 @@ var NodeFront = protocol.FrontClass(NodeActor, {
|
||||||
getNodeValue: protocol.custom(function () {
|
getNodeValue: protocol.custom(function () {
|
||||||
if (!this.incompleteValue) {
|
if (!this.incompleteValue) {
|
||||||
return delayedResolve(new ShortLongString(this.shortValue));
|
return delayedResolve(new ShortLongString(this.shortValue));
|
||||||
} else {
|
|
||||||
return this._getNodeValue();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return this._getNodeValue();
|
||||||
}, {
|
}, {
|
||||||
impl: "_getNodeValue"
|
impl: "_getNodeValue"
|
||||||
}),
|
}),
|
||||||
|
@ -1019,7 +1034,7 @@ var NodeFront = protocol.FrontClass(NodeActor, {
|
||||||
},
|
},
|
||||||
|
|
||||||
_cacheAttributes: function () {
|
_cacheAttributes: function () {
|
||||||
if (typeof(this._attrMap) != "undefined") {
|
if (typeof this._attrMap != "undefined") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this._attrMap = {};
|
this._attrMap = {};
|
||||||
|
@ -1109,14 +1124,15 @@ var NodeFront = protocol.FrontClass(NodeActor, {
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returned from any call that might return a node that isn't connected to root by
|
* Returned from any call that might return a node that isn't connected to root
|
||||||
* nodes the child has seen, such as querySelector.
|
* by nodes the child has seen, such as querySelector.
|
||||||
*/
|
*/
|
||||||
types.addDictType("disconnectedNode", {
|
types.addDictType("disconnectedNode", {
|
||||||
// The actual node to return
|
// The actual node to return
|
||||||
node: "domnode",
|
node: "domnode",
|
||||||
|
|
||||||
// Nodes that are needed to connect the node to a node the client has already seen
|
// Nodes that are needed to connect the node to a node the client has already
|
||||||
|
// seen
|
||||||
newParents: "array:domnode"
|
newParents: "array:domnode"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1173,7 +1189,7 @@ var NodeListActor = exports.NodeListActor = protocol.ActorClass({
|
||||||
return {
|
return {
|
||||||
actor: this.actorID,
|
actor: this.actorID,
|
||||||
length: this.nodeList ? this.nodeList.length : 0
|
length: this.nodeList ? this.nodeList.length : 0
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1190,7 +1206,8 @@ var NodeListActor = exports.NodeListActor = protocol.ActorClass({
|
||||||
* Get a range of the items from the node list.
|
* Get a range of the items from the node list.
|
||||||
*/
|
*/
|
||||||
items: method(function (start = 0, end = this.nodeList.length) {
|
items: method(function (start = 0, end = this.nodeList.length) {
|
||||||
let items = Array.prototype.slice.call(this.nodeList, start, end).map(item => this.walker._ref(item));
|
let items = Array.prototype.slice.call(this.nodeList, start, end)
|
||||||
|
.map(item => this.walker._ref(item));
|
||||||
return this.walker.attachElements(items);
|
return this.walker.attachElements(items);
|
||||||
}, {
|
}, {
|
||||||
request: {
|
request: {
|
||||||
|
@ -1206,7 +1223,7 @@ var NodeListActor = exports.NodeListActor = protocol.ActorClass({
|
||||||
/**
|
/**
|
||||||
* Client side of a node list as returned by querySelectorAll()
|
* Client side of a node list as returned by querySelectorAll()
|
||||||
*/
|
*/
|
||||||
var NodeListFront = exports.NodeListFront = protocol.FrontClass(NodeListActor, {
|
var NodeListFront = protocol.FrontClass(NodeListActor, {
|
||||||
initialize: function (client, form) {
|
initialize: function (client, form) {
|
||||||
protocol.Front.prototype.initialize.call(this, client, form);
|
protocol.Front.prototype.initialize.call(this, client, form);
|
||||||
},
|
},
|
||||||
|
@ -1241,6 +1258,8 @@ var NodeListFront = exports.NodeListFront = protocol.FrontClass(NodeListActor, {
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
exports.NodeListFront = NodeListFront;
|
||||||
|
|
||||||
// Some common request/response templates for the dom walker
|
// Some common request/response templates for the dom walker
|
||||||
|
|
||||||
var nodeArrayMethod = {
|
var nodeArrayMethod = {
|
||||||
|
@ -1264,7 +1283,7 @@ var traversalMethod = {
|
||||||
response: {
|
response: {
|
||||||
node: RetVal("nullable:domnode")
|
node: RetVal("nullable:domnode")
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Server side of the DOM walker.
|
* Server side of the DOM walker.
|
||||||
|
@ -1389,12 +1408,12 @@ var WalkerActor = protocol.ActorClass({
|
||||||
autoReleased: true,
|
autoReleased: true,
|
||||||
// XXX: It seems silly that we need to tell the front which capabilities
|
// XXX: It seems silly that we need to tell the front which capabilities
|
||||||
// its actor has in this way when the target can use actorHasMethod. If
|
// its actor has in this way when the target can use actorHasMethod. If
|
||||||
// this was ported to the protocol (Bug 1157048) we could call that inside
|
// this was ported to the protocol (Bug 1157048) we could call that
|
||||||
// of custom front methods and not need to do traits for this.
|
// inside of custom front methods and not need to do traits for this.
|
||||||
multiFrameQuerySelectorAll: true,
|
multiFrameQuerySelectorAll: true,
|
||||||
textSearch: true,
|
textSearch: true,
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
toString: function () {
|
toString: function () {
|
||||||
|
@ -1452,7 +1471,6 @@ var WalkerActor = protocol.ActorClass({
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
release: method(function () {}, { release: true }),
|
release: method(function () {}, { release: true }),
|
||||||
|
@ -1553,9 +1571,14 @@ var WalkerActor = protocol.ActorClass({
|
||||||
* Keeping these actor methods for now allows newer client-side debuggers to
|
* Keeping these actor methods for now allows newer client-side debuggers to
|
||||||
* inspect fxos 1.2 remote targets or older firefox desktop remote targets.
|
* inspect fxos 1.2 remote targets or older firefox desktop remote targets.
|
||||||
*/
|
*/
|
||||||
pick: method(function() {}, {request: {}, response: RetVal("disconnectedNode")}),
|
pick: method(function () {}, {
|
||||||
|
request: {},
|
||||||
|
response: RetVal("disconnectedNode")
|
||||||
|
}),
|
||||||
cancelPick: method(function () {}),
|
cancelPick: method(function () {}),
|
||||||
highlight: method(function(node) {}, {request: {node: Arg(0, "nullable:domnode")}}),
|
highlight: method(function (node) {}, {
|
||||||
|
request: {node: Arg(0, "nullable:domnode")}
|
||||||
|
}),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ensures that the node is attached and it can be accessed from the root.
|
* Ensures that the node is attached and it can be accessed from the root.
|
||||||
|
@ -1657,12 +1680,14 @@ var WalkerActor = protocol.ActorClass({
|
||||||
let parents = [];
|
let parents = [];
|
||||||
let cur;
|
let cur;
|
||||||
while((cur = walker.parentNode())) {
|
while((cur = walker.parentNode())) {
|
||||||
if (options.sameDocument && nodeDocument(cur) != nodeDocument(node.rawNode)) {
|
if (options.sameDocument &&
|
||||||
|
nodeDocument(cur) != nodeDocument(node.rawNode)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.sameTypeRootTreeItem &&
|
if (options.sameTypeRootTreeItem &&
|
||||||
nodeDocshell(cur).sameTypeRootTreeItem != nodeDocshell(node.rawNode).sameTypeRootTreeItem) {
|
nodeDocshell(cur).sameTypeRootTreeItem !=
|
||||||
|
nodeDocshell(node.rawNode).sameTypeRootTreeItem) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1856,9 +1881,9 @@ var WalkerActor = protocol.ActorClass({
|
||||||
|
|
||||||
// We're going to create a few document walkers with the same filter,
|
// We're going to create a few document walkers with the same filter,
|
||||||
// make it easier.
|
// make it easier.
|
||||||
let getFilteredWalker = (node) => {
|
let getFilteredWalker = node => {
|
||||||
return this.getDocumentWalker(node, options.whatToShow);
|
return this.getDocumentWalker(node, options.whatToShow);
|
||||||
}
|
};
|
||||||
|
|
||||||
// Need to know the first and last child.
|
// Need to know the first and last child.
|
||||||
let rawNode = node.rawNode;
|
let rawNode = node.rawNode;
|
||||||
|
@ -1944,7 +1969,8 @@ var WalkerActor = protocol.ActorClass({
|
||||||
return { hasFirst: true, hasLast: true, nodes: [] };
|
return { hasFirst: true, hasLast: true, nodes: [] };
|
||||||
}
|
}
|
||||||
|
|
||||||
let parentNode = this.getDocumentWalker(node.rawNode, options.whatToShow).parentNode();
|
let parentNode = this.getDocumentWalker(node.rawNode, options.whatToShow)
|
||||||
|
.parentNode();
|
||||||
if (!parentNode) {
|
if (!parentNode) {
|
||||||
return {
|
return {
|
||||||
hasFirst: true,
|
hasFirst: true,
|
||||||
|
@ -2037,8 +2063,8 @@ var WalkerActor = protocol.ActorClass({
|
||||||
findInspectingNode: method(function () {
|
findInspectingNode: method(function () {
|
||||||
let node = gInspectingNode;
|
let node = gInspectingNode;
|
||||||
if (!node) {
|
if (!node) {
|
||||||
return {}
|
return {};
|
||||||
};
|
}
|
||||||
|
|
||||||
return this.attachElement(node);
|
return this.attachElement(node);
|
||||||
}, {
|
}, {
|
||||||
|
@ -2060,8 +2086,8 @@ var WalkerActor = protocol.ActorClass({
|
||||||
|
|
||||||
let node = baseNode.rawNode.querySelector(selector);
|
let node = baseNode.rawNode.querySelector(selector);
|
||||||
if (!node) {
|
if (!node) {
|
||||||
return {}
|
return {};
|
||||||
};
|
}
|
||||||
|
|
||||||
return this.attachElement(node);
|
return this.attachElement(node);
|
||||||
}, {
|
}, {
|
||||||
|
@ -2152,7 +2178,7 @@ var WalkerActor = protocol.ActorClass({
|
||||||
return {
|
return {
|
||||||
list: nodeList,
|
list: nodeList,
|
||||||
metadata: []
|
metadata: []
|
||||||
}
|
};
|
||||||
}, {
|
}, {
|
||||||
request: {
|
request: {
|
||||||
query: Arg(0),
|
query: Arg(0),
|
||||||
|
@ -2174,9 +2200,9 @@ var WalkerActor = protocol.ActorClass({
|
||||||
*/
|
*/
|
||||||
getSuggestionsForQuery: method(function (query, completing, selectorState) {
|
getSuggestionsForQuery: method(function (query, completing, selectorState) {
|
||||||
let sugs = {
|
let sugs = {
|
||||||
classes: new Map,
|
classes: new Map(),
|
||||||
tags: new Map,
|
tags: new Map(),
|
||||||
ids: new Map
|
ids: new Map()
|
||||||
};
|
};
|
||||||
let result = [];
|
let result = [];
|
||||||
let nodes = null;
|
let nodes = null;
|
||||||
|
@ -2191,8 +2217,7 @@ var WalkerActor = protocol.ActorClass({
|
||||||
case "class":
|
case "class":
|
||||||
if (!query) {
|
if (!query) {
|
||||||
nodes = this._multiFrameQuerySelectorAll("[class]");
|
nodes = this._multiFrameQuerySelectorAll("[class]");
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
nodes = this._multiFrameQuerySelectorAll(query);
|
nodes = this._multiFrameQuerySelectorAll(query);
|
||||||
}
|
}
|
||||||
for (let node of nodes) {
|
for (let node of nodes) {
|
||||||
|
@ -2216,8 +2241,7 @@ var WalkerActor = protocol.ActorClass({
|
||||||
case "id":
|
case "id":
|
||||||
if (!query) {
|
if (!query) {
|
||||||
nodes = this._multiFrameQuerySelectorAll("[id]");
|
nodes = this._multiFrameQuerySelectorAll("[id]");
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
nodes = this._multiFrameQuerySelectorAll(query);
|
nodes = this._multiFrameQuerySelectorAll(query);
|
||||||
}
|
}
|
||||||
for (let node of nodes) {
|
for (let node of nodes) {
|
||||||
|
@ -2233,8 +2257,7 @@ var WalkerActor = protocol.ActorClass({
|
||||||
case "tag":
|
case "tag":
|
||||||
if (!query) {
|
if (!query) {
|
||||||
nodes = this._multiFrameQuerySelectorAll("*");
|
nodes = this._multiFrameQuerySelectorAll("*");
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
nodes = this._multiFrameQuerySelectorAll(query);
|
nodes = this._multiFrameQuerySelectorAll(query);
|
||||||
}
|
}
|
||||||
for (let node of nodes) {
|
for (let node of nodes) {
|
||||||
|
@ -2252,8 +2275,10 @@ var WalkerActor = protocol.ActorClass({
|
||||||
if (!query) {
|
if (!query) {
|
||||||
result = [
|
result = [
|
||||||
...result,
|
...result,
|
||||||
...this.getSuggestionsForQuery(null, completing, "class").suggestions,
|
...this.getSuggestionsForQuery(null, completing, "class")
|
||||||
...this.getSuggestionsForQuery(null, completing, "id").suggestions
|
.suggestions,
|
||||||
|
...this.getSuggestionsForQuery(null, completing, "id")
|
||||||
|
.suggestions
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2298,21 +2323,17 @@ var WalkerActor = protocol.ActorClass({
|
||||||
|
|
||||||
if (firstA === "#") {
|
if (firstA === "#") {
|
||||||
sortA = "2" + sortA;
|
sortA = "2" + sortA;
|
||||||
}
|
} else if (firstA === ".") {
|
||||||
else if (firstA === ".") {
|
|
||||||
sortA = "1" + sortA;
|
sortA = "1" + sortA;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sortA = "0" + sortA;
|
sortA = "0" + sortA;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (firstB === "#") {
|
if (firstB === "#") {
|
||||||
sortB = "2" + sortB;
|
sortB = "2" + sortB;
|
||||||
}
|
} else if (firstB === ".") {
|
||||||
else if (firstB === ".") {
|
|
||||||
sortB = "1" + sortB;
|
sortB = "1" + sortB;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sortB = "0" + sortB;
|
sortB = "0" + sortB;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2397,7 +2418,7 @@ var WalkerActor = protocol.ActorClass({
|
||||||
|
|
||||||
_installHelperSheet: function (node) {
|
_installHelperSheet: function (node) {
|
||||||
if (!this.installedHelpers) {
|
if (!this.installedHelpers) {
|
||||||
this.installedHelpers = new WeakMap;
|
this.installedHelpers = new WeakMap();
|
||||||
}
|
}
|
||||||
let win = node.rawNode.ownerDocument.defaultView;
|
let win = node.rawNode.ownerDocument.defaultView;
|
||||||
if (!this.installedHelpers.has(win)) {
|
if (!this.installedHelpers.has(win)) {
|
||||||
|
@ -2540,8 +2561,9 @@ var WalkerActor = protocol.ActorClass({
|
||||||
}
|
}
|
||||||
|
|
||||||
let rawNode = node.rawNode;
|
let rawNode = node.rawNode;
|
||||||
if (rawNode.nodeType !== rawNode.ownerDocument.ELEMENT_NODE)
|
if (rawNode.nodeType !== rawNode.ownerDocument.ELEMENT_NODE) {
|
||||||
throw new Error("Can only change innerHTML to element nodes");
|
throw new Error("Can only change innerHTML to element nodes");
|
||||||
|
}
|
||||||
rawNode.innerHTML = value;
|
rawNode.innerHTML = value;
|
||||||
}, {
|
}, {
|
||||||
request: {
|
request: {
|
||||||
|
@ -2643,7 +2665,7 @@ var WalkerActor = protocol.ActorClass({
|
||||||
*/
|
*/
|
||||||
insertAdjacentHTML: method(function (node, position, value) {
|
insertAdjacentHTML: method(function (node, position, value) {
|
||||||
if (isNodeDead(node)) {
|
if (isNodeDead(node)) {
|
||||||
return {node: [], newParents: []}
|
return {node: [], newParents: []};
|
||||||
}
|
}
|
||||||
|
|
||||||
let rawNode = node.rawNode;
|
let rawNode = node.rawNode;
|
||||||
|
@ -2685,6 +2707,7 @@ var WalkerActor = protocol.ActorClass({
|
||||||
// Note: if the second argument is null, rawParentNode.insertBefore
|
// Note: if the second argument is null, rawParentNode.insertBefore
|
||||||
// behaves like rawParentNode.appendChild.
|
// behaves like rawParentNode.appendChild.
|
||||||
rawParentNode.insertBefore(docFrag, rawNode.nextSibling);
|
rawParentNode.insertBefore(docFrag, rawNode.nextSibling);
|
||||||
|
break;
|
||||||
case "afterBegin":
|
case "afterBegin":
|
||||||
rawNode.insertBefore(docFrag, rawNode.firstChild);
|
rawNode.insertBefore(docFrag, rawNode.firstChild);
|
||||||
break;
|
break;
|
||||||
|
@ -2692,8 +2715,8 @@ var WalkerActor = protocol.ActorClass({
|
||||||
rawNode.appendChild(docFrag);
|
rawNode.appendChild(docFrag);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new Error('Invalid position value. Must be either ' +
|
throw new Error("Invalid position value. Must be either " +
|
||||||
'"beforeBegin", "beforeEnd", "afterBegin" or "afterEnd".');
|
"'beforeBegin', 'beforeEnd', 'afterBegin' or 'afterEnd'.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.attachElements(newRawNodes);
|
return this.attachElements(newRawNodes);
|
||||||
|
@ -2803,7 +2826,7 @@ var WalkerActor = protocol.ActorClass({
|
||||||
null;
|
null;
|
||||||
|
|
||||||
if (rawNode === rawSibling || currentNextSibling === rawSibling) {
|
if (rawNode === rawSibling || currentNextSibling === rawSibling) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2825,7 +2848,7 @@ var WalkerActor = protocol.ActorClass({
|
||||||
*/
|
*/
|
||||||
editTagName: method(function (node, tagName) {
|
editTagName: method(function (node, tagName) {
|
||||||
if (isNodeDead(node)) {
|
if (isNodeDead(node)) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
let oldNode = node.rawNode;
|
let oldNode = node.rawNode;
|
||||||
|
@ -2838,7 +2861,8 @@ var WalkerActor = protocol.ActorClass({
|
||||||
} catch(x) {
|
} catch(x) {
|
||||||
// Failed to create a new element with that tag name, ignore the change,
|
// Failed to create a new element with that tag name, ignore the change,
|
||||||
// and signal the error to the front.
|
// and signal the error to the front.
|
||||||
return Promise.reject(new Error("Could not change node's tagName to " + tagName));
|
return Promise.reject(new Error("Could not change node's tagName to " +
|
||||||
|
tagName));
|
||||||
}
|
}
|
||||||
|
|
||||||
let attrs = oldNode.attributes;
|
let attrs = oldNode.attributes;
|
||||||
|
@ -2977,7 +3001,8 @@ var WalkerActor = protocol.ActorClass({
|
||||||
: null;
|
: null;
|
||||||
} else if (type === "characterData") {
|
} else if (type === "characterData") {
|
||||||
if (targetNode.nodeValue.length > gValueSummaryLength) {
|
if (targetNode.nodeValue.length > gValueSummaryLength) {
|
||||||
mutation.newValue = targetNode.nodeValue.substring(0, gValueSummaryLength);
|
mutation.newValue = targetNode.nodeValue
|
||||||
|
.substring(0, gValueSummaryLength);
|
||||||
mutation.incompleteValue = true;
|
mutation.incompleteValue = true;
|
||||||
} else {
|
} else {
|
||||||
mutation.newValue = targetNode.nodeValue;
|
mutation.newValue = targetNode.nodeValue;
|
||||||
|
@ -3053,7 +3078,7 @@ var WalkerActor = protocol.ActorClass({
|
||||||
target: frameActor.actorID,
|
target: frameActor.actorID,
|
||||||
added: [],
|
added: [],
|
||||||
removed: []
|
removed: []
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
// Returns true if domNode is in window or a subframe.
|
// Returns true if domNode is in window or a subframe.
|
||||||
|
@ -3166,7 +3191,8 @@ var WalkerActor = protocol.ActorClass({
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given an ObjectActor (identified by its ID), commonly used in the debugger,
|
* Given an ObjectActor (identified by its ID), commonly used in the debugger,
|
||||||
* webconsole and variablesView, return the corresponding inspector's NodeActor
|
* webconsole and variablesView, return the corresponding inspector's
|
||||||
|
* NodeActor
|
||||||
*/
|
*/
|
||||||
getNodeActorFromObjectActor: method(function (objectActorID) {
|
getNodeActorFromObjectActor: method(function (objectActorID) {
|
||||||
let actor = this.conn.getActor(objectActorID);
|
let actor = this.conn.getActor(objectActorID);
|
||||||
|
@ -3241,7 +3267,8 @@ var WalkerActor = protocol.ActorClass({
|
||||||
* @param {Array} path Where, on the actor, is the DOM node stored. If in the
|
* @param {Array} path Where, on the actor, is the DOM node stored. If in the
|
||||||
* scope of the actor, the node is available as `this.data.node`, then this
|
* scope of the actor, the node is available as `this.data.node`, then this
|
||||||
* should be ["data", "node"].
|
* should be ["data", "node"].
|
||||||
* @return {NodeActor} The attached NodeActor, or null if it couldn't be found.
|
* @return {NodeActor} The attached NodeActor, or null if it couldn't be
|
||||||
|
* found.
|
||||||
*/
|
*/
|
||||||
getNodeFromActor: method(function (actorID, path) {
|
getNodeFromActor: method(function (actorID, path) {
|
||||||
let actor = this.conn.getActor(actorID);
|
let actor = this.conn.getActor(actorID);
|
||||||
|
@ -3272,7 +3299,7 @@ var WalkerActor = protocol.ActorClass({
|
||||||
/**
|
/**
|
||||||
* Client side of the DOM walker.
|
* Client side of the DOM walker.
|
||||||
*/
|
*/
|
||||||
var WalkerFront = exports.WalkerFront = protocol.FrontClass(WalkerActor, {
|
var WalkerFront = protocol.FrontClass(WalkerActor, {
|
||||||
// Set to true if cleanup should be requested after every mutation list.
|
// Set to true if cleanup should be requested after every mutation list.
|
||||||
autoCleanup: true,
|
autoCleanup: true,
|
||||||
|
|
||||||
|
@ -3547,20 +3574,23 @@ var WalkerFront = exports.WalkerFront = protocol.FrontClass(WalkerActor, {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!targetFront) {
|
if (!targetFront) {
|
||||||
console.trace("Got a mutation for an unexpected actor: " + targetID + ", please file a bug on bugzilla.mozilla.org!");
|
console.trace("Got a mutation for an unexpected actor: " + targetID +
|
||||||
|
", please file a bug on bugzilla.mozilla.org!");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
let emittedMutation = object.merge(change, { target: targetFront });
|
let emittedMutation = object.merge(change, { target: targetFront });
|
||||||
|
|
||||||
if (change.type === "childList" || change.type === "nativeAnonymousChildList") {
|
if (change.type === "childList" ||
|
||||||
|
change.type === "nativeAnonymousChildList") {
|
||||||
// Update the ownership tree according to the mutation record.
|
// Update the ownership tree according to the mutation record.
|
||||||
let addedFronts = [];
|
let addedFronts = [];
|
||||||
let removedFronts = [];
|
let removedFronts = [];
|
||||||
for (let removed of change.removed) {
|
for (let removed of change.removed) {
|
||||||
let removedFront = this.get(removed);
|
let removedFront = this.get(removed);
|
||||||
if (!removedFront) {
|
if (!removedFront) {
|
||||||
console.error("Got a removal of an actor we didn't know about: " + removed);
|
console.error("Got a removal of an actor we didn't know about: " +
|
||||||
|
removed);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Remove from the ownership tree
|
// Remove from the ownership tree
|
||||||
|
@ -3574,10 +3604,11 @@ var WalkerFront = exports.WalkerFront = protocol.FrontClass(WalkerActor, {
|
||||||
for (let added of change.added) {
|
for (let added of change.added) {
|
||||||
let addedFront = this.get(added);
|
let addedFront = this.get(added);
|
||||||
if (!addedFront) {
|
if (!addedFront) {
|
||||||
console.error("Got an addition of an actor we didn't know about: " + added);
|
console.error("Got an addition of an actor we didn't know " +
|
||||||
|
"about: " + added);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
addedFront.reparent(targetFront)
|
addedFront.reparent(targetFront);
|
||||||
|
|
||||||
// The actor is reconnected to the ownership tree, unorphan
|
// The actor is reconnected to the ownership tree, unorphan
|
||||||
// it.
|
// it.
|
||||||
|
@ -3600,7 +3631,7 @@ var WalkerFront = exports.WalkerFront = protocol.FrontClass(WalkerActor, {
|
||||||
// If this is coming from a DOM mutation, the actor's numChildren
|
// If this is coming from a DOM mutation, the actor's numChildren
|
||||||
// was passed in. Otherwise, it is simulated from a frame load or
|
// was passed in. Otherwise, it is simulated from a frame load or
|
||||||
// unload, so don't change the front's form.
|
// unload, so don't change the front's form.
|
||||||
if ('numChildren' in change) {
|
if ("numChildren" in change) {
|
||||||
targetFront._form.numChildren = change.numChildren;
|
targetFront._form.numChildren = change.numChildren;
|
||||||
}
|
}
|
||||||
} else if (change.type === "frameLoad") {
|
} else if (change.type === "frameLoad") {
|
||||||
|
@ -3609,7 +3640,8 @@ var WalkerFront = exports.WalkerFront = protocol.FrontClass(WalkerActor, {
|
||||||
// first.
|
// first.
|
||||||
for (let child of targetFront.treeChildren()) {
|
for (let child of targetFront.treeChildren()) {
|
||||||
if (child.nodeType === Ci.nsIDOMNode.DOCUMENT_NODE) {
|
if (child.nodeType === Ci.nsIDOMNode.DOCUMENT_NODE) {
|
||||||
console.trace("Got an unexpected frameLoad in the inspector, please file a bug on bugzilla.mozilla.org!");
|
console.trace("Got an unexpected frameLoad in the inspector, " +
|
||||||
|
"please file a bug on bugzilla.mozilla.org!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (change.type === "documentUnload") {
|
} else if (change.type === "documentUnload") {
|
||||||
|
@ -3673,7 +3705,8 @@ var WalkerFront = exports.WalkerFront = protocol.FrontClass(WalkerActor, {
|
||||||
console.warn("Tried to use frontForRawNode on a remote connection.");
|
console.warn("Tried to use frontForRawNode on a remote connection.");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
let walkerActor = this.conn._transport._serverConnection.getActor(this.actorID);
|
let walkerActor = this.conn._transport._serverConnection
|
||||||
|
.getActor(this.actorID);
|
||||||
if (!walkerActor) {
|
if (!walkerActor) {
|
||||||
throw Error("Could not find client side for actor " + this.actorID);
|
throw Error("Could not find client side for actor " + this.actorID);
|
||||||
}
|
}
|
||||||
|
@ -3681,7 +3714,8 @@ var WalkerFront = exports.WalkerFront = protocol.FrontClass(WalkerActor, {
|
||||||
|
|
||||||
// Pass the node through a read/write pair to create the client side actor.
|
// Pass the node through a read/write pair to create the client side actor.
|
||||||
let nodeType = types.getType("domnode");
|
let nodeType = types.getType("domnode");
|
||||||
let returnNode = nodeType.read(nodeType.write(nodeActor, walkerActor), this);
|
let returnNode = nodeType.read(
|
||||||
|
nodeType.write(nodeActor, walkerActor), this);
|
||||||
let top = returnNode;
|
let top = returnNode;
|
||||||
let extras = walkerActor.parents(nodeActor, {sameTypeRootTreeItem: true});
|
let extras = walkerActor.parents(nodeActor, {sameTypeRootTreeItem: true});
|
||||||
for (let extraActor of extras) {
|
for (let extraActor of extras) {
|
||||||
|
@ -3691,7 +3725,8 @@ var WalkerFront = exports.WalkerFront = protocol.FrontClass(WalkerActor, {
|
||||||
if (top !== this.rootNode) {
|
if (top !== this.rootNode) {
|
||||||
// Imported an already-orphaned node.
|
// Imported an already-orphaned node.
|
||||||
this._orphaned.add(top);
|
this._orphaned.add(top);
|
||||||
walkerActor._orphaned.add(this.conn._transport._serverConnection.getActor(top.actorID));
|
walkerActor._orphaned
|
||||||
|
.add(this.conn._transport._serverConnection.getActor(top.actorID));
|
||||||
}
|
}
|
||||||
return returnNode;
|
return returnNode;
|
||||||
},
|
},
|
||||||
|
@ -3708,6 +3743,8 @@ var WalkerFront = exports.WalkerFront = protocol.FrontClass(WalkerActor, {
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
exports.WalkerFront = WalkerFront;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convenience API for building a list of attribute modifications
|
* Convenience API for building a list of attribute modifications
|
||||||
* for the `modifyAttributes` request.
|
* for the `modifyAttributes` request.
|
||||||
|
@ -3747,7 +3784,7 @@ var AttributeModificationList = Class({
|
||||||
removeAttribute: function (name) {
|
removeAttribute: function (name) {
|
||||||
this.setAttributeNS(undefined, name, undefined);
|
this.setAttributeNS(undefined, name, undefined);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Server side of the inspector actor, which is used to create
|
* Server side of the inspector actor, which is used to create
|
||||||
|
@ -3790,7 +3827,7 @@ var InspectorActor = exports.InspectorActor = protocol.ActorClass({
|
||||||
this._walkerPromise = deferred.promise;
|
this._walkerPromise = deferred.promise;
|
||||||
|
|
||||||
let window = this.window;
|
let window = this.window;
|
||||||
var domReady = () => {
|
let domReady = () => {
|
||||||
let tabActor = this.tabActor;
|
let tabActor = this.tabActor;
|
||||||
window.removeEventListener("DOMContentLoaded", domReady, true);
|
window.removeEventListener("DOMContentLoaded", domReady, true);
|
||||||
this.walker = WalkerActor(this.conn, tabActor, options);
|
this.walker = WalkerActor(this.conn, tabActor, options);
|
||||||
|
@ -3883,9 +3920,8 @@ var InspectorActor = exports.InspectorActor = protocol.ActorClass({
|
||||||
getHighlighterByType: method(function (typeName) {
|
getHighlighterByType: method(function (typeName) {
|
||||||
if (isTypeRegistered(typeName)) {
|
if (isTypeRegistered(typeName)) {
|
||||||
return CustomHighlighterActor(this, typeName);
|
return CustomHighlighterActor(this, typeName);
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}, {
|
}, {
|
||||||
request: {
|
request: {
|
||||||
typeName: Arg(0)
|
typeName: Arg(0)
|
||||||
|
@ -3937,10 +3973,10 @@ var InspectorActor = exports.InspectorActor = protocol.ActorClass({
|
||||||
|
|
||||||
if (!document) {
|
if (!document) {
|
||||||
return url;
|
return url;
|
||||||
} else {
|
}
|
||||||
|
|
||||||
let baseURI = Services.io.newURI(document.location.href, null, null);
|
let baseURI = Services.io.newURI(document.location.href, null, null);
|
||||||
return Services.io.newURI(url, null, baseURI).spec;
|
return Services.io.newURI(url, null, baseURI).spec;
|
||||||
}
|
|
||||||
}, {
|
}, {
|
||||||
request: {url: Arg(0, "string"), node: Arg(1, "nullable:domnode")},
|
request: {url: Arg(0, "string"), node: Arg(1, "nullable:domnode")},
|
||||||
response: {value: RetVal("string")}
|
response: {value: RetVal("string")}
|
||||||
|
@ -3951,7 +3987,7 @@ var InspectorActor = exports.InspectorActor = protocol.ActorClass({
|
||||||
* Client side of the inspector actor, which is used to create
|
* Client side of the inspector actor, which is used to create
|
||||||
* inspector-related actors, including the walker.
|
* inspector-related actors, including the walker.
|
||||||
*/
|
*/
|
||||||
var InspectorFront = exports.InspectorFront = protocol.FrontClass(InspectorActor, {
|
var InspectorFront = protocol.FrontClass(InspectorActor, {
|
||||||
initialize: function (client, tabForm) {
|
initialize: function (client, tabForm) {
|
||||||
protocol.Front.prototype.initialize.call(this, client);
|
protocol.Front.prototype.initialize.call(this, client);
|
||||||
this.actorID = tabForm.inspectorActor;
|
this.actorID = tabForm.inspectorActor;
|
||||||
|
@ -3991,6 +4027,8 @@ var InspectorFront = exports.InspectorFront = protocol.FrontClass(InspectorActor
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
exports.InspectorFront = InspectorFront;
|
||||||
|
|
||||||
// Exported for test purposes.
|
// Exported for test purposes.
|
||||||
exports._documentWalker = DocumentWalker;
|
exports._documentWalker = DocumentWalker;
|
||||||
|
|
||||||
|
@ -3998,16 +4036,16 @@ function nodeDocument(node) {
|
||||||
if (Cu.isDeadWrapper(node)) {
|
if (Cu.isDeadWrapper(node)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return node.ownerDocument || (node.nodeType == Ci.nsIDOMNode.DOCUMENT_NODE ? node : null);
|
return node.ownerDocument ||
|
||||||
|
(node.nodeType == Ci.nsIDOMNode.DOCUMENT_NODE ? node : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
function nodeDocshell(node) {
|
function nodeDocshell(node) {
|
||||||
let doc = node ? nodeDocument(node) : null;
|
let doc = node ? nodeDocument(node) : null;
|
||||||
let win = doc ? doc.defaultView : null;
|
let win = doc ? doc.defaultView : null;
|
||||||
if (win) {
|
if (win) {
|
||||||
return win.
|
return win.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||||
QueryInterface(Ci.nsIInterfaceRequestor).
|
.getInterface(Ci.nsIDocShell);
|
||||||
getInterface(Ci.nsIDocShell);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4021,16 +4059,20 @@ function isNodeDead(node) {
|
||||||
*
|
*
|
||||||
* @param {DOMNode} node
|
* @param {DOMNode} node
|
||||||
* @param {Window} rootWin
|
* @param {Window} rootWin
|
||||||
* @param {Int} whatToShow See Ci.nsIDOMNodeFilter / inIDeepTreeWalker for options.
|
* @param {Int} whatToShow See Ci.nsIDOMNodeFilter / inIDeepTreeWalker for
|
||||||
|
* options.
|
||||||
* @param {Function} filter A custom filter function Taking in a DOMNode
|
* @param {Function} filter A custom filter function Taking in a DOMNode
|
||||||
* and returning an Int. See WalkerActor.nodeFilter for an example.
|
* and returning an Int. See WalkerActor.nodeFilter for an example.
|
||||||
*/
|
*/
|
||||||
function DocumentWalker(node, rootWin, whatToShow=Ci.nsIDOMNodeFilter.SHOW_ALL, filter=standardTreeWalkerFilter) {
|
function DocumentWalker(node, rootWin,
|
||||||
|
whatToShow = Ci.nsIDOMNodeFilter.SHOW_ALL,
|
||||||
|
filter = standardTreeWalkerFilter) {
|
||||||
if (!rootWin.location) {
|
if (!rootWin.location) {
|
||||||
throw new Error("Got an invalid root window in DocumentWalker");
|
throw new Error("Got an invalid root window in DocumentWalker");
|
||||||
}
|
}
|
||||||
|
|
||||||
this.walker = Cc["@mozilla.org/inspector/deep-tree-walker;1"].createInstance(Ci.inIDeepTreeWalker);
|
this.walker = Cc["@mozilla.org/inspector/deep-tree-walker;1"]
|
||||||
|
.createInstance(Ci.inIDeepTreeWalker);
|
||||||
this.walker.showAnonymousContent = true;
|
this.walker.showAnonymousContent = true;
|
||||||
this.walker.showSubDocuments = true;
|
this.walker.showSubDocuments = true;
|
||||||
this.walker.showDocumentsAsNodes = true;
|
this.walker.showDocumentsAsNodes = true;
|
||||||
|
@ -4057,8 +4099,8 @@ DocumentWalker.prototype = {
|
||||||
get currentNode() {
|
get currentNode() {
|
||||||
return this.walker.currentNode;
|
return this.walker.currentNode;
|
||||||
},
|
},
|
||||||
set currentNode(aVal) {
|
set currentNode(val) {
|
||||||
this.walker.currentNode = aVal;
|
this.walker.currentNode = val;
|
||||||
},
|
},
|
||||||
|
|
||||||
parentNode: function () {
|
parentNode: function () {
|
||||||
|
@ -4072,7 +4114,8 @@ DocumentWalker.prototype = {
|
||||||
}
|
}
|
||||||
|
|
||||||
let nextNode = this.walker.nextNode();
|
let nextNode = this.walker.nextNode();
|
||||||
while (nextNode && this.filter(nextNode) === Ci.nsIDOMNodeFilter.FILTER_SKIP) {
|
while (nextNode &&
|
||||||
|
this.filter(nextNode) === Ci.nsIDOMNodeFilter.FILTER_SKIP) {
|
||||||
nextNode = this.walker.nextNode();
|
nextNode = this.walker.nextNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4086,7 +4129,8 @@ DocumentWalker.prototype = {
|
||||||
}
|
}
|
||||||
|
|
||||||
let firstChild = this.walker.firstChild();
|
let firstChild = this.walker.firstChild();
|
||||||
while (firstChild && this.filter(firstChild) === Ci.nsIDOMNodeFilter.FILTER_SKIP) {
|
while (firstChild &&
|
||||||
|
this.filter(firstChild) === Ci.nsIDOMNodeFilter.FILTER_SKIP) {
|
||||||
firstChild = this.walker.nextSibling();
|
firstChild = this.walker.nextSibling();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4100,7 +4144,8 @@ DocumentWalker.prototype = {
|
||||||
}
|
}
|
||||||
|
|
||||||
let lastChild = this.walker.lastChild();
|
let lastChild = this.walker.lastChild();
|
||||||
while (lastChild && this.filter(lastChild) === Ci.nsIDOMNodeFilter.FILTER_SKIP) {
|
while (lastChild &&
|
||||||
|
this.filter(lastChild) === Ci.nsIDOMNodeFilter.FILTER_SKIP) {
|
||||||
lastChild = this.walker.previousSibling();
|
lastChild = this.walker.previousSibling();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4136,23 +4181,23 @@ function isInXULDocument(el) {
|
||||||
* content with the exception of ::before and ::after and anonymous content
|
* content with the exception of ::before and ::after and anonymous content
|
||||||
* in XUL document (needed to show all elements in the browser toolbox).
|
* in XUL document (needed to show all elements in the browser toolbox).
|
||||||
*/
|
*/
|
||||||
function standardTreeWalkerFilter(aNode) {
|
function standardTreeWalkerFilter(node) {
|
||||||
// ::before and ::after are native anonymous content, but we always
|
// ::before and ::after are native anonymous content, but we always
|
||||||
// want to show them
|
// want to show them
|
||||||
if (aNode.nodeName === "_moz_generated_content_before" ||
|
if (node.nodeName === "_moz_generated_content_before" ||
|
||||||
aNode.nodeName === "_moz_generated_content_after") {
|
node.nodeName === "_moz_generated_content_after") {
|
||||||
return Ci.nsIDOMNodeFilter.FILTER_ACCEPT;
|
return Ci.nsIDOMNodeFilter.FILTER_ACCEPT;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ignore empty whitespace text nodes.
|
// Ignore empty whitespace text nodes.
|
||||||
if (aNode.nodeType == Ci.nsIDOMNode.TEXT_NODE &&
|
if (node.nodeType == Ci.nsIDOMNode.TEXT_NODE &&
|
||||||
!/[^\s]/.exec(aNode.nodeValue)) {
|
!/[^\s]/.exec(node.nodeValue)) {
|
||||||
return Ci.nsIDOMNodeFilter.FILTER_SKIP;
|
return Ci.nsIDOMNodeFilter.FILTER_SKIP;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ignore all native and XBL anonymous content inside a non-XUL document
|
// Ignore all native and XBL anonymous content inside a non-XUL document
|
||||||
if (!isInXULDocument(aNode) && (isXBLAnonymous(aNode) ||
|
if (!isInXULDocument(node) && (isXBLAnonymous(node) ||
|
||||||
isNativeAnonymous(aNode))) {
|
isNativeAnonymous(node))) {
|
||||||
// Note: this will skip inspecting the contents of feedSubscribeLine since
|
// Note: this will skip inspecting the contents of feedSubscribeLine since
|
||||||
// that's XUL content injected in an HTML document, but we need to because
|
// that's XUL content injected in an HTML document, but we need to because
|
||||||
// this also skips many other elements that need to be skipped - like form
|
// this also skips many other elements that need to be skipped - like form
|
||||||
|
@ -4167,13 +4212,13 @@ function standardTreeWalkerFilter(aNode) {
|
||||||
* This DeepTreeWalker filter is like standardTreeWalkerFilter except that
|
* This DeepTreeWalker filter is like standardTreeWalkerFilter except that
|
||||||
* it also includes all anonymous content (like internal form controls).
|
* it also includes all anonymous content (like internal form controls).
|
||||||
*/
|
*/
|
||||||
function allAnonymousContentTreeWalkerFilter(aNode) {
|
function allAnonymousContentTreeWalkerFilter(node) {
|
||||||
// Ignore empty whitespace text nodes.
|
// Ignore empty whitespace text nodes.
|
||||||
if (aNode.nodeType == Ci.nsIDOMNode.TEXT_NODE &&
|
if (node.nodeType == Ci.nsIDOMNode.TEXT_NODE &&
|
||||||
!/[^\s]/.exec(aNode.nodeValue)) {
|
!/[^\s]/.exec(node.nodeValue)) {
|
||||||
return Ci.nsIDOMNodeFilter.FILTER_SKIP;
|
return Ci.nsIDOMNodeFilter.FILTER_SKIP;
|
||||||
}
|
}
|
||||||
return Ci.nsIDOMNodeFilter.FILTER_ACCEPT
|
return Ci.nsIDOMNodeFilter.FILTER_ACCEPT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -4249,7 +4294,7 @@ var imageToImageData = Task.async(function* (node, maxDim) {
|
||||||
let isCanvas = node instanceof HTMLCanvasElement;
|
let isCanvas = node instanceof HTMLCanvasElement;
|
||||||
|
|
||||||
if (!isImg && !isCanvas) {
|
if (!isImg && !isCanvas) {
|
||||||
throw "node is not a <canvas> or <img> element.";
|
throw new Error("node is not a <canvas> or <img> element.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isImg) {
|
if (isImg) {
|
||||||
|
@ -4291,7 +4336,7 @@ var imageToImageData = Task.async(function* (node, maxDim) {
|
||||||
naturalHeight: imgHeight,
|
naturalHeight: imgHeight,
|
||||||
resized: resizeRatio !== 1
|
resized: resizeRatio !== 1
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
loader.lazyGetter(this, "DOMUtils", function () {
|
loader.lazyGetter(this, "DOMUtils", function () {
|
||||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -943,63 +943,96 @@ exports.method = function(fn, spec={}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process an actor definition from its prototype and generate
|
* Generates an actor specification from an actor description.
|
||||||
* request handlers.
|
|
||||||
*/
|
*/
|
||||||
var actorProto = function(actorProto) {
|
var generateActorSpec = function(actorDesc) {
|
||||||
if (actorProto._actorSpec) {
|
let actorSpec = {
|
||||||
throw new Error("actorProto called twice on the same actor prototype!");
|
typeName: actorDesc.typeName,
|
||||||
}
|
methods: []
|
||||||
|
|
||||||
let protoSpec = {
|
|
||||||
methods: [],
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Find method and form specifications attached to prototype properties.
|
// Find method and form specifications attached to properties.
|
||||||
for (let name of Object.getOwnPropertyNames(actorProto)) {
|
for (let name of Object.getOwnPropertyNames(actorDesc)) {
|
||||||
let desc = Object.getOwnPropertyDescriptor(actorProto, name);
|
let desc = Object.getOwnPropertyDescriptor(actorDesc, name);
|
||||||
if (!desc.value) {
|
if (!desc.value) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name.startsWith("formType")) {
|
if (name.startsWith("formType")) {
|
||||||
if (typeof(desc.value) === "string") {
|
if (typeof(desc.value) === "string") {
|
||||||
protoSpec[name] = types.getType(desc.value);
|
actorSpec[name] = types.getType(desc.value);
|
||||||
} else if (desc.value.name && registeredTypes.has(desc.value.name)) {
|
} else if (desc.value.name && registeredTypes.has(desc.value.name)) {
|
||||||
protoSpec[name] = desc.value;
|
actorSpec[name] = desc.value;
|
||||||
} else {
|
} else {
|
||||||
// Shorthand for a newly-registered DictType.
|
// Shorthand for a newly-registered DictType.
|
||||||
protoSpec[name] = types.addDictType(actorProto.typeName + "__" + name, desc.value);
|
actorSpec[name] = types.addDictType(actorDesc.typeName + "__" + name, desc.value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (desc.value._methodSpec) {
|
if (desc.value._methodSpec) {
|
||||||
let frozenSpec = desc.value._methodSpec;
|
let methodSpec = desc.value._methodSpec;
|
||||||
let spec = {};
|
let spec = {};
|
||||||
spec.name = frozenSpec.name || name;
|
spec.name = methodSpec.name || name;
|
||||||
spec.request = Request(object.merge({type: spec.name}, frozenSpec.request || undefined));
|
spec.request = Request(object.merge({type: spec.name}, methodSpec.request || undefined));
|
||||||
spec.response = Response(frozenSpec.response || undefined);
|
spec.response = Response(methodSpec.response || undefined);
|
||||||
spec.telemetry = frozenSpec.telemetry;
|
spec.telemetry = methodSpec.telemetry;
|
||||||
spec.release = frozenSpec.release;
|
spec.release = methodSpec.release;
|
||||||
spec.oneway = frozenSpec.oneway;
|
spec.oneway = methodSpec.oneway;
|
||||||
|
|
||||||
protoSpec.methods.push(spec);
|
actorSpec.methods.push(spec);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find additional method specifications
|
||||||
|
if (actorDesc.methods) {
|
||||||
|
for (let name in actorDesc.methods) {
|
||||||
|
let methodSpec = actorDesc.methods[name];
|
||||||
|
let spec = {};
|
||||||
|
|
||||||
|
spec.name = methodSpec.name || name;
|
||||||
|
spec.request = Request(object.merge({type: spec.name}, methodSpec.request || undefined));
|
||||||
|
spec.response = Response(methodSpec.response || undefined);
|
||||||
|
spec.telemetry = methodSpec.telemetry;
|
||||||
|
spec.release = methodSpec.release;
|
||||||
|
spec.oneway = methodSpec.oneway;
|
||||||
|
|
||||||
|
actorSpec.methods.push(spec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find event specifications
|
// Find event specifications
|
||||||
if (actorProto.events) {
|
if (actorDesc.events) {
|
||||||
protoSpec.events = new Map();
|
actorSpec.events = new Map();
|
||||||
for (let name in actorProto.events) {
|
for (let name in actorDesc.events) {
|
||||||
let eventRequest = actorProto.events[name];
|
let eventRequest = actorDesc.events[name];
|
||||||
Object.freeze(eventRequest);
|
Object.freeze(eventRequest);
|
||||||
protoSpec.events.set(name, Request(object.merge({type: name}, eventRequest)));
|
actorSpec.events.set(name, Request(object.merge({type: name}, eventRequest)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!registeredTypes.has(actorSpec.typeName)) {
|
||||||
|
types.addActorType(actorSpec.typeName);
|
||||||
|
}
|
||||||
|
registeredTypes.get(actorSpec.typeName).actorSpec = actorSpec;
|
||||||
|
|
||||||
|
return actorSpec;
|
||||||
|
};
|
||||||
|
exports.generateActorSpec = generateActorSpec;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates request handlers as described by the given actor specification on
|
||||||
|
* the given actor prototype. Returns the actor prototype.
|
||||||
|
*/
|
||||||
|
var generateRequestHandlers = function(actorSpec, actorProto) {
|
||||||
|
if (actorProto._actorSpec) {
|
||||||
|
throw new Error("actorProto called twice on the same actor prototype!");
|
||||||
|
}
|
||||||
|
|
||||||
|
actorProto.typeName = actorSpec.typeName;
|
||||||
|
|
||||||
// Generate request handlers for each method definition
|
// Generate request handlers for each method definition
|
||||||
actorProto.requestTypes = Object.create(null);
|
actorProto.requestTypes = Object.create(null);
|
||||||
protoSpec.methods.forEach(spec => {
|
actorSpec.methods.forEach(spec => {
|
||||||
let handler = function(packet, conn) {
|
let handler = function(packet, conn) {
|
||||||
try {
|
try {
|
||||||
let args;
|
let args;
|
||||||
|
@ -1055,30 +1088,42 @@ var actorProto = function(actorProto) {
|
||||||
actorProto.requestTypes[spec.request.type] = handler;
|
actorProto.requestTypes[spec.request.type] = handler;
|
||||||
});
|
});
|
||||||
|
|
||||||
actorProto._actorSpec = protoSpec;
|
actorProto._actorSpec = actorSpec;
|
||||||
|
|
||||||
return actorProto;
|
return actorProto;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an actor class for the given actor prototype.
|
* Create an actor class for the given actor prototype.
|
||||||
*
|
*
|
||||||
* @param object proto
|
* @param object actorProto
|
||||||
* The object prototype. Must have a 'typeName' property,
|
* The actor prototype. Must have a 'typeName' property,
|
||||||
* should have method definitions, can have event definitions.
|
* should have method definitions, can have event definitions.
|
||||||
*/
|
*/
|
||||||
exports.ActorClass = function(proto) {
|
exports.ActorClass = function (actorProto) {
|
||||||
if (!proto.typeName) {
|
return ActorClassWithSpec(generateActorSpec(actorProto), actorProto);
|
||||||
throw Error("Actor prototype must have a typeName member.");
|
};
|
||||||
}
|
|
||||||
proto.extends = Actor;
|
/**
|
||||||
if (!registeredTypes.has(proto.typeName)) {
|
* Create an actor class for the given actor specification and prototype.
|
||||||
types.addActorType(proto.typeName);
|
*
|
||||||
}
|
* @param object actorSpec
|
||||||
let cls = Class(actorProto(proto));
|
* The actor specification. Must have a 'typeName' property.
|
||||||
|
* @param object actorProto
|
||||||
|
* The actor prototype. Should have method definitions, can have event
|
||||||
|
* definitions.
|
||||||
|
*/
|
||||||
|
var ActorClassWithSpec = function(actorSpec, actorProto) {
|
||||||
|
if (!actorSpec.typeName) {
|
||||||
|
throw Error("Actor specification must have a typeName member.");
|
||||||
|
}
|
||||||
|
|
||||||
|
actorProto.extends = Actor;
|
||||||
|
let cls = Class(generateRequestHandlers(actorSpec, actorProto));
|
||||||
|
|
||||||
registeredTypes.get(proto.typeName).actorSpec = proto._actorSpec;
|
|
||||||
return cls;
|
return cls;
|
||||||
};
|
};
|
||||||
|
exports.ActorClassWithSpec = ActorClassWithSpec;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for client-side actor fronts.
|
* Base class for client-side actor fronts.
|
||||||
|
@ -1270,26 +1315,25 @@ function prototypeOf(obj) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process a front definition from its prototype and generate
|
* Generates request methods as described by the given actor specification on
|
||||||
* request methods.
|
* the given front prototype. Returns the front prototype.
|
||||||
*/
|
*/
|
||||||
var frontProto = function(proto) {
|
var generateRequestMethods = function(actorSpec, frontProto) {
|
||||||
let actorType = prototypeOf(proto.actorType);
|
if (frontProto._actorSpec) {
|
||||||
if (proto._actorSpec) {
|
|
||||||
throw new Error("frontProto called twice on the same front prototype!");
|
throw new Error("frontProto called twice on the same front prototype!");
|
||||||
}
|
}
|
||||||
proto._actorSpec = actorType._actorSpec;
|
|
||||||
proto.typeName = actorType.typeName;
|
frontProto.typeName = actorSpec.typeName;
|
||||||
|
|
||||||
// Generate request methods.
|
// Generate request methods.
|
||||||
let methods = proto._actorSpec.methods;
|
let methods = actorSpec.methods;
|
||||||
methods.forEach(spec => {
|
methods.forEach(spec => {
|
||||||
let name = spec.name;
|
let name = spec.name;
|
||||||
|
|
||||||
// If there's already a property by this name in the front, it must
|
// If there's already a property by this name in the front, it must
|
||||||
// be a custom front method.
|
// be a custom front method.
|
||||||
if (name in proto) {
|
if (name in frontProto) {
|
||||||
let custom = proto[spec.name]._customFront;
|
let custom = frontProto[spec.name]._customFront;
|
||||||
if (custom === undefined) {
|
if (custom === undefined) {
|
||||||
throw Error("Existing method for " + spec.name + " not marked customFront while processing " + actorType.typeName + ".");
|
throw Error("Existing method for " + spec.name + " not marked customFront while processing " + actorType.typeName + ".");
|
||||||
}
|
}
|
||||||
|
@ -1300,7 +1344,7 @@ var frontProto = function(proto) {
|
||||||
name = custom.impl;
|
name = custom.impl;
|
||||||
}
|
}
|
||||||
|
|
||||||
proto[name] = function(...args) {
|
frontProto[name] = function(...args) {
|
||||||
let histogram, startTime;
|
let histogram, startTime;
|
||||||
if (spec.telemetry) {
|
if (spec.telemetry) {
|
||||||
if (spec.oneway) {
|
if (spec.oneway) {
|
||||||
|
@ -1354,8 +1398,8 @@ var frontProto = function(proto) {
|
||||||
|
|
||||||
// Release methods should call the destroy function on return.
|
// Release methods should call the destroy function on return.
|
||||||
if (spec.release) {
|
if (spec.release) {
|
||||||
let fn = proto[name];
|
let fn = frontProto[name];
|
||||||
proto[name] = function(...args) {
|
frontProto[name] = function(...args) {
|
||||||
return fn.apply(this, args).then(result => {
|
return fn.apply(this, args).then(result => {
|
||||||
this.destroy();
|
this.destroy();
|
||||||
return result;
|
return result;
|
||||||
|
@ -1366,14 +1410,14 @@ var frontProto = function(proto) {
|
||||||
|
|
||||||
|
|
||||||
// Process event specifications
|
// Process event specifications
|
||||||
proto._clientSpec = {};
|
frontProto._clientSpec = {};
|
||||||
|
|
||||||
let events = proto._actorSpec.events;
|
let events = actorSpec.events;
|
||||||
if (events) {
|
if (events) {
|
||||||
// This actor has events, scan the prototype for preEvent handlers...
|
// This actor has events, scan the prototype for preEvent handlers...
|
||||||
let preHandlers = new Map();
|
let preHandlers = new Map();
|
||||||
for (let name of Object.getOwnPropertyNames(proto)) {
|
for (let name of Object.getOwnPropertyNames(frontProto)) {
|
||||||
let desc = Object.getOwnPropertyDescriptor(proto, name);
|
let desc = Object.getOwnPropertyDescriptor(frontProto, name);
|
||||||
if (!desc.value) {
|
if (!desc.value) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1391,36 +1435,56 @@ var frontProto = function(proto) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
proto._clientSpec.events = new Map();
|
frontProto._clientSpec.events = new Map();
|
||||||
|
|
||||||
for (let [name, request] of events) {
|
for (let [name, request] of events) {
|
||||||
proto._clientSpec.events.set(request.type, {
|
frontProto._clientSpec.events.set(request.type, {
|
||||||
name: name,
|
name: name,
|
||||||
request: request,
|
request: request,
|
||||||
pre: preHandlers.get(name)
|
pre: preHandlers.get(name)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return proto;
|
|
||||||
|
frontProto._actorSpec = actorSpec;
|
||||||
|
|
||||||
|
return frontProto;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a front class for the given actor class, with the given prototype.
|
* Create a front class for the given actor class and front prototype.
|
||||||
*
|
*
|
||||||
* @param ActorClass actorType
|
* @param ActorClass actorType
|
||||||
* The actor class you're creating a front for.
|
* The actor class you're creating a front for.
|
||||||
|
* @param object frontProto
|
||||||
|
* The front prototype. Must have a 'typeName' property,
|
||||||
|
* should have method definitions, can have event definitions.
|
||||||
|
*/
|
||||||
|
exports.FrontClass = function(actorType, frontProto) {
|
||||||
|
return FrontClassWithSpec(prototypeOf(actorType)._actorSpec, frontProto);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a front class for the given actor specification and front prototype.
|
||||||
|
*
|
||||||
|
* @param object actorSpec
|
||||||
|
* The actor specification you're creating a front for.
|
||||||
* @param object proto
|
* @param object proto
|
||||||
* The object prototype. Must have a 'typeName' property,
|
* The object prototype. Must have a 'typeName' property,
|
||||||
* should have method definitions, can have event definitions.
|
* should have method definitions, can have event definitions.
|
||||||
*/
|
*/
|
||||||
exports.FrontClass = function(actorType, proto) {
|
var FrontClassWithSpec = function(actorSpec, frontProto) {
|
||||||
proto.actorType = actorType;
|
frontProto.extends = Front;
|
||||||
proto.extends = Front;
|
let cls = Class(generateRequestMethods(actorSpec, frontProto));
|
||||||
let cls = Class(frontProto(proto));
|
|
||||||
registeredTypes.get(cls.prototype.typeName).frontClass = cls;
|
if (!registeredTypes.has(actorSpec.typeName)) {
|
||||||
|
types.addActorType(actorSpec.typeName);
|
||||||
|
}
|
||||||
|
registeredTypes.get(actorSpec.typeName).frontClass = cls;
|
||||||
|
|
||||||
return cls;
|
return cls;
|
||||||
}
|
}
|
||||||
|
exports.FrontClassWithSpec = FrontClassWithSpec;
|
||||||
|
|
||||||
exports.dumpActorSpec = function(type) {
|
exports.dumpActorSpec = function(type) {
|
||||||
let actorSpec = type.actorSpec;
|
let actorSpec = type.actorSpec;
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
const { Cc, Ci, Cr } = require("chrome");
|
const { Cc, Ci, Cr } = require("chrome");
|
||||||
const l10n = require("gcli/l10n");
|
const l10n = require("gcli/l10n");
|
||||||
const Services = require("Services");
|
const Services = require("Services");
|
||||||
|
const { NetUtil } = require("resource://gre/modules/NetUtil.jsm");
|
||||||
const { getRect } = require("devtools/shared/layout/utils");
|
const { getRect } = require("devtools/shared/layout/utils");
|
||||||
const promise = require("promise");
|
const promise = require("promise");
|
||||||
|
|
||||||
|
@ -357,19 +358,18 @@ function getFilename(defaultName) {
|
||||||
*/
|
*/
|
||||||
function saveToClipboard(context, reply) {
|
function saveToClipboard(context, reply) {
|
||||||
try {
|
try {
|
||||||
|
const channel = NetUtil.newChannel({
|
||||||
|
uri: reply.data,
|
||||||
|
loadUsingSystemPrincipal: true,
|
||||||
|
contentPolicyType: Ci.nsIContentPolicy.TYPE_INTERNAL_IMAGE
|
||||||
|
});
|
||||||
|
const input = channel.open2();
|
||||||
|
|
||||||
const loadContext = context.environment.chromeWindow
|
const loadContext = context.environment.chromeWindow
|
||||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||||
.getInterface(Ci.nsIWebNavigation)
|
.getInterface(Ci.nsIWebNavigation)
|
||||||
.QueryInterface(Ci.nsILoadContext);
|
.QueryInterface(Ci.nsILoadContext);
|
||||||
const io = Cc["@mozilla.org/network/io-service;1"]
|
|
||||||
.getService(Ci.nsIIOService);
|
|
||||||
const channel = io.newChannel2(reply.data, null, null,
|
|
||||||
null, // aLoadingNode
|
|
||||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
|
||||||
null, // aTriggeringPrincipal
|
|
||||||
Ci.nsILoadInfo.SEC_NORMAL,
|
|
||||||
Ci.nsIContentPolicy.TYPE_INTERNAL_IMAGE);
|
|
||||||
const input = channel.open();
|
|
||||||
const imgTools = Cc["@mozilla.org/image/tools;1"]
|
const imgTools = Cc["@mozilla.org/image/tools;1"]
|
||||||
.getService(Ci.imgITools);
|
.getService(Ci.imgITools);
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#Mon Nov 02 13:44:39 GMT 2015
|
#Tue Apr 12 09:52:06 CEST 2016
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.7-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
|
||||||
distributionSha256Sum=2ba0aaa11a3e96ec0af31d532d808e1f09cc6dcad0954e637902a1ab544b9e60
|
distributionSha256Sum=496d60c331f8666f99b66d08ff67a880697a7e85a9d9b76ff08814cf97f61a4c
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
and not fail everything. -->
|
and not fail everything. -->
|
||||||
<issue id="AppCompatResource" severity="warning" />
|
<issue id="AppCompatResource" severity="warning" />
|
||||||
<issue id="GoogleAppIndexingDeepLinkError" severity="warning" />
|
<issue id="GoogleAppIndexingDeepLinkError" severity="warning" />
|
||||||
|
<issue id="GoogleAppIndexingUrlError" severity="warning" />
|
||||||
<issue id="Instantiatable" severity="warning" />
|
<issue id="Instantiatable" severity="warning" />
|
||||||
<issue id="LongLogTag" severity="warning" />
|
<issue id="LongLogTag" severity="warning" />
|
||||||
<issue id="MissingPermission" severity="warning" />
|
<issue id="MissingPermission" severity="warning" />
|
||||||
|
@ -35,6 +36,11 @@
|
||||||
<issue id="ValidFragment" severity="warning" />
|
<issue id="ValidFragment" severity="warning" />
|
||||||
<issue id="WrongConstant" severity="warning" />
|
<issue id="WrongConstant" severity="warning" />
|
||||||
|
|
||||||
|
<!-- We fixed all "Registered" lint errors. However the current gradle plugin has a bug where
|
||||||
|
it ignores @SuppressLint annotations for this check. See CrashReporter class and
|
||||||
|
https://code.google.com/p/android/issues/detail?id=204846 -->
|
||||||
|
<issue id="Registered" severity="warning" />
|
||||||
|
|
||||||
<!-- WHEN YOU FIX A LINT WARNING, ADD IT TO THIS LIST.
|
<!-- WHEN YOU FIX A LINT WARNING, ADD IT TO THIS LIST.
|
||||||
|
|
||||||
We want all lint warnings to be fatal errors.
|
We want all lint warnings to be fatal errors.
|
||||||
|
@ -144,7 +150,6 @@
|
||||||
<issue id="ProtectedPermissions" severity="error" />
|
<issue id="ProtectedPermissions" severity="error" />
|
||||||
<issue id="PxUsage" severity="error" />
|
<issue id="PxUsage" severity="error" />
|
||||||
<issue id="Range" severity="error" />
|
<issue id="Range" severity="error" />
|
||||||
<issue id="Registered" severity="error" />
|
|
||||||
<issue id="RelativeOverlap" severity="error" />
|
<issue id="RelativeOverlap" severity="error" />
|
||||||
<issue id="RequiredSize" severity="error" />
|
<issue id="RequiredSize" severity="error" />
|
||||||
<issue id="ResAuto" severity="error" />
|
<issue id="ResAuto" severity="error" />
|
||||||
|
|
|
@ -23,6 +23,7 @@ import java.util.zip.GZIPOutputStream;
|
||||||
|
|
||||||
import org.mozilla.gecko.AppConstants.Versions;
|
import org.mozilla.gecko.AppConstants.Versions;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.ProgressDialog;
|
import android.app.ProgressDialog;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
|
@ -39,6 +40,7 @@ import android.widget.CheckBox;
|
||||||
import android.widget.CompoundButton;
|
import android.widget.CompoundButton;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
|
|
||||||
|
@SuppressLint("Registered") // This activity is only registered in the manifest if MOZ_CRASHREPORTER is set
|
||||||
public class CrashReporter extends AppCompatActivity
|
public class CrashReporter extends AppCompatActivity
|
||||||
{
|
{
|
||||||
private static final String LOGTAG = "GeckoCrashReporter";
|
private static final String LOGTAG = "GeckoCrashReporter";
|
||||||
|
|
|
@ -8,7 +8,7 @@ import android.content.ComponentName;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
|
||||||
public class GeckoActivity extends AppCompatActivity implements GeckoActivityStatus {
|
public abstract class GeckoActivity extends AppCompatActivity implements GeckoActivityStatus {
|
||||||
// has this activity recently started another Gecko activity?
|
// has this activity recently started another Gecko activity?
|
||||||
private boolean mGeckoActivityOpened;
|
private boolean mGeckoActivityOpened;
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ public class Locales {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class LocaleAwareAppCompatActivity extends AppCompatActivity {
|
public static abstract class LocaleAwareAppCompatActivity extends AppCompatActivity {
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
Locales.initializeLocale(getApplicationContext());
|
Locales.initializeLocale(getApplicationContext());
|
||||||
|
@ -56,7 +56,7 @@ public class Locales {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public static class LocaleAwareFragmentActivity extends FragmentActivity {
|
public static abstract class LocaleAwareFragmentActivity extends FragmentActivity {
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
Locales.initializeLocale(getApplicationContext());
|
Locales.initializeLocale(getApplicationContext());
|
||||||
|
@ -64,7 +64,7 @@ public class Locales {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class LocaleAwareActivity extends Activity {
|
public static abstract class LocaleAwareActivity extends Activity {
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
Locales.initializeLocale(getApplicationContext());
|
Locales.initializeLocale(getApplicationContext());
|
||||||
|
|
|
@ -88,4 +88,31 @@ final class UnusedResourcesUtil {
|
||||||
R.xml.preferences_privacy,
|
R.xml.preferences_privacy,
|
||||||
R.xml.preferences_privacy_clear_tablet,
|
R.xml.preferences_privacy_clear_tablet,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// We are migrating to Gradle 2.10 and the Android Gradle plugin 2.0. The new plugin does find
|
||||||
|
// more unused resources but we are not ready to remove them yet. Some of the resources are going
|
||||||
|
// to be reused soon. This is a temporary solution so that the gradle migration is not blocked.
|
||||||
|
// See bug 1263390 / bug 1268414.
|
||||||
|
public static final int[] TEMPORARY_UNUSED_WHILE_MIGRATING_GRADLE = {
|
||||||
|
R.color.remote_tabs_setup_button_background_hit,
|
||||||
|
|
||||||
|
R.drawable.remote_tabs_setup_button_background,
|
||||||
|
|
||||||
|
R.style.ActionBarThemeGeckoPreferences,
|
||||||
|
R.style.TabsPanelSectionBase,
|
||||||
|
R.style.TabsPanelSection,
|
||||||
|
R.style.TabsPanelItemBase,
|
||||||
|
R.style.TabsPanelItem,
|
||||||
|
R.style.TabsPanelItem_TextAppearance,
|
||||||
|
R.style.TabsPanelItem_TextAppearance_Header,
|
||||||
|
R.style.TabsPanelItem_TextAppearance_Linkified,
|
||||||
|
R.style.TabWidget,
|
||||||
|
R.style.GeckoDialogTitle,
|
||||||
|
R.style.GeckoDialogTitle_SubTitle,
|
||||||
|
R.style.RemoteTabsPanelItem,
|
||||||
|
R.style.RemoteTabsPanelItem_TextAppearance,
|
||||||
|
R.style.RemoteTabsPanelItem_TextAppearance_Header,
|
||||||
|
R.style.RemoteTabsPanelItem_TextAppearance_Linkified,
|
||||||
|
R.style.RemoteTabsPanelItem_Button,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,9 +7,9 @@
|
||||||
"Android Support Repository (Support Library 23.0.1)",
|
"Android Support Repository (Support Library 23.0.1)",
|
||||||
"Google Support Repository (Google Play Services 8.1.0)"
|
"Google Support Repository (Google Play Services 8.1.0)"
|
||||||
],
|
],
|
||||||
"size": 535625068,
|
"size": 510579808,
|
||||||
"visibility": "internal",
|
"visibility": "internal",
|
||||||
"digest": "0627515046a23c1d109e2782865b1b3b546c1d552955e4156317f76cbb195eb630aa25feea3f4edd1c685f129da0c2a5169d4d6349c1c31d8a95158a4569a478",
|
"digest": "a4ea080f1aa5cb1d05250d45a288446ae07a54362a166bc7faa67281b5d50ee55001c1770cf9a942535b583e2f4c99d420902f065b03842d94a7d9273dca756d",
|
||||||
"algorithm": "sha512",
|
"algorithm": "sha512",
|
||||||
"filename": "android-sdk-linux.tar.xz",
|
"filename": "android-sdk-linux.tar.xz",
|
||||||
"unpack": true
|
"unpack": true
|
||||||
|
@ -35,16 +35,16 @@
|
||||||
"visibility": "public",
|
"visibility": "public",
|
||||||
"filename": "jcentral.tar.xz",
|
"filename": "jcentral.tar.xz",
|
||||||
"unpack": true,
|
"unpack": true,
|
||||||
"digest": "3fd467642a9067a1adfde7e3461b1366912b306607677b213d9f19201c23aab5f7f6361ebea7652bed1565215ed4524b51f5ced83ea68bb51ba2abca09b66148",
|
"digest": "0a970a85165bad0247c5a015cf6e0eb22bc497ec3ab3fed3948031b066041462599586f30f275738c123715e78ca65684701ab3dba99944f36f8a21c1364a857",
|
||||||
"size": 41591712
|
"size": 41914156
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"algorithm": "sha512",
|
"algorithm": "sha512",
|
||||||
"visibility": "public",
|
"visibility": "public",
|
||||||
"filename": "gradle.tar.xz",
|
"filename": "gradle.tar.xz",
|
||||||
"unpack": true,
|
"unpack": true,
|
||||||
"digest": "9011a0a322b55c6f55ca7aa83298886f3f57e2a91a33a079fcdae5af746f9cf1528f36942138cff5a00154757d9acba2f1a4332d0f92da18e454b3c0c1788d20",
|
"digest": "2dcedca230ac47157611991d29231ea997396a094e08eca7cff47509ea79046c3bcd33c01198f367c99e9ba78d77af41619c0d47e24956f4b403b368304f8099",
|
||||||
"size": 50805888
|
"size": 52223524
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"algorithm": "sha512",
|
"algorithm": "sha512",
|
||||||
|
|
|
@ -7,9 +7,9 @@
|
||||||
"Android Support Repository (Support Library 23.0.1)",
|
"Android Support Repository (Support Library 23.0.1)",
|
||||||
"Google Support Repository (Google Play Services 8.1.0)"
|
"Google Support Repository (Google Play Services 8.1.0)"
|
||||||
],
|
],
|
||||||
"size": 535625068,
|
"size": 510579808,
|
||||||
"visibility": "internal",
|
"visibility": "internal",
|
||||||
"digest": "0627515046a23c1d109e2782865b1b3b546c1d552955e4156317f76cbb195eb630aa25feea3f4edd1c685f129da0c2a5169d4d6349c1c31d8a95158a4569a478",
|
"digest": "a4ea080f1aa5cb1d05250d45a288446ae07a54362a166bc7faa67281b5d50ee55001c1770cf9a942535b583e2f4c99d420902f065b03842d94a7d9273dca756d",
|
||||||
"algorithm": "sha512",
|
"algorithm": "sha512",
|
||||||
"filename": "android-sdk-linux.tar.xz",
|
"filename": "android-sdk-linux.tar.xz",
|
||||||
"unpack": true
|
"unpack": true
|
||||||
|
|
|
@ -16,9 +16,9 @@
|
||||||
"Android Support Repository (Support Library 23.0.1)",
|
"Android Support Repository (Support Library 23.0.1)",
|
||||||
"Google Support Repository (Google Play Services 8.1.0)"
|
"Google Support Repository (Google Play Services 8.1.0)"
|
||||||
],
|
],
|
||||||
"size": 535625068,
|
"size": 510579808,
|
||||||
"visibility": "internal",
|
"visibility": "internal",
|
||||||
"digest": "0627515046a23c1d109e2782865b1b3b546c1d552955e4156317f76cbb195eb630aa25feea3f4edd1c685f129da0c2a5169d4d6349c1c31d8a95158a4569a478",
|
"digest": "a4ea080f1aa5cb1d05250d45a288446ae07a54362a166bc7faa67281b5d50ee55001c1770cf9a942535b583e2f4c99d420902f065b03842d94a7d9273dca756d",
|
||||||
"algorithm": "sha512",
|
"algorithm": "sha512",
|
||||||
"filename": "android-sdk-linux.tar.xz",
|
"filename": "android-sdk-linux.tar.xz",
|
||||||
"unpack": true
|
"unpack": true
|
||||||
|
@ -50,15 +50,15 @@
|
||||||
"visibility": "public",
|
"visibility": "public",
|
||||||
"filename": "jcentral.tar.xz",
|
"filename": "jcentral.tar.xz",
|
||||||
"unpack": true,
|
"unpack": true,
|
||||||
"digest": "3fd467642a9067a1adfde7e3461b1366912b306607677b213d9f19201c23aab5f7f6361ebea7652bed1565215ed4524b51f5ced83ea68bb51ba2abca09b66148",
|
"digest": "0a970a85165bad0247c5a015cf6e0eb22bc497ec3ab3fed3948031b066041462599586f30f275738c123715e78ca65684701ab3dba99944f36f8a21c1364a857",
|
||||||
"size": 41591712
|
"size": 41914156
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"algorithm": "sha512",
|
"algorithm": "sha512",
|
||||||
"visibility": "public",
|
"visibility": "public",
|
||||||
"filename": "gradle.tar.xz",
|
"filename": "gradle.tar.xz",
|
||||||
"unpack": true,
|
"unpack": true,
|
||||||
"digest": "9011a0a322b55c6f55ca7aa83298886f3f57e2a91a33a079fcdae5af746f9cf1528f36942138cff5a00154757d9acba2f1a4332d0f92da18e454b3c0c1788d20",
|
"digest": "2dcedca230ac47157611991d29231ea997396a094e08eca7cff47509ea79046c3bcd33c01198f367c99e9ba78d77af41619c0d47e24956f4b403b368304f8099",
|
||||||
"size": 50805888
|
"size": 52223524
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -14,7 +14,7 @@ import org.mozilla.gecko.sync.setup.activities.ActivityUtils;
|
||||||
/**
|
/**
|
||||||
* Activity which shows the status activity or passes through to web flow.
|
* Activity which shows the status activity or passes through to web flow.
|
||||||
*/
|
*/
|
||||||
public class FxAccountWebFlowActivity extends FxAccountAbstractActivity {
|
public abstract class FxAccountWebFlowActivity extends FxAccountAbstractActivity {
|
||||||
protected static final String LOG_TAG = FxAccountWebFlowActivity.class.getSimpleName();
|
protected static final String LOG_TAG = FxAccountWebFlowActivity.class.getSimpleName();
|
||||||
|
|
||||||
protected static final String ABOUT_ACCOUNTS = "about:accounts";
|
protected static final String ABOUT_ACCOUNTS = "about:accounts";
|
||||||
|
|
|
@ -67,16 +67,10 @@ public class TestRunner extends RobolectricGradleTestRunner {
|
||||||
final String flavor = getFlavor(config);
|
final String flavor = getFlavor(config);
|
||||||
final String packageName = getPackageName(config);
|
final String packageName = getPackageName(config);
|
||||||
|
|
||||||
final FsFile res;
|
final FsFile assets = buildFolder.join("assets", flavor, type);;
|
||||||
final FsFile assets;
|
final FsFile manifest = buildFolder.join("manifests", "full", flavor, type, "AndroidManifest.xml");
|
||||||
final FsFile manifest;
|
|
||||||
|
|
||||||
if (areResourcesFromLibrary()) {
|
final FsFile res;
|
||||||
FsFile bundlesFolder = buildFolder.join("bundles", flavor, type);
|
|
||||||
res = bundlesFolder.join("res");
|
|
||||||
assets = bundlesFolder.join("assets");
|
|
||||||
manifest = bundlesFolder.join("AndroidManifest.xml");
|
|
||||||
} else {
|
|
||||||
if (buildFolder.join("res", "merged").exists()) {
|
if (buildFolder.join("res", "merged").exists()) {
|
||||||
res = buildFolder.join("res", "merged", flavor, type);
|
res = buildFolder.join("res", "merged", flavor, type);
|
||||||
} else if(buildFolder.join("res").exists()) {
|
} else if(buildFolder.join("res").exists()) {
|
||||||
|
@ -84,9 +78,6 @@ public class TestRunner extends RobolectricGradleTestRunner {
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalStateException("No resource folder found");
|
throw new IllegalStateException("No resource folder found");
|
||||||
}
|
}
|
||||||
assets = buildFolder.join("assets", flavor, type);
|
|
||||||
manifest = buildFolder.join("manifests", "full", flavor, type, "AndroidManifest.xml");
|
|
||||||
}
|
|
||||||
|
|
||||||
Logger.debug("Robolectric assets directory: " + assets.getPath());
|
Logger.debug("Robolectric assets directory: " + assets.getPath());
|
||||||
Logger.debug(" Robolectric res directory: " + res.getPath());
|
Logger.debug(" Robolectric res directory: " + res.getPath());
|
||||||
|
@ -95,10 +86,6 @@ public class TestRunner extends RobolectricGradleTestRunner {
|
||||||
return new AndroidManifest(manifest, res, assets, packageName);
|
return new AndroidManifest(manifest, res, assets, packageName);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean areResourcesFromLibrary() {
|
|
||||||
return buildFolder.join("bundles").exists();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String getType(Config config) {
|
private static String getType(Config config) {
|
||||||
try {
|
try {
|
||||||
return ReflectionHelpers.getStaticField(config.constants(), "BUILD_TYPE");
|
return ReflectionHelpers.getStaticField(config.constants(), "BUILD_TYPE");
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
set -x -e
|
set -x -e
|
||||||
|
|
||||||
: WORKSPACE ${WORKSPACE:=/workspace}
|
: WORKSPACE ${WORKSPACE:=/workspace}
|
||||||
: GRADLE_VERSION ${GRADLE_VERSION:=2.7}
|
: GRADLE_VERSION ${GRADLE_VERSION:=2.10}
|
||||||
|
|
||||||
set -v
|
set -v
|
||||||
|
|
||||||
|
|
|
@ -137,6 +137,43 @@ this.PlacesTestUtils = Object.freeze({
|
||||||
});
|
});
|
||||||
commit.finalize();
|
commit.finalize();
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Asynchronously checks if an address is found in the database.
|
||||||
|
* @param aURI
|
||||||
|
* nsIURI or address to look for.
|
||||||
|
*
|
||||||
|
* @return {Promise}
|
||||||
|
* @resolves Returns true if the page is found.
|
||||||
|
* @rejects JavaScript exception.
|
||||||
|
*/
|
||||||
|
isPageInDB: Task.async(function* (aURI) {
|
||||||
|
let url = aURI instanceof Ci.nsIURI ? aURI.spec : aURI;
|
||||||
|
let db = yield PlacesUtils.promiseDBConnection();
|
||||||
|
let rows = yield db.executeCached(
|
||||||
|
"SELECT id FROM moz_places WHERE url = :url",
|
||||||
|
{ url });
|
||||||
|
return rows.length > 0;
|
||||||
|
}),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Asynchronously checks how many visits exist for a specified page.
|
||||||
|
* @param aURI
|
||||||
|
* nsIURI or address to look for.
|
||||||
|
*
|
||||||
|
* @return {Promise}
|
||||||
|
* @resolves Returns the number of visits found.
|
||||||
|
* @rejects JavaScript exception.
|
||||||
|
*/
|
||||||
|
visitsInDB: Task.async(function* (aURI) {
|
||||||
|
let url = aURI instanceof Ci.nsIURI ? aURI.spec : aURI;
|
||||||
|
let db = yield PlacesUtils.promiseDBConnection();
|
||||||
|
let rows = yield db.executeCached(
|
||||||
|
`SELECT count(*) FROM moz_historyvisits v
|
||||||
|
JOIN moz_places h ON h.id = v.place_id
|
||||||
|
WHERE url = :url`,
|
||||||
|
{ url });
|
||||||
|
return rows[0].getResultByIndex(0);
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||||
|
/* vim:set ts=2 sw=2 sts=2 et: */
|
||||||
|
|
||||||
|
add_task(function* test_execute() {
|
||||||
|
var good_uri = uri("http://mozilla.com");
|
||||||
|
var bad_uri = uri("http://google.com");
|
||||||
|
yield PlacesTestUtils.addVisits({uri: good_uri});
|
||||||
|
do_check_true(yield PlacesTestUtils.isPageInDB(good_uri));
|
||||||
|
do_check_false(yield PlacesTestUtils.isPageInDB(bad_uri));
|
||||||
|
});
|
|
@ -0,0 +1,12 @@
|
||||||
|
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||||
|
/* vim:set ts=2 sw=2 sts=2 et: */
|
||||||
|
|
||||||
|
add_task(function* test_execute() {
|
||||||
|
const TEST_URI = uri("http://mozilla.com");
|
||||||
|
|
||||||
|
do_check_eq(0, yield PlacesTestUtils.visitsInDB(TEST_URI));
|
||||||
|
yield PlacesTestUtils.addVisits({uri: TEST_URI});
|
||||||
|
do_check_eq(1, yield PlacesTestUtils.visitsInDB(TEST_URI));
|
||||||
|
yield PlacesTestUtils.addVisits({uri: TEST_URI});
|
||||||
|
do_check_eq(2, yield PlacesTestUtils.visitsInDB(TEST_URI));
|
||||||
|
});
|
|
@ -103,6 +103,7 @@ skip-if = os == "android"
|
||||||
skip-if = os == "android"
|
skip-if = os == "android"
|
||||||
[test_history_sidebar.js]
|
[test_history_sidebar.js]
|
||||||
[test_hosts_triggers.js]
|
[test_hosts_triggers.js]
|
||||||
|
[test_isPageInDB.js]
|
||||||
[test_isURIVisited.js]
|
[test_isURIVisited.js]
|
||||||
[test_isvisited.js]
|
[test_isvisited.js]
|
||||||
[test_keywords.js]
|
[test_keywords.js]
|
||||||
|
@ -149,3 +150,4 @@ skip-if = os == "android"
|
||||||
[test_utils_backups_create.js]
|
[test_utils_backups_create.js]
|
||||||
[test_utils_getURLsForContainerNode.js]
|
[test_utils_getURLsForContainerNode.js]
|
||||||
[test_utils_setAnnotationsFor.js]
|
[test_utils_setAnnotationsFor.js]
|
||||||
|
[test_visitsInDB.js]
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
<!ENTITY window.emWidth "26em">
|
<!ENTITY window.emWidth "26em">
|
||||||
<!ENTITY window.emHeight "26em">
|
<!ENTITY window.emHeight "26em">
|
||||||
<!ENTITY ChooseApp.description "Choose an Application">
|
<!ENTITY ChooseOtherApp.description "Choose other Application">
|
||||||
<!ENTITY ChooseApp.label "Choose…">
|
<!ENTITY ChooseApp.label "Choose…">
|
||||||
<!ENTITY ChooseApp.accessKey "C">
|
<!ENTITY ChooseApp.accessKey "C">
|
||||||
|
<!ENTITY accept "Open link">
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
ondblclick="dialog.onDblClick();"
|
ondblclick="dialog.onDblClick();"
|
||||||
onselect="dialog.updateOKButton();">
|
onselect="dialog.updateOKButton();">
|
||||||
<richlistitem id="item-choose" orient="horizontal" selected="true">
|
<richlistitem id="item-choose" orient="horizontal" selected="true">
|
||||||
<label value="&ChooseApp.description;" flex="1"/>
|
<label value="&ChooseOtherApp.description;" flex="1"/>
|
||||||
<button oncommand="dialog.chooseApplication();"
|
<button oncommand="dialog.chooseApplication();"
|
||||||
label="&ChooseApp.label;" accesskey="&ChooseApp.accessKey;"/>
|
label="&ChooseApp.label;" accesskey="&ChooseApp.accessKey;"/>
|
||||||
</richlistitem>
|
</richlistitem>
|
||||||
|
@ -44,4 +44,9 @@
|
||||||
<checkbox id="remember" aria-describedby="remember-text" oncommand="dialog.onCheck();"/>
|
<checkbox id="remember" aria-describedby="remember-text" oncommand="dialog.onCheck();"/>
|
||||||
<description id="remember-text"/>
|
<description id="remember-text"/>
|
||||||
|
|
||||||
|
<hbox class="dialog-button-box" pack="end">
|
||||||
|
<button dlgtype="cancel" icon="cancel" class="dialog-button"/>
|
||||||
|
<button dlgtype="accept" label="&accept;" icon="open" class="dialog-button"/>
|
||||||
|
</hbox>
|
||||||
|
|
||||||
</dialog>
|
</dialog>
|
||||||
|
|
Загрузка…
Ссылка в новой задаче