forked from mirrors/gecko-dev
Backed out changeset 67611ffb1fef (bug 1325213) for failures in test_require_lazy.js
This commit is contained in:
parent
4eb1252534
commit
6ac54a1574
40 changed files with 798 additions and 967 deletions
|
|
@ -117,10 +117,20 @@ devtools/server/tests/browser/**
|
||||||
devtools/server/tests/mochitest/**
|
devtools/server/tests/mochitest/**
|
||||||
devtools/server/tests/unit/**
|
devtools/server/tests/unit/**
|
||||||
devtools/shared/apps/**
|
devtools/shared/apps/**
|
||||||
|
devtools/shared/client/**
|
||||||
|
devtools/shared/discovery/**
|
||||||
devtools/shared/gcli/**
|
devtools/shared/gcli/**
|
||||||
!devtools/shared/gcli/templater.js
|
!devtools/shared/gcli/templater.js
|
||||||
devtools/shared/heapsnapshot/**
|
devtools/shared/heapsnapshot/**
|
||||||
devtools/shared/layout/**
|
devtools/shared/layout/**
|
||||||
|
devtools/shared/performance/**
|
||||||
|
!devtools/shared/platform/**
|
||||||
|
devtools/shared/qrcode/**
|
||||||
|
devtools/shared/security/**
|
||||||
|
devtools/shared/shims/**
|
||||||
|
devtools/shared/tests/**
|
||||||
|
!devtools/shared/tests/unit/test_csslexer.js
|
||||||
|
devtools/shared/touch/**
|
||||||
devtools/shared/transport/**
|
devtools/shared/transport/**
|
||||||
!devtools/shared/transport/transport.js
|
!devtools/shared/transport/transport.js
|
||||||
!devtools/shared/transport/websocket-transport.js
|
!devtools/shared/transport/websocket-transport.js
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,9 @@
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const {Cc, Ci, Cr} = require("chrome");
|
const {Cc, Ci, Cu, Cr} = require("chrome");
|
||||||
const EventEmitter = require("devtools/shared/event-emitter");
|
const EventEmitter = require("devtools/shared/event-emitter");
|
||||||
|
const DevToolsUtils = require("devtools/shared/DevToolsUtils");
|
||||||
const { DebuggerServer } = require("devtools/server/main");
|
const { DebuggerServer } = require("devtools/server/main");
|
||||||
const { DebuggerClient } = require("devtools/shared/client/main");
|
const { DebuggerClient } = require("devtools/shared/client/main");
|
||||||
const Services = require("Services");
|
const Services = require("Services");
|
||||||
|
|
@ -69,10 +70,8 @@ const REMOTE_TIMEOUT = "devtools.debugger.remote-timeout";
|
||||||
* . Connection.Events.CONNECTING Trying to connect to host:port
|
* . Connection.Events.CONNECTING Trying to connect to host:port
|
||||||
* . Connection.Events.CONNECTED Connection is successful
|
* . Connection.Events.CONNECTED Connection is successful
|
||||||
* . Connection.Events.DISCONNECTING Trying to disconnect from server
|
* . Connection.Events.DISCONNECTING Trying to disconnect from server
|
||||||
* . Connection.Events.DISCONNECTED Disconnected (at client request,
|
* . Connection.Events.DISCONNECTED Disconnected (at client request, or because of a timeout or connection error)
|
||||||
* or because of a timeout or connection error)
|
* . Connection.Events.STATUS_CHANGED The connection status (connection.status) has changed
|
||||||
* . Connection.Events.STATUS_CHANGED The connection status (connection.status)
|
|
||||||
* has changed
|
|
||||||
* . Connection.Events.TIMEOUT Connection timeout
|
* . Connection.Events.TIMEOUT Connection timeout
|
||||||
* . Connection.Events.HOST_CHANGED Host has changed
|
* . Connection.Events.HOST_CHANGED Host has changed
|
||||||
* . Connection.Events.PORT_CHANGED Port has changed
|
* . Connection.Events.PORT_CHANGED Port has changed
|
||||||
|
|
@ -169,9 +168,8 @@ Connection.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
set host(value) {
|
set host(value) {
|
||||||
if (this._host && this._host == value) {
|
if (this._host && this._host == value)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
this._host = value;
|
this._host = value;
|
||||||
this.emit(Connection.Events.HOST_CHANGED);
|
this.emit(Connection.Events.HOST_CHANGED);
|
||||||
},
|
},
|
||||||
|
|
@ -181,9 +179,8 @@ Connection.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
set port(value) {
|
set port(value) {
|
||||||
if (this._port && this._port == value) {
|
if (this._port && this._port == value)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
this._port = value;
|
this._port = value;
|
||||||
this.emit(Connection.Events.PORT_CHANGED);
|
this.emit(Connection.Events.PORT_CHANGED);
|
||||||
},
|
},
|
||||||
|
|
@ -337,9 +334,8 @@ Connection.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
_setStatus: function (value) {
|
_setStatus: function (value) {
|
||||||
if (this._status && this._status == value) {
|
if (this._status && this._status == value)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
this._status = value;
|
this._status = value;
|
||||||
this.emit(value);
|
this.emit(value);
|
||||||
this.emit(Connection.Events.STATUS_CHANGED, value);
|
this.emit(Connection.Events.STATUS_CHANGED, value);
|
||||||
|
|
@ -361,9 +357,7 @@ Connection.prototype = {
|
||||||
this.log("disconnected (unexpected)");
|
this.log("disconnected (unexpected)");
|
||||||
break;
|
break;
|
||||||
case Connection.Status.CONNECTING:
|
case Connection.Status.CONNECTING:
|
||||||
this.log("connection error. Possible causes: USB port not connected, port not " +
|
this.log("connection error. Possible causes: USB port not connected, port not forwarded (adb forward), wrong host or port, remote debugging not enabled on the device.");
|
||||||
"forwarded (adb forward), wrong host or port, remote debugging not " +
|
|
||||||
"enabled on the device.");
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
this.log("disconnected");
|
this.log("disconnected");
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -47,8 +47,8 @@ const REPLY_TIMEOUT = 5000;
|
||||||
const { XPCOMUtils } = Cu.import("resource://gre/modules/XPCOMUtils.jsm", {});
|
const { XPCOMUtils } = Cu.import("resource://gre/modules/XPCOMUtils.jsm", {});
|
||||||
|
|
||||||
XPCOMUtils.defineLazyGetter(this, "converter", () => {
|
XPCOMUtils.defineLazyGetter(this, "converter", () => {
|
||||||
let conv = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
|
let conv = Cc["@mozilla.org/intl/scriptableunicodeconverter"].
|
||||||
.createInstance(Ci.nsIScriptableUnicodeConverter);
|
createInstance(Ci.nsIScriptableUnicodeConverter);
|
||||||
conv.charset = "utf8";
|
conv.charset = "utf8";
|
||||||
return conv;
|
return conv;
|
||||||
});
|
});
|
||||||
|
|
@ -77,8 +77,7 @@ function log(msg) {
|
||||||
function Transport(port) {
|
function Transport(port) {
|
||||||
EventEmitter.decorate(this);
|
EventEmitter.decorate(this);
|
||||||
try {
|
try {
|
||||||
this.socket = new UDPSocket(port, false,
|
this.socket = new UDPSocket(port, false, Services.scriptSecurityManager.getSystemPrincipal());
|
||||||
Services.scriptSecurityManager.getSystemPrincipal());
|
|
||||||
this.socket.joinMulticast(ADDRESS);
|
this.socket.joinMulticast(ADDRESS);
|
||||||
this.socket.asyncListen(this);
|
this.socket.asyncListen(this);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
@ -147,8 +146,7 @@ function LocalDevice() {
|
||||||
Cc["@mozilla.org/settingsService;1"].getService(Ci.nsISettingsService);
|
Cc["@mozilla.org/settingsService;1"].getService(Ci.nsISettingsService);
|
||||||
Services.obs.addObserver(this, "mozsettings-changed", false);
|
Services.obs.addObserver(this, "mozsettings-changed", false);
|
||||||
}
|
}
|
||||||
// Trigger |_get| to load name eagerly
|
this._get(); // Trigger |_get| to load name eagerly
|
||||||
this._get();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LocalDevice.SETTING = "devtools.discovery.device";
|
LocalDevice.SETTING = "devtools.discovery.device";
|
||||||
|
|
@ -346,8 +344,7 @@ Discovery.prototype = {
|
||||||
|
|
||||||
_startListeningForScan: function () {
|
_startListeningForScan: function () {
|
||||||
if (this._transports.scan) {
|
if (this._transports.scan) {
|
||||||
// Already listening
|
return; // Already listening
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
log("LISTEN FOR SCAN");
|
log("LISTEN FOR SCAN");
|
||||||
this._transports.scan = new this.Transport(SCAN_PORT);
|
this._transports.scan = new this.Transport(SCAN_PORT);
|
||||||
|
|
@ -356,8 +353,7 @@ Discovery.prototype = {
|
||||||
|
|
||||||
_stopListeningForScan: function () {
|
_stopListeningForScan: function () {
|
||||||
if (!this._transports.scan) {
|
if (!this._transports.scan) {
|
||||||
// Not listening
|
return; // Not listening
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
this._transports.scan.off("message", this._onRemoteScan);
|
this._transports.scan.off("message", this._onRemoteScan);
|
||||||
this._transports.scan.destroy();
|
this._transports.scan.destroy();
|
||||||
|
|
@ -366,8 +362,7 @@ Discovery.prototype = {
|
||||||
|
|
||||||
_startListeningForUpdate: function () {
|
_startListeningForUpdate: function () {
|
||||||
if (this._transports.update) {
|
if (this._transports.update) {
|
||||||
// Already listening
|
return; // Already listening
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
log("LISTEN FOR UPDATE");
|
log("LISTEN FOR UPDATE");
|
||||||
this._transports.update = new this.Transport(UPDATE_PORT);
|
this._transports.update = new this.Transport(UPDATE_PORT);
|
||||||
|
|
@ -376,8 +371,7 @@ Discovery.prototype = {
|
||||||
|
|
||||||
_stopListeningForUpdate: function () {
|
_stopListeningForUpdate: function () {
|
||||||
if (!this._transports.update) {
|
if (!this._transports.update) {
|
||||||
// Not listening
|
return; // Not listening
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
this._transports.update.off("message", this._onRemoteUpdate);
|
this._transports.update.off("message", this._onRemoteUpdate);
|
||||||
this._transports.update.destroy();
|
this._transports.update.destroy();
|
||||||
|
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
"use strict";
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
// Extend from the shared list of defined globals for mochitests.
|
|
||||||
"extends": "../../../../.eslintrc.xpcshell.js"
|
|
||||||
};
|
|
||||||
|
|
@ -8,6 +8,7 @@ var Cu = Components.utils;
|
||||||
const { require } =
|
const { require } =
|
||||||
Cu.import("resource://devtools/shared/Loader.jsm", {});
|
Cu.import("resource://devtools/shared/Loader.jsm", {});
|
||||||
const Services = require("Services");
|
const Services = require("Services");
|
||||||
|
const promise = require("promise");
|
||||||
const defer = require("devtools/shared/defer");
|
const defer = require("devtools/shared/defer");
|
||||||
const EventEmitter = require("devtools/shared/event-emitter");
|
const EventEmitter = require("devtools/shared/event-emitter");
|
||||||
const discovery = require("devtools/shared/discovery/discovery");
|
const discovery = require("devtools/shared/discovery/discovery");
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
* and LegacyPerformanceRecording for helper methods to access data.
|
* and LegacyPerformanceRecording for helper methods to access data.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
exports.PerformanceRecordingCommon = {
|
const PerformanceRecordingCommon = exports.PerformanceRecordingCommon = {
|
||||||
// Private fields, only needed when a recording is started or stopped.
|
// Private fields, only needed when a recording is started or stopped.
|
||||||
_console: false,
|
_console: false,
|
||||||
_imported: false,
|
_imported: false,
|
||||||
|
|
@ -35,32 +35,18 @@ exports.PerformanceRecordingCommon = {
|
||||||
* Helper methods for returning the status of the recording.
|
* Helper methods for returning the status of the recording.
|
||||||
* These methods should be consistent on both the front and actor.
|
* These methods should be consistent on both the front and actor.
|
||||||
*/
|
*/
|
||||||
isRecording: function () {
|
isRecording: function () { return this._recording; },
|
||||||
return this._recording;
|
isCompleted: function () { return this._completed || this.isImported(); },
|
||||||
},
|
isFinalizing: function () { return !this.isRecording() && !this.isCompleted(); },
|
||||||
isCompleted: function () {
|
isConsole: function () { return this._console; },
|
||||||
return this._completed || this.isImported();
|
isImported: function () { return this._imported; },
|
||||||
},
|
|
||||||
isFinalizing: function () {
|
|
||||||
return !this.isRecording() && !this.isCompleted();
|
|
||||||
},
|
|
||||||
isConsole: function () {
|
|
||||||
return this._console;
|
|
||||||
},
|
|
||||||
isImported: function () {
|
|
||||||
return this._imported;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper methods for returning configuration for the recording.
|
* Helper methods for returning configuration for the recording.
|
||||||
* These methods should be consistent on both the front and actor.
|
* These methods should be consistent on both the front and actor.
|
||||||
*/
|
*/
|
||||||
getConfiguration: function () {
|
getConfiguration: function () { return this._configuration; },
|
||||||
return this._configuration;
|
getLabel: function () { return this._label; },
|
||||||
},
|
|
||||||
getLabel: function () {
|
|
||||||
return this._label;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets duration of this recording, in milliseconds.
|
* Gets duration of this recording, in milliseconds.
|
||||||
|
|
@ -73,43 +59,25 @@ exports.PerformanceRecordingCommon = {
|
||||||
// the duration from the profiler; if between recording and being finalized,
|
// the duration from the profiler; if between recording and being finalized,
|
||||||
// use the last estimated duration.
|
// use the last estimated duration.
|
||||||
if (this.isRecording()) {
|
if (this.isRecording()) {
|
||||||
this._estimatedDuration = Date.now() - this._localStartTime;
|
return this._estimatedDuration = Date.now() - this._localStartTime;
|
||||||
return this._estimatedDuration;
|
} else {
|
||||||
|
return this._duration || this._estimatedDuration || 0;
|
||||||
}
|
}
|
||||||
return this._duration || this._estimatedDuration || 0;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper methods for returning recording data.
|
* Helper methods for returning recording data.
|
||||||
* These methods should be consistent on both the front and actor.
|
* These methods should be consistent on both the front and actor.
|
||||||
*/
|
*/
|
||||||
getMarkers: function () {
|
getMarkers: function () { return this._markers; },
|
||||||
return this._markers;
|
getFrames: function () { return this._frames; },
|
||||||
},
|
getMemory: function () { return this._memory; },
|
||||||
getFrames: function () {
|
getTicks: function () { return this._ticks; },
|
||||||
return this._frames;
|
getAllocations: function () { return this._allocations; },
|
||||||
},
|
getProfile: function () { return this._profile; },
|
||||||
getMemory: function () {
|
getHostSystemInfo: function () { return this._systemHost; },
|
||||||
return this._memory;
|
getClientSystemInfo: function () { return this._systemClient; },
|
||||||
},
|
getStartingBufferStatus: function () { return this._startingBufferStatus; },
|
||||||
getTicks: function () {
|
|
||||||
return this._ticks;
|
|
||||||
},
|
|
||||||
getAllocations: function () {
|
|
||||||
return this._allocations;
|
|
||||||
},
|
|
||||||
getProfile: function () {
|
|
||||||
return this._profile;
|
|
||||||
},
|
|
||||||
getHostSystemInfo: function () {
|
|
||||||
return this._systemHost;
|
|
||||||
},
|
|
||||||
getClientSystemInfo: function () {
|
|
||||||
return this._systemClient;
|
|
||||||
},
|
|
||||||
getStartingBufferStatus: function () {
|
|
||||||
return this._startingBufferStatus;
|
|
||||||
},
|
|
||||||
|
|
||||||
getAllData: function () {
|
getAllData: function () {
|
||||||
let label = this.getLabel();
|
let label = this.getLabel();
|
||||||
|
|
@ -124,18 +92,6 @@ exports.PerformanceRecordingCommon = {
|
||||||
let systemHost = this.getHostSystemInfo();
|
let systemHost = this.getHostSystemInfo();
|
||||||
let systemClient = this.getClientSystemInfo();
|
let systemClient = this.getClientSystemInfo();
|
||||||
|
|
||||||
return {
|
return { label, duration, markers, frames, memory, ticks, allocations, profile, configuration, systemHost, systemClient };
|
||||||
label,
|
|
||||||
duration,
|
|
||||||
markers,
|
|
||||||
frames,
|
|
||||||
memory,
|
|
||||||
ticks,
|
|
||||||
allocations,
|
|
||||||
profile,
|
|
||||||
configuration,
|
|
||||||
systemHost,
|
|
||||||
systemClient
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
const { Cc, Ci, Cu, Cr } = require("chrome");
|
||||||
loader.lazyRequireGetter(this, "extend",
|
loader.lazyRequireGetter(this, "extend",
|
||||||
"sdk/util/object", true);
|
"sdk/util/object", true);
|
||||||
|
|
||||||
|
|
@ -15,8 +16,7 @@ function mapRecordingOptions(type, options) {
|
||||||
if (type === "profiler") {
|
if (type === "profiler") {
|
||||||
return {
|
return {
|
||||||
entries: options.bufferSize,
|
entries: options.bufferSize,
|
||||||
interval: options.sampleFrequency ? (1000 / (options.sampleFrequency * 1000))
|
interval: options.sampleFrequency ? (1000 / (options.sampleFrequency * 1000)) : void 0
|
||||||
: void 0
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -568,8 +568,7 @@ UniqueStacks.prototype.getOrAddFrameIndex = function (frame) {
|
||||||
let implementationIndex = this.getOrAddStringIndex(frame.implementation);
|
let implementationIndex = this.getOrAddStringIndex(frame.implementation);
|
||||||
|
|
||||||
// Super dumb.
|
// Super dumb.
|
||||||
let hash = `${locationIndex} ${implementationIndex || ""} ` +
|
let hash = `${locationIndex} ${implementationIndex || ""} ${frame.line || ""} ${frame.category || ""}`;
|
||||||
`${frame.line || ""} ${frame.category || ""}`;
|
|
||||||
|
|
||||||
let index = frameHash[hash];
|
let index = frameHash[hash];
|
||||||
if (index !== undefined) {
|
if (index !== undefined) {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
"use strict";
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
// Extend from the shared list of defined globals for mochitests.
|
|
||||||
"extends": "../../../.eslintrc.xpcshell.js"
|
|
||||||
};
|
|
||||||
|
|
@ -1,10 +1,7 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
/* exported require */
|
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var { utils: Cu } = Components;
|
var { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;
|
||||||
|
|
||||||
var { require } = Cu.import("resource://devtools/shared/Loader.jsm", {});
|
var { require } = Cu.import("resource://devtools/shared/Loader.jsm", {});
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,6 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests if allocations data received from the performance actor is properly
|
* Tests if allocations data received from the performance actor is properly
|
||||||
* converted to something that follows the same structure as the samples data
|
* converted to something that follows the same structure as the samples data
|
||||||
|
|
@ -67,15 +65,9 @@ var EXPECTED_OUTPUT = {
|
||||||
},
|
},
|
||||||
"data": [
|
"data": [
|
||||||
null,
|
null,
|
||||||
|
[ null, 1 ], // x (A:1:2)
|
||||||
// x (A:1:2)
|
[ 1, 2 ], // x (A:1:2) > y (B:3:4)
|
||||||
[ null, 1 ],
|
[ 2, 3 ] // x (A:1:2) > y (B:3:4) > C:5:6
|
||||||
|
|
||||||
// x (A:1:2) > y (B:3:4)
|
|
||||||
[ 1, 2 ],
|
|
||||||
|
|
||||||
// x (A:1:2) > y (B:3:4) > C:5:6
|
|
||||||
[ 2, 3 ]
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
frameTable: {
|
frameTable: {
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
const { Cu } = require("chrome");
|
||||||
const promise = require("promise");
|
const promise = require("promise");
|
||||||
const defer = require("devtools/shared/defer");
|
const defer = require("devtools/shared/defer");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
"use strict";
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
// Extend from the shared list of defined globals for mochitests.
|
|
||||||
"extends": "../../../../.eslintrc.xpcshell.js"
|
|
||||||
};
|
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
var { Ci, Cc } = require("chrome");
|
var { Ci, Cc } = require("chrome");
|
||||||
var Services = require("Services");
|
var Services = require("Services");
|
||||||
|
var promise = require("promise");
|
||||||
var defer = require("devtools/shared/defer");
|
var defer = require("devtools/shared/defer");
|
||||||
var DevToolsUtils = require("devtools/shared/DevToolsUtils");
|
var DevToolsUtils = require("devtools/shared/DevToolsUtils");
|
||||||
var { dumpn, dumpv } = DevToolsUtils;
|
var { dumpn, dumpv } = DevToolsUtils;
|
||||||
|
|
@ -407,8 +408,7 @@ OOBCert.Client.prototype = {
|
||||||
}),
|
}),
|
||||||
|
|
||||||
_createRandom() {
|
_createRandom() {
|
||||||
// 16 bytes / 128 bits
|
const length = 16; // 16 bytes / 128 bits
|
||||||
const length = 16;
|
|
||||||
let rng = Cc["@mozilla.org/security/random-generator;1"]
|
let rng = Cc["@mozilla.org/security/random-generator;1"]
|
||||||
.createInstance(Ci.nsIRandomGenerator);
|
.createInstance(Ci.nsIRandomGenerator);
|
||||||
let bytes = rng.generateRandomBytes(length);
|
let bytes = rng.generateRandomBytes(length);
|
||||||
|
|
@ -545,11 +545,9 @@ OOBCert.Server.prototype = {
|
||||||
switch (authResult) {
|
switch (authResult) {
|
||||||
case AuthenticationResult.ALLOW_PERSIST:
|
case AuthenticationResult.ALLOW_PERSIST:
|
||||||
case AuthenticationResult.ALLOW:
|
case AuthenticationResult.ALLOW:
|
||||||
// Further processing
|
break; // Further processing
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
// Abort for any negative results
|
return authResult; // Abort for any negative results
|
||||||
return authResult;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Examine additional data for authentication
|
// Examine additional data for authentication
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var { Ci, Cc } = require("chrome");
|
var { Ci, Cc } = require("chrome");
|
||||||
|
var promise = require("promise");
|
||||||
var defer = require("devtools/shared/defer");
|
var defer = require("devtools/shared/defer");
|
||||||
var DevToolsUtils = require("devtools/shared/DevToolsUtils");
|
var DevToolsUtils = require("devtools/shared/DevToolsUtils");
|
||||||
DevToolsUtils.defineLazyGetter(this, "localCertService", () => {
|
DevToolsUtils.defineLazyGetter(this, "localCertService", () => {
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var { Ci, Cc, CC, Cr } = require("chrome");
|
var { Ci, Cc, CC, Cr, Cu } = require("chrome");
|
||||||
|
|
||||||
// Ensure PSM is initialized to support TLS sockets
|
// Ensure PSM is initialized to support TLS sockets
|
||||||
Cc["@mozilla.org/psm;1"].getService(Ci.nsISupports);
|
Cc["@mozilla.org/psm;1"].getService(Ci.nsISupports);
|
||||||
|
|
@ -143,8 +143,7 @@ var _getTransport = Task.async(function* (settings) {
|
||||||
|
|
||||||
let attempt = yield _attemptTransport(settings);
|
let attempt = yield _attemptTransport(settings);
|
||||||
if (attempt.transport) {
|
if (attempt.transport) {
|
||||||
// Success
|
return attempt.transport; // Success
|
||||||
return attempt.transport;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the server cert failed validation, store a temporary override and make
|
// If the server cert failed validation, store a temporary override and make
|
||||||
|
|
@ -157,8 +156,7 @@ var _getTransport = Task.async(function* (settings) {
|
||||||
|
|
||||||
attempt = yield _attemptTransport(settings);
|
attempt = yield _attemptTransport(settings);
|
||||||
if (attempt.transport) {
|
if (attempt.transport) {
|
||||||
// Success
|
return attempt.transport; // Success
|
||||||
return attempt.transport;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new Error("Connection failed even after cert override");
|
throw new Error("Connection failed even after cert override");
|
||||||
|
|
@ -358,7 +356,7 @@ function _storeCertOverride(s, host, port) {
|
||||||
let overrideBits = Ci.nsICertOverrideService.ERROR_UNTRUSTED |
|
let overrideBits = Ci.nsICertOverrideService.ERROR_UNTRUSTED |
|
||||||
Ci.nsICertOverrideService.ERROR_MISMATCH;
|
Ci.nsICertOverrideService.ERROR_MISMATCH;
|
||||||
certOverrideService.rememberValidityOverride(host, port, cert, overrideBits,
|
certOverrideService.rememberValidityOverride(host, port, cert, overrideBits,
|
||||||
true /* temporary */); // eslint-disable-line
|
true /* temporary */);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
"use strict";
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
// Extend from the shared list of defined globals for mochitests.
|
|
||||||
"extends": "../../../../../testing/mochitest/chrome.eslintrc.js"
|
|
||||||
};
|
|
||||||
|
|
@ -9,9 +9,7 @@
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script>
|
<script>
|
||||||
"use strict";
|
window.onload = function() {
|
||||||
|
|
||||||
window.onload = function () {
|
|
||||||
const {require} = Components.utils.import("resource://devtools/shared/Loader.jsm", {});
|
const {require} = Components.utils.import("resource://devtools/shared/Loader.jsm", {});
|
||||||
const Services = require("Services");
|
const Services = require("Services");
|
||||||
const {DebuggerClient} = require("devtools/shared/client/main");
|
const {DebuggerClient} = require("devtools/shared/client/main");
|
||||||
|
|
@ -49,7 +47,7 @@ window.onload = function () {
|
||||||
|
|
||||||
let client = new DebuggerClient(transport);
|
let client = new DebuggerClient(transport);
|
||||||
let onUnexpectedClose = () => {
|
let onUnexpectedClose = () => {
|
||||||
ok(false, "Closed unexpectedly");
|
do_throw("Closed unexpectedly");
|
||||||
};
|
};
|
||||||
client.addListener("closed", onUnexpectedClose);
|
client.addListener("closed", onUnexpectedClose);
|
||||||
|
|
||||||
|
|
@ -72,7 +70,7 @@ window.onload = function () {
|
||||||
|
|
||||||
DebuggerServer.destroy();
|
DebuggerServer.destroy();
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
|
|
@ -2,14 +2,20 @@
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
var Cc = Components.classes;
|
||||||
|
var Ci = Components.interfaces;
|
||||||
|
var Cu = Components.utils;
|
||||||
|
var Cr = Components.results;
|
||||||
|
var CC = Components.Constructor;
|
||||||
|
|
||||||
/* exported defer, DebuggerClient, initTestDebuggerServer */
|
|
||||||
|
|
||||||
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
|
|
||||||
const { require } =
|
const { require } =
|
||||||
Cu.import("resource://devtools/shared/Loader.jsm", {});
|
Cu.import("resource://devtools/shared/Loader.jsm", {});
|
||||||
|
const promise = require("promise");
|
||||||
const defer = require("devtools/shared/defer");
|
const defer = require("devtools/shared/defer");
|
||||||
|
const { Task } = require("devtools/shared/task");
|
||||||
|
|
||||||
const Services = require("Services");
|
const Services = require("Services");
|
||||||
|
const DevToolsUtils = require("devtools/shared/DevToolsUtils");
|
||||||
const xpcInspector = require("xpcInspector");
|
const xpcInspector = require("xpcInspector");
|
||||||
const { DebuggerServer } = require("devtools/server/main");
|
const { DebuggerServer } = require("devtools/server/main");
|
||||||
const { DebuggerClient } = require("devtools/shared/client/main");
|
const { DebuggerClient } = require("devtools/shared/client/main");
|
||||||
|
|
@ -25,43 +31,43 @@ Services.prefs.setBoolPref("devtools.debugger.remote-enabled", true);
|
||||||
// Fast timeout for TLS tests
|
// Fast timeout for TLS tests
|
||||||
Services.prefs.setIntPref("devtools.remote.tls-handshake-timeout", 1000);
|
Services.prefs.setIntPref("devtools.remote.tls-handshake-timeout", 1000);
|
||||||
|
|
||||||
// Convert an nsIScriptError 'flags' value into an appropriate string.
|
// Convert an nsIScriptError 'aFlags' value into an appropriate string.
|
||||||
function scriptErrorFlagsToKind(flags) {
|
function scriptErrorFlagsToKind(aFlags) {
|
||||||
let kind;
|
var kind;
|
||||||
if (flags & Ci.nsIScriptError.warningFlag) {
|
if (aFlags & Ci.nsIScriptError.warningFlag)
|
||||||
kind = "warning";
|
kind = "warning";
|
||||||
}
|
if (aFlags & Ci.nsIScriptError.exceptionFlag)
|
||||||
if (flags & Ci.nsIScriptError.exceptionFlag) {
|
|
||||||
kind = "exception";
|
kind = "exception";
|
||||||
} else {
|
else
|
||||||
kind = "error";
|
kind = "error";
|
||||||
}
|
|
||||||
|
|
||||||
if (flags & Ci.nsIScriptError.strictFlag) {
|
if (aFlags & Ci.nsIScriptError.strictFlag)
|
||||||
kind = "strict " + kind;
|
kind = "strict " + kind;
|
||||||
}
|
|
||||||
|
|
||||||
return kind;
|
return kind;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Register a console listener, so console messages don't just disappear
|
// Register a console listener, so console messages don't just disappear
|
||||||
// into the ether.
|
// into the ether.
|
||||||
|
var errorCount = 0;
|
||||||
var listener = {
|
var listener = {
|
||||||
observe: function (message) {
|
observe: function (aMessage) {
|
||||||
let string;
|
errorCount++;
|
||||||
try {
|
try {
|
||||||
message.QueryInterface(Ci.nsIScriptError);
|
// If we've been given an nsIScriptError, then we can print out
|
||||||
dump(message.sourceName + ":" + message.lineNumber + ": " +
|
// something nicely formatted, for tools like Emacs to pick up.
|
||||||
scriptErrorFlagsToKind(message.flags) + ": " +
|
var scriptError = aMessage.QueryInterface(Ci.nsIScriptError);
|
||||||
message.errorMessage + "\n");
|
dump(aMessage.sourceName + ":" + aMessage.lineNumber + ": " +
|
||||||
string = message.errorMessage;
|
scriptErrorFlagsToKind(aMessage.flags) + ": " +
|
||||||
} catch (ex) {
|
aMessage.errorMessage + "\n");
|
||||||
|
var string = aMessage.errorMessage;
|
||||||
|
} catch (x) {
|
||||||
// Be a little paranoid with message, as the whole goal here is to lose
|
// Be a little paranoid with message, as the whole goal here is to lose
|
||||||
// no information.
|
// no information.
|
||||||
try {
|
try {
|
||||||
string = "" + message.message;
|
var string = "" + aMessage.message;
|
||||||
} catch (e) {
|
} catch (x) {
|
||||||
string = "<error converting error message to string>";
|
var string = "<error converting error message to string>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -71,7 +77,7 @@ var listener = {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print in most cases, but ignore the "strict" messages
|
// Print in most cases, but ignore the "strict" messages
|
||||||
if (!(message.flags & Ci.nsIScriptError.strictFlag)) {
|
if (!(aMessage.flags & Ci.nsIScriptError.strictFlag)) {
|
||||||
do_print("head_dbg.js got console message: " + string + "\n");
|
do_print("head_dbg.js got console message: " + string + "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,8 +38,7 @@ add_task(function* () {
|
||||||
serverAuth.allowConnection = () => {
|
serverAuth.allowConnection = () => {
|
||||||
return DebuggerServer.AuthenticationResult.ALLOW;
|
return DebuggerServer.AuthenticationResult.ALLOW;
|
||||||
};
|
};
|
||||||
// Skip prompt for tests
|
serverAuth.receiveOOB = () => oobData.promise; // Skip prompt for tests
|
||||||
serverAuth.receiveOOB = () => oobData.promise;
|
|
||||||
|
|
||||||
let listener = DebuggerServer.createListener();
|
let listener = DebuggerServer.createListener();
|
||||||
ok(listener, "Socket listener created");
|
ok(listener, "Socket listener created");
|
||||||
|
|
@ -99,8 +98,7 @@ add_task(function* () {
|
||||||
serverAuth.allowConnection = () => {
|
serverAuth.allowConnection = () => {
|
||||||
return DebuggerServer.AuthenticationResult.ALLOW;
|
return DebuggerServer.AuthenticationResult.ALLOW;
|
||||||
};
|
};
|
||||||
// Skip prompt for tests
|
serverAuth.receiveOOB = () => oobData.promise; // Skip prompt for tests
|
||||||
serverAuth.receiveOOB = () => oobData.promise;
|
|
||||||
|
|
||||||
let listener = DebuggerServer.createListener();
|
let listener = DebuggerServer.createListener();
|
||||||
ok(listener, "Socket listener created");
|
ok(listener, "Socket listener created");
|
||||||
|
|
@ -163,8 +161,7 @@ add_task(function* () {
|
||||||
serverAuth.allowConnection = () => {
|
serverAuth.allowConnection = () => {
|
||||||
return DebuggerServer.AuthenticationResult.ALLOW;
|
return DebuggerServer.AuthenticationResult.ALLOW;
|
||||||
};
|
};
|
||||||
// Skip prompt for tests
|
serverAuth.receiveOOB = () => oobData.promise; // Skip prompt for tests
|
||||||
serverAuth.receiveOOB = () => oobData.promise;
|
|
||||||
|
|
||||||
let clientAuth = new AuthenticatorType.Client();
|
let clientAuth = new AuthenticatorType.Client();
|
||||||
clientAuth.sendOOB = ({ oob }) => {
|
clientAuth.sendOOB = ({ oob }) => {
|
||||||
|
|
@ -218,8 +215,7 @@ add_task(function* () {
|
||||||
serverAuth.allowConnection = () => {
|
serverAuth.allowConnection = () => {
|
||||||
return DebuggerServer.AuthenticationResult.ALLOW;
|
return DebuggerServer.AuthenticationResult.ALLOW;
|
||||||
};
|
};
|
||||||
// Skip prompt for tests
|
serverAuth.receiveOOB = () => oobData.promise; // Skip prompt for tests
|
||||||
serverAuth.receiveOOB = () => oobData.promise;
|
|
||||||
|
|
||||||
let clientAuth = new AuthenticatorType.Client();
|
let clientAuth = new AuthenticatorType.Client();
|
||||||
clientAuth.sendOOB = ({ oob }) => {
|
clientAuth.sendOOB = ({ oob }) => {
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,6 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
const { ActorPool, appendExtraActors, createExtraActors } =
|
const { ActorPool, appendExtraActors, createExtraActors } =
|
||||||
require("devtools/server/actors/common");
|
require("devtools/server/actors/common");
|
||||||
const { RootActor } = require("devtools/server/actors/root");
|
const { RootActor } = require("devtools/server/actors/root");
|
||||||
|
|
@ -11,8 +9,8 @@ const { DebuggerServer } = require("devtools/server/main");
|
||||||
const promise = require("promise");
|
const promise = require("promise");
|
||||||
|
|
||||||
var gTestGlobals = [];
|
var gTestGlobals = [];
|
||||||
DebuggerServer.addTestGlobal = function (global) {
|
DebuggerServer.addTestGlobal = function (aGlobal) {
|
||||||
gTestGlobals.push(global);
|
gTestGlobals.push(aGlobal);
|
||||||
};
|
};
|
||||||
|
|
||||||
// A mock tab list, for use by tests. This simply presents each global in
|
// A mock tab list, for use by tests. This simply presents each global in
|
||||||
|
|
@ -22,18 +20,18 @@ DebuggerServer.addTestGlobal = function (global) {
|
||||||
// As implemented now, we consult gTestGlobals when we're constructed, not
|
// As implemented now, we consult gTestGlobals when we're constructed, not
|
||||||
// when we're iterated over, so tests have to add their globals before the
|
// when we're iterated over, so tests have to add their globals before the
|
||||||
// root actor is created.
|
// root actor is created.
|
||||||
function TestTabList(connection) {
|
function TestTabList(aConnection) {
|
||||||
this.conn = connection;
|
this.conn = aConnection;
|
||||||
|
|
||||||
// An array of actors for each global added with
|
// An array of actors for each global added with
|
||||||
// DebuggerServer.addTestGlobal.
|
// DebuggerServer.addTestGlobal.
|
||||||
this._tabActors = [];
|
this._tabActors = [];
|
||||||
|
|
||||||
// A pool mapping those actors' names to the actors.
|
// A pool mapping those actors' names to the actors.
|
||||||
this._tabActorPool = new ActorPool(connection);
|
this._tabActorPool = new ActorPool(aConnection);
|
||||||
|
|
||||||
for (let global of gTestGlobals) {
|
for (let global of gTestGlobals) {
|
||||||
let actor = new TestTabActor(connection, global);
|
let actor = new TestTabActor(aConnection, global);
|
||||||
actor.selected = false;
|
actor.selected = false;
|
||||||
this._tabActors.push(actor);
|
this._tabActors.push(actor);
|
||||||
this._tabActorPool.addActor(actor);
|
this._tabActorPool.addActor(actor);
|
||||||
|
|
@ -42,7 +40,7 @@ function TestTabList(connection) {
|
||||||
this._tabActors[0].selected = true;
|
this._tabActors[0].selected = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
connection.addActorPool(this._tabActorPool);
|
aConnection.addActorPool(this._tabActorPool);
|
||||||
}
|
}
|
||||||
|
|
||||||
TestTabList.prototype = {
|
TestTabList.prototype = {
|
||||||
|
|
@ -52,18 +50,18 @@ TestTabList.prototype = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
function createRootActor(connection) {
|
function createRootActor(aConnection) {
|
||||||
let root = new RootActor(connection, {
|
let root = new RootActor(aConnection, {
|
||||||
tabList: new TestTabList(connection),
|
tabList: new TestTabList(aConnection),
|
||||||
globalActorFactories: DebuggerServer.globalActorFactories
|
globalActorFactories: DebuggerServer.globalActorFactories
|
||||||
});
|
});
|
||||||
root.applicationType = "xpcshell-tests";
|
root.applicationType = "xpcshell-tests";
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
|
||||||
function TestTabActor(connection, global) {
|
function TestTabActor(aConnection, aGlobal) {
|
||||||
this.conn = connection;
|
this.conn = aConnection;
|
||||||
this._global = global;
|
this._global = aGlobal;
|
||||||
this._threadActor = new ThreadActor(this, this._global);
|
this._threadActor = new ThreadActor(this, this._global);
|
||||||
this.conn.addActor(this._threadActor);
|
this.conn.addActor(this._threadActor);
|
||||||
this._attached = false;
|
this._attached = false;
|
||||||
|
|
@ -98,7 +96,7 @@ TestTabActor.prototype = {
|
||||||
return response;
|
return response;
|
||||||
},
|
},
|
||||||
|
|
||||||
onAttach: function (request) {
|
onAttach: function (aRequest) {
|
||||||
this._attached = true;
|
this._attached = true;
|
||||||
|
|
||||||
let response = { type: "tabAttached", threadActor: this._threadActor.actorID };
|
let response = { type: "tabAttached", threadActor: this._threadActor.actorID };
|
||||||
|
|
@ -107,9 +105,9 @@ TestTabActor.prototype = {
|
||||||
return response;
|
return response;
|
||||||
},
|
},
|
||||||
|
|
||||||
onDetach: function (request) {
|
onDetach: function (aRequest) {
|
||||||
if (!this._attached) {
|
if (!this._attached) {
|
||||||
return { "error": "wrongState" };
|
return { "error":"wrongState" };
|
||||||
}
|
}
|
||||||
return { type: "detached" };
|
return { type: "detached" };
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -9,13 +9,10 @@
|
||||||
* specific path.
|
* specific path.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
(function (factory) {
|
(function (factory) { // Module boilerplate
|
||||||
// Module boilerplate
|
if (this.module && module.id.indexOf("event-emitter") >= 0) { // require
|
||||||
if (this.module && module.id.indexOf("event-emitter") >= 0) {
|
|
||||||
// require
|
|
||||||
factory.call(this, require, exports, module);
|
factory.call(this, require, exports, module);
|
||||||
} else {
|
} else { // Cu.import
|
||||||
// Cu.import
|
|
||||||
const Cu = Components.utils;
|
const Cu = Components.utils;
|
||||||
const { require } =
|
const { require } =
|
||||||
Cu.import("resource://devtools/shared/Loader.jsm", {});
|
Cu.import("resource://devtools/shared/Loader.jsm", {});
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ add_task(function* () {
|
||||||
});
|
});
|
||||||
|
|
||||||
add_task(function* () {
|
add_task(function* () {
|
||||||
let object = {
|
var object = {
|
||||||
x: 1,
|
x: 1,
|
||||||
y: "foo",
|
y: "foo",
|
||||||
z: true
|
z: true
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,6 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
exports.exerciseLazyRequire = (name, path) => {
|
exports.exerciseLazyRequire = (name, path) => {
|
||||||
const o = {};
|
const o = {};
|
||||||
loader.lazyRequireGetter(o, name, path);
|
loader.lazyRequireGetter(o, name, path);
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,13 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
/* exported DevToolsUtils, DevToolsLoader */
|
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
var Cc = Components.classes;
|
||||||
|
var Ci = Components.interfaces;
|
||||||
|
var Cu = Components.utils;
|
||||||
|
var Cr = Components.results;
|
||||||
|
|
||||||
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
|
const {require, DevToolsLoader, devtools} = Cu.import("resource://devtools/shared/Loader.jsm", {});
|
||||||
const { require, DevToolsLoader } = Cu.import("resource://devtools/shared/Loader.jsm", {});
|
|
||||||
const DevToolsUtils = require("devtools/shared/DevToolsUtils");
|
const DevToolsUtils = require("devtools/shared/DevToolsUtils");
|
||||||
const flags = require("devtools/shared/flags");
|
const flags = require("devtools/shared/flags");
|
||||||
|
|
||||||
|
|
@ -22,22 +23,25 @@ do_register_cleanup(() => {
|
||||||
// failures, set this to true.
|
// failures, set this to true.
|
||||||
var ALLOW_CONSOLE_ERRORS = false;
|
var ALLOW_CONSOLE_ERRORS = false;
|
||||||
|
|
||||||
|
var errorCount = 0;
|
||||||
var listener = {
|
var listener = {
|
||||||
observe: function (message) {
|
observe: function (aMessage) {
|
||||||
let string;
|
errorCount++;
|
||||||
try {
|
try {
|
||||||
message.QueryInterface(Ci.nsIScriptError);
|
// If we've been given an nsIScriptError, then we can print out
|
||||||
dump(message.sourceName + ":" + message.lineNumber + ": " +
|
// something nicely formatted, for tools like Emacs to pick up.
|
||||||
scriptErrorFlagsToKind(message.flags) + ": " +
|
var scriptError = aMessage.QueryInterface(Ci.nsIScriptError);
|
||||||
message.errorMessage + "\n");
|
dump(aMessage.sourceName + ":" + aMessage.lineNumber + ": " +
|
||||||
string = message.errorMessage;
|
scriptErrorFlagsToKind(aMessage.flags) + ": " +
|
||||||
} catch (ex) {
|
aMessage.errorMessage + "\n");
|
||||||
|
var string = aMessage.errorMessage;
|
||||||
|
} catch (x) {
|
||||||
// Be a little paranoid with message, as the whole goal here is to lose
|
// Be a little paranoid with message, as the whole goal here is to lose
|
||||||
// no information.
|
// no information.
|
||||||
try {
|
try {
|
||||||
string = "" + message.message;
|
var string = "" + aMessage.message;
|
||||||
} catch (e) {
|
} catch (x) {
|
||||||
string = "<error converting error message to string>";
|
var string = "<error converting error message to string>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,6 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
// Test DevToolsUtils.assert
|
// Test DevToolsUtils.assert
|
||||||
|
|
||||||
ALLOW_CONSOLE_ERRORS = true;
|
ALLOW_CONSOLE_ERRORS = true;
|
||||||
|
|
@ -34,6 +32,5 @@ function run_test() {
|
||||||
}
|
}
|
||||||
|
|
||||||
ok(assertionFailed,
|
ok(assertionFailed,
|
||||||
"The assertion should have failed, which should throw an error when assertions " +
|
"The assertion should have failed, which should throw an error when assertions are enabled.");
|
||||||
"are enabled.");
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,6 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
// Test async-utils.js
|
// Test async-utils.js
|
||||||
|
|
||||||
const {Task} = require("devtools/shared/task");
|
const {Task} = require("devtools/shared/task");
|
||||||
|
|
@ -62,13 +60,12 @@ function test_async_return(async) {
|
||||||
function test_async_throw(async) {
|
function test_async_throw(async) {
|
||||||
let obj = {
|
let obj = {
|
||||||
method: async(function* () {
|
method: async(function* () {
|
||||||
throw new Error("boom");
|
throw "boom";
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
return obj.method().then(null, error => {
|
return obj.method().then(null, error => {
|
||||||
do_check_true(error instanceof Error);
|
do_check_eq(error, "boom");
|
||||||
do_check_eq(error.message, "boom");
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -119,6 +116,7 @@ function test_async_once() {
|
||||||
function test_async_invoke() {
|
function test_async_invoke() {
|
||||||
return Task.spawn(function* () {
|
return Task.spawn(function* () {
|
||||||
function func(a, b, expectedThis, callback) {
|
function func(a, b, expectedThis, callback) {
|
||||||
|
"use strict";
|
||||||
do_check_eq(a, "foo");
|
do_check_eq(a, "foo");
|
||||||
do_check_eq(b, "bar");
|
do_check_eq(b, "bar");
|
||||||
do_check_eq(this, expectedThis);
|
do_check_eq(this, expectedThis);
|
||||||
|
|
@ -129,11 +127,13 @@ function test_async_invoke() {
|
||||||
let callResult = yield promiseCall(func, "foo", "bar", undefined);
|
let callResult = yield promiseCall(func, "foo", "bar", undefined);
|
||||||
do_check_eq(callResult, "foobar");
|
do_check_eq(callResult, "foobar");
|
||||||
|
|
||||||
|
|
||||||
// Test invoke.
|
// Test invoke.
|
||||||
let obj = { method: func };
|
let obj = { method: func };
|
||||||
let invokeResult = yield promiseInvoke(obj, obj.method, "foo", "bar", obj);
|
let invokeResult = yield promiseInvoke(obj, obj.method, "foo", "bar", obj);
|
||||||
do_check_eq(invokeResult, "foobar");
|
do_check_eq(invokeResult, "foobar");
|
||||||
|
|
||||||
|
|
||||||
// Test passing multiple values to the callback.
|
// Test passing multiple values to the callback.
|
||||||
function multipleResults(callback) {
|
function multipleResults(callback) {
|
||||||
callback("foo", "bar");
|
callback("foo", "bar");
|
||||||
|
|
@ -144,14 +144,14 @@ function test_async_invoke() {
|
||||||
do_check_eq(results[0], "foo");
|
do_check_eq(results[0], "foo");
|
||||||
do_check_eq(results[1], "bar");
|
do_check_eq(results[1], "bar");
|
||||||
|
|
||||||
|
|
||||||
// Test throwing from the function.
|
// Test throwing from the function.
|
||||||
function thrower() {
|
function thrower() {
|
||||||
throw new Error("boom");
|
throw "boom";
|
||||||
}
|
}
|
||||||
|
|
||||||
yield promiseCall(thrower).then(null, error => {
|
yield promiseCall(thrower).then(null, error => {
|
||||||
do_check_true(error instanceof Error);
|
do_check_eq(error, "boom");
|
||||||
do_check_eq(error.message, "boom");
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,19 +11,19 @@ var seenMessages = 0;
|
||||||
var seenTypes = 0;
|
var seenTypes = 0;
|
||||||
|
|
||||||
var callback = {
|
var callback = {
|
||||||
onConsoleAPICall: function (message) {
|
onConsoleAPICall: function (aMessage) {
|
||||||
if (message.consoleID && message.consoleID == "addon/foo") {
|
if (aMessage.consoleID && aMessage.consoleID == "addon/foo") {
|
||||||
do_check_eq(message.level, "warn");
|
do_check_eq(aMessage.level, "warn");
|
||||||
do_check_eq(message.arguments[0], "Warning from foo");
|
do_check_eq(aMessage.arguments[0], "Warning from foo");
|
||||||
seenTypes |= 1;
|
seenTypes |= 1;
|
||||||
} else if (message.originAttributes &&
|
} else if (aMessage.originAttributes &&
|
||||||
message.originAttributes.addonId == "bar") {
|
aMessage.originAttributes.addonId == "bar") {
|
||||||
do_check_eq(message.level, "error");
|
do_check_eq(aMessage.level, "error");
|
||||||
do_check_eq(message.arguments[0], "Error from bar");
|
do_check_eq(aMessage.arguments[0], "Error from bar");
|
||||||
seenTypes |= 2;
|
seenTypes |= 2;
|
||||||
} else {
|
} else {
|
||||||
do_check_eq(message.level, "log");
|
do_check_eq(aMessage.level, "log");
|
||||||
do_check_eq(message.arguments[0], "Hello from default console");
|
do_check_eq(aMessage.arguments[0], "Hello from default console");
|
||||||
seenTypes |= 4;
|
seenTypes |= 4;
|
||||||
}
|
}
|
||||||
seenMessages++;
|
seenMessages++;
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
|
/* -*- js-indent-level: 2; indent-tabs-mode: nil -*- */
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
// Test DevToolsUtils.defineLazyPrototypeGetter
|
// Test DevToolsUtils.defineLazyPrototypeGetter
|
||||||
|
|
||||||
function Class() {}
|
function Class() {}
|
||||||
DevToolsUtils.defineLazyPrototypeGetter(Class.prototype, "foo", () => []);
|
DevToolsUtils.defineLazyPrototypeGetter(Class.prototype, "foo", () => []);
|
||||||
|
|
||||||
|
|
||||||
function run_test() {
|
function run_test() {
|
||||||
test_prototype_attributes();
|
test_prototype_attributes();
|
||||||
test_instance_attributes();
|
test_instance_attributes();
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var { executeSoon } = require("devtools/shared/DevToolsUtils");
|
var { executeSoon } = require("devtools/shared/DevToolsUtils");
|
||||||
|
var promise = require("promise");
|
||||||
var defer = require("devtools/shared/defer");
|
var defer = require("devtools/shared/defer");
|
||||||
var Services = require("Services");
|
var Services = require("Services");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,6 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
// Test ThreadSafeDevToolsUtils.flatten
|
// Test ThreadSafeDevToolsUtils.flatten
|
||||||
|
|
||||||
function run_test() {
|
function run_test() {
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,6 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ensure that each instance of the Dev Tools loader contains its own loader
|
* Ensure that each instance of the Dev Tools loader contains its own loader
|
||||||
* instance, and also returns unique objects. This ensures there is no sharing
|
* instance, and also returns unique objects. This ensures there is no sharing
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,6 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
// Test ThreadSafeDevToolsUtils.isSet
|
// Test ThreadSafeDevToolsUtils.isSet
|
||||||
|
|
||||||
function run_test() {
|
function run_test() {
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,6 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
// Test require
|
// Test require
|
||||||
|
|
||||||
// Ensure that DevtoolsLoader.require doesn't spawn multiple
|
// Ensure that DevtoolsLoader.require doesn't spawn multiple
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,6 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
// Test devtools.lazyRequireGetter
|
// Test devtools.lazyRequireGetter
|
||||||
|
|
||||||
function run_test() {
|
function run_test() {
|
||||||
|
|
@ -20,8 +18,7 @@ function run_test() {
|
||||||
const o2 = {};
|
const o2 = {};
|
||||||
let loader = new DevToolsLoader();
|
let loader = new DevToolsLoader();
|
||||||
|
|
||||||
// We have to init the loader by loading any module before
|
// We have to init the loader by loading any module before lazyRequireGetter is available
|
||||||
// lazyRequireGetter is available
|
|
||||||
loader.require("devtools/shared/DevToolsUtils");
|
loader.require("devtools/shared/DevToolsUtils");
|
||||||
|
|
||||||
loader.lazyRequireGetter(o2, name, path);
|
loader.lazyRequireGetter(o2, name, path);
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,6 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
// Test require using "raw!".
|
// Test require using "raw!".
|
||||||
|
|
||||||
function run_test() {
|
function run_test() {
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,6 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
// Test DevToolsUtils.safeErrorString
|
// Test DevToolsUtils.safeErrorString
|
||||||
|
|
||||||
function run_test() {
|
function run_test() {
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,6 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
// Test stack.js.
|
// Test stack.js.
|
||||||
|
|
||||||
function run_test() {
|
function run_test() {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
/* globals addMessageListener, sendAsyncMessage, docShell */
|
/* globals addMessageListener, sendAsyncMessage */
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const { utils: Cu } = Components;
|
const { utils: Cu } = Components;
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,6 @@
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
/* global XPCNativeWrapper */
|
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const { Ci, Cu } = require("chrome");
|
const { Ci, Cu } = require("chrome");
|
||||||
|
|
@ -275,14 +272,12 @@ SimulatorCore.prototype = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let unwrapped = XPCNativeWrapper.unwrap(target);
|
let unwrapped = XPCNativeWrapper.unwrap(target);
|
||||||
/* eslint-disable no-inline-comments */
|
|
||||||
unwrapped.sendTouchEvent(name, clone([0]), // event type, id
|
unwrapped.sendTouchEvent(name, clone([0]), // event type, id
|
||||||
clone([evt.clientX]), // x
|
clone([evt.clientX]), // x
|
||||||
clone([evt.clientY]), // y
|
clone([evt.clientY]), // y
|
||||||
clone([1]), clone([1]), // rx, ry
|
clone([1]), clone([1]), // rx, ry
|
||||||
clone([0]), clone([0]), // rotation, force
|
clone([0]), clone([0]), // rotation, force
|
||||||
1); // count
|
1); // count
|
||||||
/* eslint-enable no-inline-comments */
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let document = target.ownerDocument;
|
let document = target.ownerDocument;
|
||||||
|
|
@ -344,10 +339,10 @@ SimulatorCore.prototype = {
|
||||||
let utils = content.QueryInterface(Ci.nsIInterfaceRequestor)
|
let utils = content.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||||
.getInterface(Ci.nsIDOMWindowUtils);
|
.getInterface(Ci.nsIDOMWindowUtils);
|
||||||
|
|
||||||
let allowZoom = {};
|
let allowZoom = {},
|
||||||
let minZoom = {};
|
minZoom = {},
|
||||||
let maxZoom = {};
|
maxZoom = {},
|
||||||
let autoSize = {};
|
autoSize = {};
|
||||||
|
|
||||||
utils.getViewportInfo(content.innerWidth, content.innerHeight, {},
|
utils.getViewportInfo(content.innerWidth, content.innerHeight, {},
|
||||||
allowZoom, minZoom, maxZoom, {}, {}, autoSize);
|
allowZoom, minZoom, maxZoom, {}, {}, autoSize);
|
||||||
|
|
@ -357,15 +352,14 @@ SimulatorCore.prototype = {
|
||||||
// delay. But Firefox didn't support this property now, we can't get
|
// delay. But Firefox didn't support this property now, we can't get
|
||||||
// this value from utils.getVisitedDependentComputedStyle() to check
|
// this value from utils.getVisitedDependentComputedStyle() to check
|
||||||
// if we should suppress 300ms delay.
|
// if we should suppress 300ms delay.
|
||||||
/* eslint-disable no-inline-comments */
|
|
||||||
if (!allowZoom.value || // user-scalable = no
|
if (!allowZoom.value || // user-scalable = no
|
||||||
minZoom.value === maxZoom.value || // minimum-scale = maximum-scale
|
minZoom.value === maxZoom.value || // minimum-scale = maximum-scale
|
||||||
autoSize.value // width = device-width
|
autoSize.value // width = device-width
|
||||||
) {
|
) {
|
||||||
/* eslint-enable no-inline-comments */
|
|
||||||
return 0;
|
return 0;
|
||||||
|
} else {
|
||||||
|
return 300;
|
||||||
}
|
}
|
||||||
return 300;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue