Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(643)

Unified Diff: third_party/WebKit/Source/devtools/front_end/sdk/Script.js

Issue 2695123004: DevTools: Only provide static script content to UISourceCode (Closed)
Patch Set: another try Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/sdk/CSSStyleSheetHeader.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/devtools/front_end/sdk/Script.js
diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/Script.js b/third_party/WebKit/Source/devtools/front_end/sdk/Script.js
index c02c26fc0ec8a7e1fc63988c45fd1d6c84b7cfc5..10413cfa00d6716524ee482e4b7a5bf9df210df8 100644
--- a/third_party/WebKit/Source/devtools/front_end/sdk/Script.js
+++ b/third_party/WebKit/Source/devtools/front_end/sdk/Script.js
@@ -71,6 +71,8 @@ SDK.Script = class {
this._isLiveEdit = isLiveEdit;
this.sourceMapURL = sourceMapURL;
this.hasSourceURL = hasSourceURL;
+ this._originalContentProvider = null;
+ this._originalSource = null;
}
/**
@@ -186,11 +188,25 @@ SDK.Script = class {
} else {
this._source = '';
}
+ if (this._originalSource === null)
+ this._originalSource = this._source;
callback(this._source);
}
}
/**
+ * @return {!Common.ContentProvider}
+ */
+ originalContentProvider() {
+ if (!this._originalContentProvider) {
+ var lazyContent = () => this.requestContent().then(() => this._originalSource);
+ this._originalContentProvider =
+ new Common.StaticContentProvider(this.contentURL(), this.contentType(), lazyContent);
+ }
+ return this._originalContentProvider;
+ }
+
+ /**
* @override
* @param {string} query
* @param {boolean} caseSensitive
@@ -261,8 +277,9 @@ SDK.Script = class {
newSource = this._appendSourceURLCommentIfNeeded(newSource);
if (this.scriptId) {
- this.debuggerModel.target().debuggerAgent().setScriptSource(
- this.scriptId, newSource, undefined, didEditScriptSource.bind(this));
+ this.requestContent().then(
+ () => this.debuggerModel.target().debuggerAgent().setScriptSource(
+ this.scriptId, newSource, undefined, didEditScriptSource.bind(this)));
} else {
callback('Script failed to parse');
}
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/sdk/CSSStyleSheetHeader.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698