Skip to content

Commit

Permalink
squash 'resources/unpacked/devtools' changes from f1199f6..60101cd
Browse files Browse the repository at this point in the history
60101cd [DevTools] Report unhandled exceptions and promise rejections through Runtime.
18ba3ae [DevTools] Better ExceptionDetails in js_protocol.json
7696352 DevTools: add Courier New to support monospace arabic on Windows
a76e5ee [DevTools] Rename ScriptPosition.line|column into lineNumber|columnNumber
edb6f79 DevTools: make arrays expandable by default in console
f185c43 DevTools: add livescript ".ls" extension to the list of script extensions
6e6939f DevTools: copy protocol files to front-end to fix hosted mode
5a33a56 DevTools: do not detach sourcemap in case of style sheet editing
f00e62a DevTools: Convert mimeTypeByExtension and mimeTypeByName to Map
e972e1a [DevTools] Move suspended generator location to internal properties
d5f0d56 Display when PKP is bypassed in devtools

git-subtree-dir: resources/unpacked/devtools
git-subtree-split: 60101cd
  • Loading branch information
darwin committed Jul 11, 2016
1 parent 1e2b76b commit 5129396
Show file tree
Hide file tree
Showing 28 changed files with 5,741 additions and 308 deletions.
39 changes: 25 additions & 14 deletions front_end/Runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,30 @@ Runtime._queryParamsObject = { __proto__: null };
*/
Runtime.cachedResources = { __proto__: null };

/**
* @param {string} url
* @param {boolean} appendSourceURL
* @return {!Promise<undefined>}
*/
Runtime.loadResourceIntoCache = function(url, appendSourceURL)
{
return loadResourcePromise(url).then(cacheResource.bind(this, url), cacheResource.bind(this, url, undefined));

/**
* @param {string} path
* @param {string=} content
*/
function cacheResource(path, content)
{
if (!content) {
console.error("Failed to load resource: " + path);
return;
}
var sourceURL = appendSourceURL ? Runtime.resolveSourceURL(path) : "";
Runtime.cachedResources[path] = content + sourceURL;
}
}

/**
* @return {boolean}
*/
Expand Down Expand Up @@ -773,22 +797,9 @@ Runtime.Module.prototype = {
var promises = [];
for (var i = 0; i < resources.length; ++i) {
var url = this._modularizeURL(resources[i]);
promises.push(loadResourcePromise(url).then(cacheResource.bind(this, url), cacheResource.bind(this, url, undefined)));
promises.push(Runtime.loadResourceIntoCache(url, true));
}
return Promise.all(promises).then(undefined);

/**
* @param {string} path
* @param {string=} content
*/
function cacheResource(path, content)
{
if (!content) {
console.error("Failed to load resource: " + path);
return;
}
Runtime.cachedResources[path] = content + Runtime.resolveSourceURL(path);
}
},

/**
Expand Down
14 changes: 7 additions & 7 deletions front_end/bindings/BlackboxManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ WebInspector.BlackboxManager.prototype = {
*/
function comparator(a, b)
{
if (a.lineNumber !== b.line)
return a.lineNumber - b.line;
return a.columnNumber - b.column;
if (a.lineNumber !== b.lineNumber)
return a.lineNumber - b.lineNumber;
return a.columnNumber - b.columnNumber;
}
},

Expand Down Expand Up @@ -162,12 +162,12 @@ WebInspector.BlackboxManager.prototype = {
var positions = [];
// If content in script file begin is not mapped and one or more ranges are blackboxed then blackbox it.
if (mappings[0].lineNumber !== 0 || mappings[0].columnNumber !== 0) {
positions.push({ line: 0, column: 0});
positions.push({ lineNumber: 0, columnNumber: 0});
currentBlackboxed = true;
}
for (var mapping of mappings) {
if (mapping.sourceURL && currentBlackboxed !== this.isBlackboxedURL(mapping.sourceURL)) {
positions.push({ line: mapping.lineNumber, column: mapping.columnNumber });
positions.push({ lineNumber: mapping.lineNumber, columnNumber: mapping.columnNumber });
currentBlackboxed = !currentBlackboxed;
}
isBlackboxed = currentBlackboxed || isBlackboxed;
Expand Down Expand Up @@ -346,7 +346,7 @@ WebInspector.BlackboxManager.prototype = {
_addScript: function(script)
{
var blackboxed = this._isBlackboxedScript(script);
return this._setScriptState(script, blackboxed ? [ { line: 0, column: 0 } ] : []);
return this._setScriptState(script, blackboxed ? [ { lineNumber: 0, columnNumber: 0 } ] : []);
},

/**
Expand Down Expand Up @@ -393,7 +393,7 @@ WebInspector.BlackboxManager.prototype = {
var hasChanged = false;
hasChanged = previousScriptState.length !== positions.length;
for (var i = 0; !hasChanged && i < positions.length; ++i)
hasChanged = positions[i].line !== previousScriptState[i].line || positions[i].column !== previousScriptState[i].column;
hasChanged = positions[i].lineNumber !== previousScriptState[i].lineNumber || positions[i].columnNumber !== previousScriptState[i].columnNumber;
if (!hasChanged)
return Promise.resolve();
} else {
Expand Down
2 changes: 1 addition & 1 deletion front_end/bindings/FileSystemWorkspaceBinding.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ WebInspector.FileSystemWorkspaceBinding = function(isolatedFileSystemManager, wo

WebInspector.FileSystemWorkspaceBinding._styleSheetExtensions = new Set(["css", "scss", "sass", "less"]);
WebInspector.FileSystemWorkspaceBinding._documentExtensions = new Set(["htm", "html", "asp", "aspx", "phtml", "jsp"]);
WebInspector.FileSystemWorkspaceBinding._scriptExtensions = new Set(["asp", "aspx", "c", "cc", "cljs", "coffee", "cpp", "cs", "dart", "java", "js", "jsp", "jsx", "h", "m", "mm", "py", "sh", "ts", "tsx"]);
WebInspector.FileSystemWorkspaceBinding._scriptExtensions = new Set(["asp", "aspx", "c", "cc", "cljs", "coffee", "cpp", "cs", "dart", "java", "js", "jsp", "jsx", "h", "m", "mm", "py", "sh", "ts", "tsx", "ls"]);

WebInspector.FileSystemWorkspaceBinding._imageExtensions = WebInspector.IsolatedFileSystem.ImageExtensions;

Expand Down
124 changes: 62 additions & 62 deletions front_end/common/ResourceType.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,114 +195,114 @@ WebInspector.resourceTypes = {

/**
* @param {string} url
* @return {string}
* @return {string|undefined}
*/
WebInspector.ResourceType.mimeFromURL = function(url)
{
var name = WebInspector.ParsedURL.extractName(url);
if (WebInspector.ResourceType.mimeTypeByName[name]) {
return WebInspector.ResourceType.mimeTypeByName[name];
if (WebInspector.ResourceType._mimeTypeByName.has(name)) {
return WebInspector.ResourceType._mimeTypeByName.get(name);
}
var ext = WebInspector.ParsedURL.extractExtension(url).toLowerCase();
return WebInspector.ResourceType.mimeTypeByExtension[ext];
return WebInspector.ResourceType._mimeTypeByExtension.get(ext);
}

WebInspector.ResourceType.mimeTypeByName = {
WebInspector.ResourceType._mimeTypeByName = new Map([
// CoffeeScript
"Cakefile": "text/x-coffeescript"
}
["Cakefile", "text/x-coffeescript"]
]);

WebInspector.ResourceType.mimeTypeByExtension = {
WebInspector.ResourceType._mimeTypeByExtension = new Map([
// Web extensions
"js": "text/javascript",
"css": "text/css",
"html": "text/html",
"htm": "text/html",
"xml": "application/xml",
"xsl": "application/xml",

// HTML Embedded Scripts: ASP, JSP
"asp": "application/x-aspx",
"aspx": "application/x-aspx",
"jsp": "application/x-jsp",
["js", "text/javascript"],
["css", "text/css"],
["html", "text/html"],
["htm", "text/html"],
["xml", "application/xml"],
["xsl", "application/xml"],

// HTML Embedded Scripts, ASP], JSP
["asp", "application/x-aspx"],
["aspx", "application/x-aspx"],
["jsp", "application/x-jsp"],

// C/C++
"c": "text/x-c++src",
"cc": "text/x-c++src",
"cpp": "text/x-c++src",
"h": "text/x-c++src",
"m": "text/x-c++src",
"mm": "text/x-c++src",
["c", "text/x-c++src"],
["cc", "text/x-c++src"],
["cpp", "text/x-c++src"],
["h", "text/x-c++src"],
["m", "text/x-c++src"],
["mm", "text/x-c++src"],

// CoffeeScript
"coffee": "text/x-coffeescript",
["coffee", "text/x-coffeescript"],

// Dart
"dart": "text/javascript",
["dart", "text/javascript"],

// TypeScript
"ts": "text/typescript",
"tsx": "text/typescript",
["ts", "text/typescript"],
["tsx", "text/typescript"],

// JSON
"json": "application/json",
"gyp": "application/json",
"gypi": "application/json",
["json", "application/json"],
["gyp", "application/json"],
["gypi", "application/json"],

// C#
"cs": "text/x-csharp",
["cs", "text/x-csharp"],

// Java
"java": "text/x-java",
["java", "text/x-java"],

// Less
"less": "text/x-less",
["less", "text/x-less"],

// PHP
"php": "text/x-php",
"phtml": "application/x-httpd-php",
["php", "text/x-php"],
["phtml", "application/x-httpd-php"],

// Python
"py": "text/x-python",
["py", "text/x-python"],

// Shell
"sh": "text/x-sh",
["sh", "text/x-sh"],

// SCSS
"scss": "text/x-scss",
["scss", "text/x-scss"],

// Video Text Tracks.
"vtt": "text/vtt",
["vtt", "text/vtt"],

// LiveScript
"ls": "text/x-livescript",
["ls", "text/x-livescript"],

// ClojureScript
"cljs": "text/x-clojure",
"cljc": "text/x-clojure",
"cljx": "text/x-clojure",
["cljs", "text/x-clojure"],
["cljc", "text/x-clojure"],
["cljx", "text/x-clojure"],

// Stylus
"styl": "text/x-styl",
["styl", "text/x-styl"],

// JSX
"jsx": "text/jsx",
["jsx", "text/jsx"],

// Image
"jpeg": "image/jpeg",
"jpg": "image/jpeg",
"svg": "image/svg",
"gif": "image/gif",
"webp": "image/webp",
"png": "image/png",
"ico": "image/ico",
"tiff": "image/tiff",
"tif": "image/tif",
"bmp": "image/bmp",
["jpeg", "image/jpeg"],
["jpg", "image/jpeg"],
["svg", "image/svg"],
["gif", "image/gif"],
["webp", "image/webp"],
["png", "image/png"],
["ico", "image/ico"],
["tiff", "image/tiff"],
["tif", "image/tif"],
["bmp", "image/bmp"],

// Font
"ttf": "font/opentype",
"otf": "font/opentype",
"ttc": "font/opentype",
"woff": "application/font-woff"
}
["ttf", "font/opentype"],
["otf", "font/opentype"],
["ttc", "font/opentype"],
["woff", "application/font-woff"]
]);
23 changes: 1 addition & 22 deletions front_end/components/ObjectPopoverHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,23 +111,6 @@ WebInspector.ObjectPopoverHelper.prototype = {
popover.showForAnchor(container, anchorElement);
}

/**
* @param {?WebInspector.DebuggerModel.GeneratorObjectDetails} response
* @this {WebInspector.ObjectPopoverHelper}
*/
function didGetGeneratorObjectDetails(response)
{
if (!response || popover.disposed)
return;

var rawLocation = response.location;
var sourceURL = response.sourceURL;
if (rawLocation && sourceURL) {
var link = this._lazyLinkifier().linkifyRawLocation(rawLocation, sourceURL, "function-location-link");
this._titleElement.appendChild(link);
}
}

/**
* @param {!WebInspector.RemoteObject} result
* @param {boolean} wasThrown
Expand Down Expand Up @@ -176,20 +159,16 @@ WebInspector.ObjectPopoverHelper.prototype = {
popoverContentElement = createElement("div");
this._titleElement = popoverContentElement.createChild("div", "monospace");
this._titleElement.createChild("span", "source-frame-popover-title").textContent = description;
var section = new WebInspector.ObjectPropertiesSection(result, "");
var section = new WebInspector.ObjectPropertiesSection(result, "", this._lazyLinkifier());
section.element.classList.add("source-frame-popover-tree");
section.titleLessMode();
popoverContentElement.appendChild(section.element);

if (result.subtype === "generator")
result.generatorObjectDetails(didGetGeneratorObjectDetails.bind(this));
}
var popoverWidth = 300;
var popoverHeight = 250;
popover.showForAnchor(popoverContentElement, anchorElement, popoverWidth, popoverHeight);
}
}

this._queryObject(element, didQueryObject.bind(this), this._popoverObjectGroup);
},

Expand Down
Loading

0 comments on commit 5129396

Please sign in to comment.