forked from mirrors/gecko-dev
Bug 1325191 - Fix Eslint errors in devtools/server/*.js. r=jryans
MozReview-Commit-ID: 6t7lUP2Ip3v
This commit is contained in:
parent
252e684884
commit
f8ea7f6a39
16 changed files with 192 additions and 210 deletions
|
|
@ -83,11 +83,9 @@ devtools/client/debugger/**
|
||||||
devtools/client/framework/**
|
devtools/client/framework/**
|
||||||
!devtools/client/framework/selection.js
|
!devtools/client/framework/selection.js
|
||||||
!devtools/client/framework/toolbox.js
|
!devtools/client/framework/toolbox.js
|
||||||
devtools/client/jsonview/lib/**
|
|
||||||
devtools/client/netmonitor/test/**
|
devtools/client/netmonitor/test/**
|
||||||
devtools/client/netmonitor/har/test/**
|
devtools/client/netmonitor/har/test/**
|
||||||
devtools/client/projecteditor/**
|
devtools/client/projecteditor/**
|
||||||
devtools/client/promisedebugger/**
|
|
||||||
devtools/client/responsivedesign/**
|
devtools/client/responsivedesign/**
|
||||||
devtools/client/scratchpad/**
|
devtools/client/scratchpad/**
|
||||||
devtools/client/shadereditor/**
|
devtools/client/shadereditor/**
|
||||||
|
|
@ -104,17 +102,9 @@ devtools/client/webconsole/webconsole-connection-proxy.js
|
||||||
devtools/client/webconsole/webconsole.js
|
devtools/client/webconsole/webconsole.js
|
||||||
devtools/client/webide/**
|
devtools/client/webide/**
|
||||||
!devtools/client/webide/components/webideCli.js
|
!devtools/client/webide/components/webideCli.js
|
||||||
devtools/server/*.js
|
devtools/server/actors/*.js
|
||||||
devtools/server/*.jsm
|
|
||||||
!devtools/server/child.js
|
|
||||||
!devtools/server/css-logic.js
|
|
||||||
!devtools/server/main.js
|
|
||||||
!devtools/server/websocket-server.js
|
|
||||||
devtools/server/actors/**
|
|
||||||
!devtools/server/actors/csscoverage.js
|
!devtools/server/actors/csscoverage.js
|
||||||
!devtools/server/actors/inspector.js
|
!devtools/server/actors/inspector.js
|
||||||
!devtools/server/actors/highlighters/css-grid.js
|
|
||||||
!devtools/server/actors/highlighters/eye-dropper.js
|
|
||||||
!devtools/server/actors/layout.js
|
!devtools/server/actors/layout.js
|
||||||
!devtools/server/actors/string.js
|
!devtools/server/actors/string.js
|
||||||
!devtools/server/actors/styles.js
|
!devtools/server/actors/styles.js
|
||||||
|
|
@ -134,7 +124,6 @@ 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/locales/**
|
|
||||||
devtools/shared/performance/**
|
devtools/shared/performance/**
|
||||||
!devtools/shared/platform/**
|
!devtools/shared/platform/**
|
||||||
devtools/shared/qrcode/**
|
devtools/shared/qrcode/**
|
||||||
|
|
|
||||||
|
|
@ -150,12 +150,10 @@ RulersHighlighter.prototype = {
|
||||||
} else {
|
} else {
|
||||||
dGraduations += `M${i} 0 L${i} ${graduationLength} `;
|
dGraduations += `M${i} 0 L${i} ${graduationLength} `;
|
||||||
}
|
}
|
||||||
|
} else if (i % 50 === 0) {
|
||||||
|
dMarkers += `M0 ${i} L${graduationLength} ${i}`;
|
||||||
} else {
|
} else {
|
||||||
if (i % 50 === 0) {
|
dGraduations += `M0 ${i} L${graduationLength} ${i}`;
|
||||||
dMarkers += `M0 ${i} L${graduationLength} ${i}`;
|
|
||||||
} else {
|
|
||||||
dGraduations += `M0 ${i} L${graduationLength} ${i}`;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -245,7 +245,7 @@ function CanvasFrameAnonymousContentHelper(highlighterEnv, nodeBuilder) {
|
||||||
this._insert();
|
this._insert();
|
||||||
}
|
}
|
||||||
|
|
||||||
this._onWindowReady= this._onWindowReady.bind(this);
|
this._onWindowReady = this._onWindowReady.bind(this);
|
||||||
this.highlighterEnv.on("window-ready", this._onWindowReady);
|
this.highlighterEnv.on("window-ready", this._onWindowReady);
|
||||||
|
|
||||||
this.listeners = new Map();
|
this.listeners = new Map();
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const { Ci, Cu } = require("chrome");
|
|
||||||
const DevToolsUtils = require("devtools/shared/DevToolsUtils");
|
const DevToolsUtils = require("devtools/shared/DevToolsUtils");
|
||||||
const { assert, fetch } = DevToolsUtils;
|
const { assert, fetch } = DevToolsUtils;
|
||||||
const EventEmitter = require("devtools/shared/event-emitter");
|
const EventEmitter = require("devtools/shared/event-emitter");
|
||||||
|
|
@ -137,18 +136,16 @@ TabSources.prototype = {
|
||||||
// is the HTML url.
|
// is the HTML url.
|
||||||
originalUrl = source.url;
|
originalUrl = source.url;
|
||||||
source = null;
|
source = null;
|
||||||
}
|
} else if (this._sourceActors.has(source)) {
|
||||||
else if (this._sourceActors.has(source)) {
|
|
||||||
return this._sourceActors.get(source);
|
return this._sourceActors.get(source);
|
||||||
}
|
}
|
||||||
}
|
} else if (originalUrl) {
|
||||||
else if (originalUrl) {
|
|
||||||
// Not all "original" scripts are distinctly separate from the
|
// Not all "original" scripts are distinctly separate from the
|
||||||
// generated script. Pretty-printed sources have a sourcemap for
|
// generated script. Pretty-printed sources have a sourcemap for
|
||||||
// themselves, so we need to make sure there a real source
|
// themselves, so we need to make sure there a real source
|
||||||
// doesn't already exist with this URL.
|
// doesn't already exist with this URL.
|
||||||
for (let [source, actor] of this._sourceActors) {
|
for (let [sourceData, actor] of this._sourceActors) {
|
||||||
if (source.url === originalUrl) {
|
if (sourceData.url === originalUrl) {
|
||||||
return actor;
|
return actor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -168,7 +165,7 @@ TabSources.prototype = {
|
||||||
});
|
});
|
||||||
|
|
||||||
let sourceActorStore = this._thread.sourceActorStore;
|
let sourceActorStore = this._thread.sourceActorStore;
|
||||||
var id = sourceActorStore.getReusableActorId(source, originalUrl);
|
let id = sourceActorStore.getReusableActorId(source, originalUrl);
|
||||||
if (id) {
|
if (id) {
|
||||||
actor.actorID = id;
|
actor.actorID = id;
|
||||||
}
|
}
|
||||||
|
|
@ -179,15 +176,13 @@ TabSources.prototype = {
|
||||||
if (this._autoBlackBox &&
|
if (this._autoBlackBox &&
|
||||||
!this.neverAutoBlackBoxSources.has(actor.url) &&
|
!this.neverAutoBlackBoxSources.has(actor.url) &&
|
||||||
this._isMinifiedURL(actor.url)) {
|
this._isMinifiedURL(actor.url)) {
|
||||||
|
|
||||||
this.blackBox(actor.url);
|
this.blackBox(actor.url);
|
||||||
this.neverAutoBlackBoxSources.add(actor.url);
|
this.neverAutoBlackBoxSources.add(actor.url);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (source) {
|
if (source) {
|
||||||
this._sourceActors.set(source, actor);
|
this._sourceActors.set(source, actor);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
this._sourceMappedSourceActors[originalUrl] = actor;
|
this._sourceMappedSourceActors[originalUrl] = actor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -201,8 +196,7 @@ TabSources.prototype = {
|
||||||
// it's something that has been sourcemapped, or it represents
|
// it's something that has been sourcemapped, or it represents
|
||||||
// the HTML file that contains inline sources.
|
// the HTML file that contains inline sources.
|
||||||
this.emit("newSource", actor);
|
this.emit("newSource", actor);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// If sourcemapping is enabled and a source has sourcemaps, we
|
// If sourcemapping is enabled and a source has sourcemaps, we
|
||||||
// create `SourceActor` instances for both the original and
|
// create `SourceActor` instances for both the original and
|
||||||
// generated sources. The source actors for the generated
|
// generated sources. The source actors for the generated
|
||||||
|
|
@ -246,30 +240,29 @@ TabSources.prototype = {
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new Error("getSourceActorByURL: could not find source for " + url);
|
throw new Error("getSourceActorByURL: could not find source for " + url);
|
||||||
return null;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the URL likely points to a minified resource, false
|
* Returns true if the URL likely points to a minified resource, false
|
||||||
* otherwise.
|
* otherwise.
|
||||||
*
|
*
|
||||||
* @param String aURL
|
* @param String uri
|
||||||
* The URL to test.
|
* The url to test.
|
||||||
* @returns Boolean
|
* @returns Boolean
|
||||||
*/
|
*/
|
||||||
_isMinifiedURL: function (aURL) {
|
_isMinifiedURL: function (uri) {
|
||||||
if (!aURL) {
|
if (!uri) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let url = new URL(aURL);
|
let url = new URL(uri);
|
||||||
let pathname = url.pathname;
|
let pathname = url.pathname;
|
||||||
return MINIFIED_SOURCE_REGEXP.test(pathname.slice(pathname.lastIndexOf("/") + 1));
|
return MINIFIED_SOURCE_REGEXP.test(pathname.slice(pathname.lastIndexOf("/") + 1));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// Not a valid URL so don't try to parse out the filename, just test the
|
// Not a valid URL so don't try to parse out the filename, just test the
|
||||||
// whole thing with the minified source regexp.
|
// whole thing with the minified source regexp.
|
||||||
return MINIFIED_SOURCE_REGEXP.test(aURL);
|
return MINIFIED_SOURCE_REGEXP.test(uri);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -278,19 +271,19 @@ TabSources.prototype = {
|
||||||
* source mapping and always returns an actor representing this real
|
* source mapping and always returns an actor representing this real
|
||||||
* source. Use `createSourceActors` if you want to respect source maps.
|
* source. Use `createSourceActors` if you want to respect source maps.
|
||||||
*
|
*
|
||||||
* @param Debugger.Source aSource
|
* @param Debugger.Source source
|
||||||
* The source instance to create an actor for.
|
* The source instance to create an actor for.
|
||||||
* @returns SourceActor
|
* @returns SourceActor
|
||||||
*/
|
*/
|
||||||
createNonSourceMappedActor: function (aSource) {
|
createNonSourceMappedActor: function (source) {
|
||||||
// Don't use getSourceURL because we don't want to consider the
|
// Don't use getSourceURL because we don't want to consider the
|
||||||
// displayURL property if it's an eval source. We only want to
|
// displayURL property if it's an eval source. We only want to
|
||||||
// consider real URLs, otherwise if there is a URL but it's
|
// consider real URLs, otherwise if there is a URL but it's
|
||||||
// invalid the code below will not set the content type, and we
|
// invalid the code below will not set the content type, and we
|
||||||
// will later try to fetch the contents of the URL to figure out
|
// will later try to fetch the contents of the URL to figure out
|
||||||
// the content type, but it's a made up URL for eval sources.
|
// the content type, but it's a made up URL for eval sources.
|
||||||
let url = isEvalSource(aSource) ? null : aSource.url;
|
let url = isEvalSource(source) ? null : source.url;
|
||||||
let spec = { source: aSource };
|
let spec = { source };
|
||||||
|
|
||||||
// XXX bug 915433: We can't rely on Debugger.Source.prototype.text
|
// XXX bug 915433: We can't rely on Debugger.Source.prototype.text
|
||||||
// if the source is an HTML-embedded <script> tag. Since we don't
|
// if the source is an HTML-embedded <script> tag. Since we don't
|
||||||
|
|
@ -301,51 +294,47 @@ TabSources.prototype = {
|
||||||
|
|
||||||
// Assume the source is inline if the element that introduced it is not a
|
// Assume the source is inline if the element that introduced it is not a
|
||||||
// script element, or does not have a src attribute.
|
// script element, or does not have a src attribute.
|
||||||
let element = aSource.element ? aSource.element.unsafeDereference() : null;
|
let element = source.element ? source.element.unsafeDereference() : null;
|
||||||
if (element && (element.tagName !== "SCRIPT" || !element.hasAttribute("src"))) {
|
if (element && (element.tagName !== "SCRIPT" || !element.hasAttribute("src"))) {
|
||||||
spec.isInlineSource = true;
|
spec.isInlineSource = true;
|
||||||
} else if (aSource.introductionType === "wasm") {
|
} else if (source.introductionType === "wasm") {
|
||||||
// Wasm sources are not JavaScript. Give them their own content-type.
|
// Wasm sources are not JavaScript. Give them their own content-type.
|
||||||
spec.contentType = "text/wasm";
|
spec.contentType = "text/wasm";
|
||||||
} else {
|
} else if (url) {
|
||||||
if (url) {
|
// There are a few special URLs that we know are JavaScript:
|
||||||
// There are a few special URLs that we know are JavaScript:
|
// inline `javascript:` and code coming from the console
|
||||||
// inline `javascript:` and code coming from the console
|
if (url.indexOf("Scratchpad/") === 0 ||
|
||||||
if (url.indexOf("Scratchpad/") === 0 ||
|
url.indexOf("javascript:") === 0 ||
|
||||||
url.indexOf("javascript:") === 0 ||
|
url === "debugger eval code") {
|
||||||
url === "debugger eval code") {
|
spec.contentType = "text/javascript";
|
||||||
spec.contentType = "text/javascript";
|
} else {
|
||||||
} else {
|
try {
|
||||||
try {
|
let pathname = new URL(url).pathname;
|
||||||
let pathname = new URL(url).pathname;
|
let filename = pathname.slice(pathname.lastIndexOf("/") + 1);
|
||||||
let filename = pathname.slice(pathname.lastIndexOf("/") + 1);
|
let index = filename.lastIndexOf(".");
|
||||||
let index = filename.lastIndexOf(".");
|
let extension = index >= 0 ? filename.slice(index + 1) : "";
|
||||||
let extension = index >= 0 ? filename.slice(index + 1) : "";
|
if (extension === "xml") {
|
||||||
if (extension === "xml") {
|
// XUL inline scripts may not correctly have the
|
||||||
// XUL inline scripts may not correctly have the
|
// `source.element` property, so do a blunt check here if
|
||||||
// `source.element` property, so do a blunt check here if
|
// it's an xml page.
|
||||||
// it's an xml page.
|
spec.isInlineSource = true;
|
||||||
spec.isInlineSource = true;
|
} else if (extension === "js") {
|
||||||
}
|
spec.contentType = "text/javascript";
|
||||||
else if (extension === "js") {
|
}
|
||||||
spec.contentType = "text/javascript";
|
} catch (e) {
|
||||||
}
|
// This only needs to be here because URL is not yet exposed to
|
||||||
} catch (e) {
|
// workers. (BUG 1258892)
|
||||||
// This only needs to be here because URL is not yet exposed to
|
const filename = url;
|
||||||
// workers. (BUG 1258892)
|
const index = filename.lastIndexOf(".");
|
||||||
const filename = url;
|
const extension = index >= 0 ? filename.slice(index + 1) : "";
|
||||||
const index = filename.lastIndexOf(".");
|
if (extension === "js") {
|
||||||
const extension = index >= 0 ? filename.slice(index + 1) : "";
|
spec.contentType = "text/javascript";
|
||||||
if (extension === "js") {
|
|
||||||
spec.contentType = "text/javascript";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
} else {
|
||||||
// Assume the content is javascript if there's no URL
|
// Assume the content is javascript if there's no URL
|
||||||
spec.contentType = "text/javascript";
|
spec.contentType = "text/javascript";
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.source(spec);
|
return this.source(spec);
|
||||||
|
|
@ -354,24 +343,24 @@ TabSources.prototype = {
|
||||||
/**
|
/**
|
||||||
* This is an internal function that returns a promise of an array
|
* This is an internal function that returns a promise of an array
|
||||||
* of source actors representing all the source mapped sources of
|
* of source actors representing all the source mapped sources of
|
||||||
* `aSource`, or `null` if the source is not sourcemapped or
|
* `source`, or `null` if the source is not sourcemapped or
|
||||||
* sourcemapping is disabled. Users should call `createSourceActors`
|
* sourcemapping is disabled. Users should call `createSourceActors`
|
||||||
* instead of this.
|
* instead of this.
|
||||||
*
|
*
|
||||||
* @param Debugger.Source aSource
|
* @param Debugger.Source source
|
||||||
* The source instance to create actors for.
|
* The source instance to create actors for.
|
||||||
* @return Promise of an array of source actors
|
* @return Promise of an array of source actors
|
||||||
*/
|
*/
|
||||||
_createSourceMappedActors: function (aSource) {
|
_createSourceMappedActors: function (source) {
|
||||||
if (!this._useSourceMaps || !aSource.sourceMapURL) {
|
if (!this._useSourceMaps || !source.sourceMapURL) {
|
||||||
return resolve(null);
|
return resolve(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.fetchSourceMap(aSource)
|
return this.fetchSourceMap(source)
|
||||||
.then(map => {
|
.then(map => {
|
||||||
if (map) {
|
if (map) {
|
||||||
return map.sources.map(s => {
|
return map.sources.map(s => {
|
||||||
return this.source({ originalUrl: s, generatedSource: aSource });
|
return this.source({ originalUrl: s, generatedSource: source });
|
||||||
}).filter(isNotNull);
|
}).filter(isNotNull);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
@ -380,97 +369,94 @@ TabSources.prototype = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the source actors representing the appropriate sources
|
* Creates the source actors representing the appropriate sources
|
||||||
* of `aSource`. If sourcemapped, returns actors for all of the original
|
* of `source`. If sourcemapped, returns actors for all of the original
|
||||||
* sources, otherwise returns a 1-element array with the actor for
|
* sources, otherwise returns a 1-element array with the actor for
|
||||||
* `aSource`.
|
* `source`.
|
||||||
*
|
*
|
||||||
* @param Debugger.Source aSource
|
* @param Debugger.Source source
|
||||||
* The source instance to create actors for.
|
* The source instance to create actors for.
|
||||||
* @param Promise of an array of source actors
|
* @param Promise of an array of source actors
|
||||||
*/
|
*/
|
||||||
createSourceActors: function (aSource) {
|
createSourceActors: function (source) {
|
||||||
return this._createSourceMappedActors(aSource).then(actors => {
|
return this._createSourceMappedActors(source).then(actors => {
|
||||||
let actor = this.createNonSourceMappedActor(aSource);
|
let actor = this.createNonSourceMappedActor(source);
|
||||||
return (actors || [actor]).filter(isNotNull);
|
return (actors || [actor]).filter(isNotNull);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a promise of a SourceMapConsumer for the source map for
|
* Return a promise of a SourceMapConsumer for the source map for
|
||||||
* `aSource`; if we already have such a promise extant, return that.
|
* `source`; if we already have such a promise extant, return that.
|
||||||
* This will fetch the source map if we don't have a cached object
|
* This will fetch the source map if we don't have a cached object
|
||||||
* and source maps are enabled (see `_fetchSourceMap`).
|
* and source maps are enabled (see `_fetchSourceMap`).
|
||||||
*
|
*
|
||||||
* @param Debugger.Source aSource
|
* @param Debugger.Source source
|
||||||
* The source instance to get sourcemaps for.
|
* The source instance to get sourcemaps for.
|
||||||
* @return Promise of a SourceMapConsumer
|
* @return Promise of a SourceMapConsumer
|
||||||
*/
|
*/
|
||||||
fetchSourceMap: function (aSource) {
|
fetchSourceMap: function (source) {
|
||||||
if (!this._useSourceMaps) {
|
if (!this._useSourceMaps) {
|
||||||
return resolve(null);
|
return resolve(null);
|
||||||
}
|
} else if (this._sourceMaps.has(source)) {
|
||||||
else if (this._sourceMaps.has(aSource)) {
|
return this._sourceMaps.get(source);
|
||||||
return this._sourceMaps.get(aSource);
|
} else if (!source || !source.sourceMapURL) {
|
||||||
}
|
|
||||||
else if (!aSource || !aSource.sourceMapURL) {
|
|
||||||
return resolve(null);
|
return resolve(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
let sourceMapURL = aSource.sourceMapURL;
|
let sourceMapURL = source.sourceMapURL;
|
||||||
if (aSource.url) {
|
if (source.url) {
|
||||||
sourceMapURL = joinURI(aSource.url, sourceMapURL);
|
sourceMapURL = joinURI(source.url, sourceMapURL);
|
||||||
}
|
}
|
||||||
let result = this._fetchSourceMap(sourceMapURL, aSource.url);
|
let result = this._fetchSourceMap(sourceMapURL, source.url);
|
||||||
|
|
||||||
// The promises in `_sourceMaps` must be the exact same instances
|
// The promises in `_sourceMaps` must be the exact same instances
|
||||||
// as returned by `_fetchSourceMap` for `clearSourceMapCache` to
|
// as returned by `_fetchSourceMap` for `clearSourceMapCache` to
|
||||||
// work.
|
// work.
|
||||||
this._sourceMaps.set(aSource, result);
|
this._sourceMaps.set(source, result);
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a promise of a SourceMapConsumer for the source map for
|
* Return a promise of a SourceMapConsumer for the source map for
|
||||||
* `aSource`. The resolved result may be null if the source does not
|
* `source`. The resolved result may be null if the source does not
|
||||||
* have a source map or source maps are disabled.
|
* have a source map or source maps are disabled.
|
||||||
*/
|
*/
|
||||||
getSourceMap: function (aSource) {
|
getSourceMap: function (source) {
|
||||||
return resolve(this._sourceMaps.get(aSource));
|
return resolve(this._sourceMaps.get(source));
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a SourceMapConsumer for the source map for
|
* Set a SourceMapConsumer for the source map for |source|.
|
||||||
* |aSource|.
|
|
||||||
*/
|
*/
|
||||||
setSourceMap: function (aSource, aMap) {
|
setSourceMap: function (source, map) {
|
||||||
this._sourceMaps.set(aSource, resolve(aMap));
|
this._sourceMaps.set(source, resolve(map));
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a promise of a SourceMapConsumer for the source map located at
|
* Return a promise of a SourceMapConsumer for the source map located at
|
||||||
* |aAbsSourceMapURL|, which must be absolute. If there is already such a
|
* |absSourceMapURL|, which must be absolute. If there is already such a
|
||||||
* promise extant, return it. This will not fetch if source maps are
|
* promise extant, return it. This will not fetch if source maps are
|
||||||
* disabled.
|
* disabled.
|
||||||
*
|
*
|
||||||
* @param string aAbsSourceMapURL
|
* @param string absSourceMapURL
|
||||||
* The source map URL, in absolute form, not relative.
|
* The source map URL, in absolute form, not relative.
|
||||||
* @param string aScriptURL
|
* @param string sourceURL
|
||||||
* When the source map URL is a data URI, there is no sourceRoot on the
|
* When the source map URL is a data URI, there is no sourceRoot on the
|
||||||
* source map, and the source map's sources are relative, we resolve
|
* source map, and the source map's sources are relative, we resolve
|
||||||
* them from aScriptURL.
|
* them from sourceURL.
|
||||||
*/
|
*/
|
||||||
_fetchSourceMap: function (aAbsSourceMapURL, aSourceURL) {
|
_fetchSourceMap: function (absSourceMapURL, sourceURL) {
|
||||||
assert(this._useSourceMaps,
|
assert(this._useSourceMaps,
|
||||||
"Cannot fetch sourcemaps if they are disabled");
|
"Cannot fetch sourcemaps if they are disabled");
|
||||||
|
|
||||||
if (this._sourceMapCache[aAbsSourceMapURL]) {
|
if (this._sourceMapCache[absSourceMapURL]) {
|
||||||
return this._sourceMapCache[aAbsSourceMapURL];
|
return this._sourceMapCache[absSourceMapURL];
|
||||||
}
|
}
|
||||||
|
|
||||||
let fetching = fetch(aAbsSourceMapURL, { loadFromCache: false })
|
let fetching = fetch(absSourceMapURL, { loadFromCache: false })
|
||||||
.then(({ content }) => {
|
.then(({ content }) => {
|
||||||
let map = new SourceMapConsumer(content);
|
let map = new SourceMapConsumer(content);
|
||||||
this._setSourceMapRoot(map, aAbsSourceMapURL, aSourceURL);
|
this._setSourceMapRoot(map, absSourceMapURL, sourceURL);
|
||||||
return map;
|
return map;
|
||||||
})
|
})
|
||||||
.then(null, error => {
|
.then(null, error => {
|
||||||
|
|
@ -479,31 +465,31 @@ TabSources.prototype = {
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
this._sourceMapCache[aAbsSourceMapURL] = fetching;
|
this._sourceMapCache[absSourceMapURL] = fetching;
|
||||||
return fetching;
|
return fetching;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the source map's sourceRoot to be relative to the source map url.
|
* Sets the source map's sourceRoot to be relative to the source map url.
|
||||||
*/
|
*/
|
||||||
_setSourceMapRoot: function (aSourceMap, aAbsSourceMapURL, aScriptURL) {
|
_setSourceMapRoot: function (sourceMap, absSourceMapURL, scriptURL) {
|
||||||
// No need to do this fiddling if we won't be fetching any sources over the
|
// No need to do this fiddling if we won't be fetching any sources over the
|
||||||
// wire.
|
// wire.
|
||||||
if (aSourceMap.hasContentsOfAllSources()) {
|
if (sourceMap.hasContentsOfAllSources()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const base = this._dirname(
|
const base = this._dirname(
|
||||||
aAbsSourceMapURL.indexOf("data:") === 0
|
absSourceMapURL.indexOf("data:") === 0
|
||||||
? aScriptURL
|
? scriptURL
|
||||||
: aAbsSourceMapURL);
|
: absSourceMapURL);
|
||||||
aSourceMap.sourceRoot = aSourceMap.sourceRoot
|
sourceMap.sourceRoot = sourceMap.sourceRoot
|
||||||
? joinURI(base, aSourceMap.sourceRoot)
|
? joinURI(base, sourceMap.sourceRoot)
|
||||||
: base;
|
: base;
|
||||||
},
|
},
|
||||||
|
|
||||||
_dirname: function (aPath) {
|
_dirname: function (path) {
|
||||||
let url = new URL(aPath);
|
let url = new URL(path);
|
||||||
let href = url.href;
|
let href = url.href;
|
||||||
return href.slice(0, href.lastIndexOf("/"));
|
return href.slice(0, href.lastIndexOf("/"));
|
||||||
},
|
},
|
||||||
|
|
@ -516,18 +502,18 @@ TabSources.prototype = {
|
||||||
* this just removes the Debugger.Source cache, but you can remove
|
* this just removes the Debugger.Source cache, but you can remove
|
||||||
* the lower-level URL cache with the `hard` option.
|
* the lower-level URL cache with the `hard` option.
|
||||||
*
|
*
|
||||||
* @param aSourceMapURL string
|
* @param sourceMapURL string
|
||||||
* The source map URL to uncache
|
* The source map URL to uncache
|
||||||
* @param opts object
|
* @param opts object
|
||||||
* An object with the following properties:
|
* An object with the following properties:
|
||||||
* - hard: Also remove the lower-level URL cache, which will
|
* - hard: Also remove the lower-level URL cache, which will
|
||||||
* make us completely forget about the source map.
|
* make us completely forget about the source map.
|
||||||
*/
|
*/
|
||||||
clearSourceMapCache: function (aSourceMapURL, opts = { hard: false }) {
|
clearSourceMapCache: function (sourceMapURL, opts = { hard: false }) {
|
||||||
let oldSm = this._sourceMapCache[aSourceMapURL];
|
let oldSm = this._sourceMapCache[sourceMapURL];
|
||||||
|
|
||||||
if (opts.hard) {
|
if (opts.hard) {
|
||||||
delete this._sourceMapCache[aSourceMapURL];
|
delete this._sourceMapCache[sourceMapURL];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oldSm) {
|
if (oldSm) {
|
||||||
|
|
@ -547,15 +533,14 @@ TabSources.prototype = {
|
||||||
* (pretty-printing is the use case). Generate a random url if one
|
* (pretty-printing is the use case). Generate a random url if one
|
||||||
* isn't specified, allowing you to set "anonymous" source maps.
|
* isn't specified, allowing you to set "anonymous" source maps.
|
||||||
*
|
*
|
||||||
* @param aSource Debugger.Source
|
* @param source Debugger.Source
|
||||||
* The source to change the sourceMapURL property
|
* The source to change the sourceMapURL property
|
||||||
* @param aUrl string
|
* @param url string
|
||||||
* The source map URL (optional)
|
* The source map URL (optional)
|
||||||
* @param aMap SourceMapConsumer
|
* @param map SourceMapConsumer
|
||||||
* The source map instance
|
* The source map instance
|
||||||
*/
|
*/
|
||||||
setSourceMapHard: function (aSource, aUrl, aMap) {
|
setSourceMapHard: function (source, url, map) {
|
||||||
let url = aUrl;
|
|
||||||
if (!url) {
|
if (!url) {
|
||||||
// This is a littly hacky, but we want to forcefully set a
|
// This is a littly hacky, but we want to forcefully set a
|
||||||
// sourcemap regardless of sourcemap settings. We want to
|
// sourcemap regardless of sourcemap settings. We want to
|
||||||
|
|
@ -566,31 +551,31 @@ TabSources.prototype = {
|
||||||
// just make a fake URL and stick the sourcemap there.
|
// just make a fake URL and stick the sourcemap there.
|
||||||
url = "internal://sourcemap" + (this._anonSourceMapId++) + "/";
|
url = "internal://sourcemap" + (this._anonSourceMapId++) + "/";
|
||||||
}
|
}
|
||||||
aSource.sourceMapURL = url;
|
source.sourceMapURL = url;
|
||||||
|
|
||||||
// Forcefully set the sourcemap cache. This will be used even if
|
// Forcefully set the sourcemap cache. This will be used even if
|
||||||
// sourcemaps are disabled.
|
// sourcemaps are disabled.
|
||||||
this._sourceMapCache[url] = resolve(aMap);
|
this._sourceMapCache[url] = resolve(map);
|
||||||
this.emit("updatedSource", this.getSourceActor(aSource));
|
this.emit("updatedSource", this.getSourceActor(source));
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the non-source-mapped location of the given Debugger.Frame. If the
|
* Return the non-source-mapped location of the given Debugger.Frame. If the
|
||||||
* frame does not have a script, the location's properties are all null.
|
* frame does not have a script, the location's properties are all null.
|
||||||
*
|
*
|
||||||
* @param Debugger.Frame aFrame
|
* @param Debugger.Frame frame
|
||||||
* The frame whose location we are getting.
|
* The frame whose location we are getting.
|
||||||
* @returns Object
|
* @returns Object
|
||||||
* Returns an object of the form { source, line, column }
|
* Returns an object of the form { source, line, column }
|
||||||
*/
|
*/
|
||||||
getFrameLocation: function (aFrame) {
|
getFrameLocation: function (frame) {
|
||||||
if (!aFrame || !aFrame.script) {
|
if (!frame || !frame.script) {
|
||||||
return new GeneratedLocation();
|
return new GeneratedLocation();
|
||||||
}
|
}
|
||||||
let {lineNumber, columnNumber} =
|
let {lineNumber, columnNumber} =
|
||||||
aFrame.script.getOffsetLocation(aFrame.offset);
|
frame.script.getOffsetLocation(frame.offset);
|
||||||
return new GeneratedLocation(
|
return new GeneratedLocation(
|
||||||
this.createNonSourceMappedActor(aFrame.script.source),
|
this.createNonSourceMappedActor(frame.script.source),
|
||||||
lineNumber,
|
lineNumber,
|
||||||
columnNumber
|
columnNumber
|
||||||
);
|
);
|
||||||
|
|
@ -610,7 +595,6 @@ TabSources.prototype = {
|
||||||
generatedColumn
|
generatedColumn
|
||||||
} = generatedLocation;
|
} = generatedLocation;
|
||||||
let source = generatedSourceActor.source;
|
let source = generatedSourceActor.source;
|
||||||
let url = source ? source.url : generatedSourceActor._originalUrl;
|
|
||||||
|
|
||||||
// In certain scenarios the source map may have not been fetched
|
// In certain scenarios the source map may have not been fetched
|
||||||
// yet (or at least tied to this Debugger.Source instance), so use
|
// yet (or at least tied to this Debugger.Source instance), so use
|
||||||
|
|
@ -684,7 +668,6 @@ TabSources.prototype = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a promise of the location in the generated source corresponding to
|
* Returns a promise of the location in the generated source corresponding to
|
||||||
* the original source and line given.
|
* the original source and line given.
|
||||||
|
|
@ -735,69 +718,69 @@ TabSources.prototype = {
|
||||||
/**
|
/**
|
||||||
* Returns true if URL for the given source is black boxed.
|
* Returns true if URL for the given source is black boxed.
|
||||||
*
|
*
|
||||||
* @param aURL String
|
* @param url String
|
||||||
* The URL of the source which we are checking whether it is black
|
* The URL of the source which we are checking whether it is black
|
||||||
* boxed or not.
|
* boxed or not.
|
||||||
*/
|
*/
|
||||||
isBlackBoxed: function (aURL) {
|
isBlackBoxed: function (url) {
|
||||||
return this.blackBoxedSources.has(aURL);
|
return this.blackBoxedSources.has(url);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the given source URL to the set of sources that are black boxed.
|
* Add the given source URL to the set of sources that are black boxed.
|
||||||
*
|
*
|
||||||
* @param aURL String
|
* @param url String
|
||||||
* The URL of the source which we are black boxing.
|
* The URL of the source which we are black boxing.
|
||||||
*/
|
*/
|
||||||
blackBox: function (aURL) {
|
blackBox: function (url) {
|
||||||
this.blackBoxedSources.add(aURL);
|
this.blackBoxedSources.add(url);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the given source URL to the set of sources that are black boxed.
|
* Remove the given source URL to the set of sources that are black boxed.
|
||||||
*
|
*
|
||||||
* @param aURL String
|
* @param url String
|
||||||
* The URL of the source which we are no longer black boxing.
|
* The URL of the source which we are no longer black boxing.
|
||||||
*/
|
*/
|
||||||
unblackBox: function (aURL) {
|
unblackBox: function (url) {
|
||||||
this.blackBoxedSources.delete(aURL);
|
this.blackBoxedSources.delete(url);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the given URL is pretty printed.
|
* Returns true if the given URL is pretty printed.
|
||||||
*
|
*
|
||||||
* @param aURL String
|
* @param url String
|
||||||
* The URL of the source that might be pretty printed.
|
* The URL of the source that might be pretty printed.
|
||||||
*/
|
*/
|
||||||
isPrettyPrinted: function (aURL) {
|
isPrettyPrinted: function (url) {
|
||||||
return this.prettyPrintedSources.has(aURL);
|
return this.prettyPrintedSources.has(url);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the given URL to the set of sources that are pretty printed.
|
* Add the given URL to the set of sources that are pretty printed.
|
||||||
*
|
*
|
||||||
* @param aURL String
|
* @param url String
|
||||||
* The URL of the source to be pretty printed.
|
* The URL of the source to be pretty printed.
|
||||||
*/
|
*/
|
||||||
prettyPrint: function (aURL, aIndent) {
|
prettyPrint: function (url, indent) {
|
||||||
this.prettyPrintedSources.set(aURL, aIndent);
|
this.prettyPrintedSources.set(url, indent);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the indent the given URL was pretty printed by.
|
* Return the indent the given URL was pretty printed by.
|
||||||
*/
|
*/
|
||||||
prettyPrintIndent: function (aURL) {
|
prettyPrintIndent: function (url) {
|
||||||
return this.prettyPrintedSources.get(aURL);
|
return this.prettyPrintedSources.get(url);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the given URL from the set of sources that are pretty printed.
|
* Remove the given URL from the set of sources that are pretty printed.
|
||||||
*
|
*
|
||||||
* @param aURL String
|
* @param url String
|
||||||
* The URL of the source that is no longer pretty printed.
|
* The URL of the source that is no longer pretty printed.
|
||||||
*/
|
*/
|
||||||
disablePrettyPrint: function (aURL) {
|
disablePrettyPrint: function (url) {
|
||||||
this.prettyPrintedSources.delete(aURL);
|
this.prettyPrintedSources.delete(url);
|
||||||
},
|
},
|
||||||
|
|
||||||
iter: function () {
|
iter: function () {
|
||||||
|
|
@ -817,16 +800,16 @@ TabSources.prototype = {
|
||||||
* Checks if a source should never be displayed to the user because
|
* Checks if a source should never be displayed to the user because
|
||||||
* it's either internal or we don't support in the UI yet.
|
* it's either internal or we don't support in the UI yet.
|
||||||
*/
|
*/
|
||||||
function isHiddenSource(aSource) {
|
function isHiddenSource(source) {
|
||||||
// Ignore the internal Function.prototype script
|
// Ignore the internal Function.prototype script
|
||||||
return aSource.text === "() {\n}";
|
return source.text === "() {\n}";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if its argument is not null.
|
* Returns true if its argument is not null.
|
||||||
*/
|
*/
|
||||||
function isNotNull(aThing) {
|
function isNotNull(thing) {
|
||||||
return aThing !== null;
|
return thing !== null;
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.TabSources = TabSources;
|
exports.TabSources = TabSources;
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,9 @@
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var { Cu, CC, Ci, Cc } = require("chrome");
|
const { Cu, CC } = require("chrome");
|
||||||
|
|
||||||
const { DebuggerServer } = require("devtools/server/main");
|
const { DebuggerServer } = require("devtools/server/main");
|
||||||
const promise = require("promise");
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Support for actor registration. Main used by ActorRegistryActor
|
* Support for actor registration. Main used by ActorRegistryActor
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,10 @@ const GRAPHENE_ID = "{d1bfe7d9-c01e-4237-998b-7b5f960a4314}";
|
||||||
*/
|
*/
|
||||||
if (!Services.appinfo
|
if (!Services.appinfo
|
||||||
|| Services.appinfo.processType == Services.appinfo.PROCESS_TYPE_CONTENT
|
|| Services.appinfo.processType == Services.appinfo.PROCESS_TYPE_CONTENT
|
||||||
|| Services.appinfo.ID === undefined /* XPCShell */
|
|
||||||
|
/* XPCShell */
|
||||||
|
|| Services.appinfo.ID === undefined
|
||||||
|
|
||||||
|| Services.appinfo.ID == B2G_ID
|
|| Services.appinfo.ID == B2G_ID
|
||||||
|| Services.appinfo.ID == GRAPHENE_ID
|
|| Services.appinfo.ID == GRAPHENE_ID
|
||||||
|| !AddonPathService) {
|
|| !AddonPathService) {
|
||||||
|
|
@ -35,8 +38,7 @@ if (!Services.appinfo
|
||||||
module.exports = function mapURIToAddonId(uri) {
|
module.exports = function mapURIToAddonId(uri) {
|
||||||
try {
|
try {
|
||||||
return AddonPathService.mapURIToAddonId(uri);
|
return AddonPathService.mapURIToAddonId(uri);
|
||||||
}
|
} catch (e) {
|
||||||
catch (e) {
|
|
||||||
DevToolsUtils.reportException("mapURIToAddonId", e);
|
DevToolsUtils.reportException("mapURIToAddonId", e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,6 @@
|
||||||
* matched.
|
* matched.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const {Ci, Cu} = require("chrome");
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The WalkerIndex class indexes the document (and all subdocs) from
|
* The WalkerIndex class indexes the document (and all subdocs) from
|
||||||
* a given walker.
|
* a given walker.
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,10 @@
|
||||||
|
/* 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
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
const {Cc, Ci, Cu, components} = require("chrome");
|
"use strict";
|
||||||
|
|
||||||
|
const {Cc, Ci, components} = require("chrome");
|
||||||
const {isWindowIncluded} = require("devtools/shared/layout/utils");
|
const {isWindowIncluded} = require("devtools/shared/layout/utils");
|
||||||
const Services = require("Services");
|
const Services = require("Services");
|
||||||
const {XPCOMUtils} = require("resource://gre/modules/XPCOMUtils.jsm");
|
const {XPCOMUtils} = require("resource://gre/modules/XPCOMUtils.jsm");
|
||||||
|
|
@ -31,8 +36,7 @@ function ConsoleServiceListener(window, listener) {
|
||||||
}
|
}
|
||||||
exports.ConsoleServiceListener = ConsoleServiceListener;
|
exports.ConsoleServiceListener = ConsoleServiceListener;
|
||||||
|
|
||||||
ConsoleServiceListener.prototype =
|
ConsoleServiceListener.prototype = {
|
||||||
{
|
|
||||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIConsoleListener]),
|
QueryInterface: XPCOMUtils.generateQI([Ci.nsIConsoleListener]),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -196,8 +200,7 @@ function ConsoleAPIListener(window, owner, {addonId} = {}) {
|
||||||
}
|
}
|
||||||
exports.ConsoleAPIListener = ConsoleAPIListener;
|
exports.ConsoleAPIListener = ConsoleAPIListener;
|
||||||
|
|
||||||
ConsoleAPIListener.prototype =
|
ConsoleAPIListener.prototype = {
|
||||||
{
|
|
||||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]),
|
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -384,8 +387,7 @@ function ConsoleReflowListener(window, listener) {
|
||||||
|
|
||||||
exports.ConsoleReflowListener = ConsoleReflowListener;
|
exports.ConsoleReflowListener = ConsoleReflowListener;
|
||||||
|
|
||||||
ConsoleReflowListener.prototype =
|
ConsoleReflowListener.prototype = {
|
||||||
{
|
|
||||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIReflowObserver,
|
QueryInterface: XPCOMUtils.generateQI([Ci.nsIReflowObserver,
|
||||||
Ci.nsISupportsWeakReference]),
|
Ci.nsISupportsWeakReference]),
|
||||||
docshell: null,
|
docshell: null,
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const {Cc, Ci, Cu, components} = require("chrome");
|
const {Ci, Cu} = require("chrome");
|
||||||
|
|
||||||
// Note that this is only used in WebConsoleCommands, see $0 and pprint().
|
// Note that this is only used in WebConsoleCommands, see $0 and pprint().
|
||||||
if (!isWorker) {
|
if (!isWorker) {
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,8 @@
|
||||||
* 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 setConsoleEventHandler, retrieveConsoleEvents */
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
// This file is loaded on the server side for worker debugging.
|
// This file is loaded on the server side for worker debugging.
|
||||||
|
|
@ -18,18 +20,17 @@ function ConsoleAPIListener(window, owner, consoleID) {
|
||||||
this.observe = this.observe.bind(this);
|
this.observe = this.observe.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
ConsoleAPIListener.prototype =
|
ConsoleAPIListener.prototype = {
|
||||||
{
|
|
||||||
init: function () {
|
init: function () {
|
||||||
setConsoleEventHandler(this.observe);
|
setConsoleEventHandler(this.observe);
|
||||||
},
|
},
|
||||||
destroy: function () {
|
destroy: function () {
|
||||||
setConsoleEventHandler(null);
|
setConsoleEventHandler(null);
|
||||||
},
|
},
|
||||||
observe: function(message) {
|
observe: function (message) {
|
||||||
this.owner.onConsoleAPICall(message.wrappedJSObject);
|
this.owner.onConsoleAPICall(message.wrappedJSObject);
|
||||||
},
|
},
|
||||||
getCachedMessages: function() {
|
getCachedMessages: function () {
|
||||||
return retrieveConsoleEvents();
|
return retrieveConsoleEvents();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,9 @@ exports.removeContentGlobal = function (options) {
|
||||||
return undefined;
|
return undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
function getGlobalCache(aInnerWindowID) {
|
function getGlobalCache(innerWindowID) {
|
||||||
return globalsCache[aInnerWindowID] = globalsCache[aInnerWindowID] || [];
|
globalsCache[innerWindowID] = globalsCache[innerWindowID] || [];
|
||||||
|
return globalsCache[innerWindowID];
|
||||||
}
|
}
|
||||||
|
|
||||||
// when the window is destroyed, eliminate the associated globals cache
|
// when the window is destroyed, eliminate the associated globals cache
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,9 @@
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const Ci = Components.interfaces;
|
const { utils: Cu, interfaces: Ci } = Components;
|
||||||
const Cc = Components.classes;
|
|
||||||
const Cu = Components.utils;
|
|
||||||
|
|
||||||
|
/* exported init */
|
||||||
this.EXPORTED_SYMBOLS = ["init"];
|
this.EXPORTED_SYMBOLS = ["init"];
|
||||||
|
|
||||||
let gLoader;
|
let gLoader;
|
||||||
|
|
|
||||||
|
|
@ -149,8 +149,9 @@ var parsers = [
|
||||||
const MAX_NESTED_HANDLER_COUNT = 2;
|
const MAX_NESTED_HANDLER_COUNT = 2;
|
||||||
for (let i = 0; i < MAX_NESTED_HANDLER_COUNT; i++) {
|
for (let i = 0; i < MAX_NESTED_HANDLER_COUNT; i++) {
|
||||||
let funcDO = getFirstFunctionVariable(handlerDO);
|
let funcDO = getFirstFunctionVariable(handlerDO);
|
||||||
if (!funcDO)
|
if (!funcDO) {
|
||||||
return handlerDO;
|
return handlerDO;
|
||||||
|
}
|
||||||
|
|
||||||
handlerDO = funcDO;
|
handlerDO = funcDO;
|
||||||
if (isFunctionInProxy(handlerDO)) {
|
if (isFunctionInProxy(handlerDO)) {
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const { on, once, off, emit } = require("sdk/event/core");
|
|
||||||
const { Class } = require("sdk/core/heritage");
|
const { Class } = require("sdk/core/heritage");
|
||||||
|
|
||||||
const WebGLPrimitivesType = {
|
const WebGLPrimitivesType = {
|
||||||
|
|
@ -23,7 +22,7 @@ const WebGLPrimitivesType = {
|
||||||
const WebGLDrawArrays = "drawArrays";
|
const WebGLDrawArrays = "drawArrays";
|
||||||
const WebGLDrawElements = "drawElements";
|
const WebGLDrawElements = "drawElements";
|
||||||
|
|
||||||
var WebGLPrimitiveCounter = exports.WebGLPrimitiveCounter = Class({
|
exports.WebGLPrimitiveCounter = Class({
|
||||||
initialize: function (tabActor) {
|
initialize: function (tabActor) {
|
||||||
this.tabActor = tabActor;
|
this.tabActor = tabActor;
|
||||||
},
|
},
|
||||||
|
|
@ -45,7 +44,7 @@ var WebGLPrimitiveCounter = exports.WebGLPrimitiveCounter = Class({
|
||||||
* Stops monitoring primitive draws, returning the recorded values.
|
* Stops monitoring primitive draws, returning the recorded values.
|
||||||
*/
|
*/
|
||||||
getCounts: function () {
|
getCounts: function () {
|
||||||
var result = {
|
let result = {
|
||||||
tris: this._tris,
|
tris: this._tris,
|
||||||
vertices: this._vertices,
|
vertices: this._vertices,
|
||||||
points: this._points,
|
points: this._points,
|
||||||
|
|
@ -155,6 +154,7 @@ var WebGLPrimitiveCounter = exports.WebGLPrimitiveCounter = Class({
|
||||||
case WebGLPrimitivesType.TRIANGLE_FAN:
|
case WebGLPrimitivesType.TRIANGLE_FAN:
|
||||||
this._tris += (count - 2);
|
this._tris += (count - 2);
|
||||||
this._vertices += count;
|
this._vertices += count;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
console.error("_processDrawElements doesn't define this type.");
|
console.error("_processDrawElements doesn't define this type.");
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,13 @@
|
||||||
* 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 addMessageListener */
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
let { classes: Cc, interfaces: Ci, utils: Cu } = Components;
|
let { classes: Cc, interfaces: Ci } = Components;
|
||||||
let swm = Cc["@mozilla.org/serviceworkers/manager;1"].
|
let swm = Cc["@mozilla.org/serviceworkers/manager;1"]
|
||||||
getService(Ci.nsIServiceWorkerManager);
|
.getService(Ci.nsIServiceWorkerManager);
|
||||||
|
|
||||||
addMessageListener("serviceWorkerRegistration:start", message => {
|
addMessageListener("serviceWorkerRegistration:start", message => {
|
||||||
let { data } = message;
|
let { data } = message;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,12 @@
|
||||||
|
/* 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
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
/* eslint-env worker */
|
||||||
|
/* global worker, loadSubScript, global */
|
||||||
|
|
||||||
// This function is used to do remote procedure calls from the worker to the
|
// This function is used to do remote procedure calls from the worker to the
|
||||||
// main thread. It is exposed as a built-in global to every module by the
|
// main thread. It is exposed as a built-in global to every module by the
|
||||||
// worker loader. To make sure the worker loader can access it, it needs to be
|
// worker loader. To make sure the worker loader can access it, it needs to be
|
||||||
|
|
@ -42,14 +49,14 @@ this.addEventListener("message", function (event) {
|
||||||
let packet = JSON.parse(event.data);
|
let packet = JSON.parse(event.data);
|
||||||
switch (packet.type) {
|
switch (packet.type) {
|
||||||
case "connect":
|
case "connect":
|
||||||
// Step 3: Create a connection to the parent.
|
// Step 3: Create a connection to the parent.
|
||||||
let connection = DebuggerServer.connectToParent(packet.id, this);
|
let connection = DebuggerServer.connectToParent(packet.id, this);
|
||||||
connections[packet.id] = {
|
connections[packet.id] = {
|
||||||
connection : connection,
|
connection,
|
||||||
rpcs: []
|
rpcs: []
|
||||||
};
|
};
|
||||||
|
|
||||||
// Step 4: Create a thread actor for the connection to the parent.
|
// Step 4: Create a thread actor for the connection to the parent.
|
||||||
let pool = new ActorPool(connection);
|
let pool = new ActorPool(connection);
|
||||||
connection.addActorPool(pool);
|
connection.addActorPool(pool);
|
||||||
|
|
||||||
|
|
@ -87,8 +94,8 @@ this.addEventListener("message", function (event) {
|
||||||
let consoleActor = new WebConsoleActor(connection, parent);
|
let consoleActor = new WebConsoleActor(connection, parent);
|
||||||
pool.addActor(consoleActor);
|
pool.addActor(consoleActor);
|
||||||
|
|
||||||
// Step 5: Send a response packet to the parent to notify
|
// Step 5: Send a response packet to the parent to notify
|
||||||
// it that a connection has been established.
|
// it that a connection has been established.
|
||||||
postMessage(JSON.stringify({
|
postMessage(JSON.stringify({
|
||||||
type: "connected",
|
type: "connected",
|
||||||
id: packet.id,
|
id: packet.id,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue