Commit 3fd1f8a7 authored by Alexey Kozyatinskiy's avatar Alexey Kozyatinskiy Committed by Commit Bot

inspector: do not use SeekForward to move backward

We can use Seek + Advance instead on source stream.

TBR=verwaest@chromium.org

Bug: chromium:879550
Cq-Include-Trybots: luci.chromium.try:linux_chromium_headless_rel;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: Ic6ad12a86105ce68ea404e313b74d11417928cf0
Reviewed-on: https://chromium-review.googlesource.com/1196686
Commit-Queue: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Reviewed-by: 's avatarMaya Lekova <mslekova@chromium.org>
Reviewed-by: 's avatarAleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55552}
parent bd9df9a7
......@@ -1881,7 +1881,8 @@ void EnsureMagicComments(Isolate* isolate, Handle<Script> script) {
handle(Smi::FromInt(prev_start), isolate)));
if (start == -1) return;
scanner.SeekForward(start);
scanner_stream->Seek(start);
scanner_stream->Advance();
scanner.Next();
Handle<String> source_url = scanner.SourceUrl(isolate);
......
......@@ -657,6 +657,24 @@ scriptParsed
url : eval.js
}
scriptFailedToParse
{
scriptSource : {a:2:<nl>//# sourceURL=http://a.js
}
{
endColumn : 25
endLine : 1
executionContextId : <executionContextId>
hasSourceURL : true
hash : 33c5612558c02e5a3bfa0d098c82865f38f98df2
isModule : false
length : 31
scriptId : <scriptId>
sourceMapURL :
startColumn : 0
startLine : 0
url : http://a.js
}
scriptFailedToParse
{
scriptSource : }//# sourceURL=failed.js<nl>//# sourceMappingURL=failed-map
}
......
......@@ -33,6 +33,8 @@ function addScripts() {
.then(() => addScript("function foo13(){}"))
// script in eval
.then(() => addScript("function foo15(){}; eval(\"function foo14(){}//# sourceURL=eval.js\")//# sourceURL=eval-wrapper.js"))
// // inside sourceURL
.then(() => addScript("{a:2:\n//# sourceURL=http://a.js"))
// sourceURL and sourceMappingURL works even for script with syntax error
.then(() => addScript("}//# sourceURL=failed.js\n//# sourceMappingURL=failed-map"))
.then(() => addScript("{a:2://# sourceURL=failed.js\n//# sourceMappingURL=failed-map"))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment