Skip to content

Commit 3c3d7e7

Browse files
alexkozyCommit bot
authored andcommitted
Revert "Removed support deprecated (//@|/*@) source(URL|MappingURL)="
A lot of deverlopers use deprecated sourceURL syntax. We should add console warning message before removing this. Original CL: https://codereview.chromium.org/1495633002/ BUG=chromium:558998 LOG=Y [email protected],[email protected],[email protected] Review URL: https://codereview.chromium.org/1654223003 Cr-Commit-Position: refs/heads/master@{#33709}
1 parent ee4efed commit 3c3d7e7

9 files changed

Lines changed: 31 additions & 23 deletions

File tree

include/v8.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1610,7 +1610,8 @@ class V8_EXPORT StackFrame {
16101610
/**
16111611
* Returns the name of the resource that contains the script for the
16121612
* function for this StackFrame or sourceURL value if the script name
1613-
* is undefined and its source ends with //# sourceURL=... string.
1613+
* is undefined and its source ends with //# sourceURL=... string or
1614+
* deprecated //@ sourceURL=... string.
16141615
*/
16151616
Local<String> GetScriptNameOrSourceURL() const;
16161617

src/js/messages.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -432,10 +432,11 @@ function ScriptLineEnd(n) {
432432
* If sourceURL comment is available returns sourceURL comment contents.
433433
* Otherwise, script name is returned. See
434434
* http://fbug.googlecode.com/svn/branches/firebug1.1/docs/ReleaseNotes_1.1.txt
435-
* and Source Map Revision 3 proposal for details on using //# sourceURL
436-
* comment to identify scripts that don't have name.
435+
* and Source Map Revision 3 proposal for details on using //# sourceURL and
436+
* deprecated //@ sourceURL comment to identify scripts that don't have name.
437437
*
438-
* @return {?string} script name if present, value for //# sourceURL comment.
438+
* @return {?string} script name if present, value for //# sourceURL comment or
439+
* deprecated //@ sourceURL comment otherwise.
439440
*/
440441
function ScriptNameOrSourceURL() {
441442
if (this.source_url) return this.source_url;

src/parsing/scanner.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ Token::Value Scanner::SkipSourceURLComment() {
357357

358358

359359
void Scanner::TryToParseSourceURLComment() {
360-
// Magic comments are of the form: //[#]\s<name>=\s*<value>\s*.* and this
360+
// Magic comments are of the form: //[#@]\s<name>=\s*<value>\s*.* and this
361361
// function will just return if it cannot parse a magic comment.
362362
if (c0_ < 0 || !unicode_cache_->IsWhiteSpace(c0_)) return;
363363
Advance();
@@ -578,7 +578,7 @@ void Scanner::Scan() {
578578
Advance();
579579
if (c0_ == '/') {
580580
Advance();
581-
if (c0_ == '#') {
581+
if (c0_ == '#' || c0_ == '@') {
582582
Advance();
583583
token = SkipSourceURLComment();
584584
} else {

test/cctest/test-api.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17260,6 +17260,8 @@ TEST(SourceURLInStackTrace) {
1726017260
i::ScopedVector<char> code(1024);
1726117261
i::SNPrintF(code, source, "//# sourceURL=eval_url");
1726217262
CHECK(CompileRun(code.start())->IsUndefined());
17263+
i::SNPrintF(code, source, "//@ sourceURL=eval_url");
17264+
CHECK(CompileRun(code.start())->IsUndefined());
1726317265
}
1726417266

1726517267

@@ -17340,6 +17342,8 @@ TEST(InlineScriptWithSourceURLInStackTrace) {
1734017342
i::ScopedVector<char> code(1024);
1734117343
i::SNPrintF(code, source, "//# sourceURL=source_url");
1734217344
CHECK(CompileRunWithOrigin(code.start(), "url", 0, 1)->IsUndefined());
17345+
i::SNPrintF(code, source, "//@ sourceURL=source_url");
17346+
CHECK(CompileRunWithOrigin(code.start(), "url", 0, 1)->IsUndefined());
1734317347
}
1734417348

1734517349

@@ -17384,6 +17388,8 @@ TEST(DynamicWithSourceURLInStackTrace) {
1738417388
i::ScopedVector<char> code(1024);
1738517389
i::SNPrintF(code, source, "//# sourceURL=source_url");
1738617390
CHECK(CompileRunWithOrigin(code.start(), "url", 0, 0)->IsUndefined());
17391+
i::SNPrintF(code, source, "//@ sourceURL=source_url");
17392+
CHECK(CompileRunWithOrigin(code.start(), "url", 0, 0)->IsUndefined());
1738717393
}
1738817394

1738917395

test/mjsunit/regress/regress-conditional-position.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@ test(test1, 58);
8686
test(test2, 65);
8787
test(test3, 72);
8888

89-
eval(test1.toString() + "//# sourceUrl=foo");
90-
eval(test2.toString() + "//# sourceUrl=foo");
91-
eval(test3.toString() + "//# sourceUrl=foo");
89+
eval(test1.toString() + "//@ sourceUrl=foo");
90+
eval(test2.toString() + "//@ sourceUrl=foo");
91+
eval(test3.toString() + "//@ sourceUrl=foo");
9292

9393
test(test1, 2);
9494
test(test2, 3);

test/mjsunit/regress/regress-crbug-109362.js

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/mjsunit/regress/regress-crbug-481896.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/mjsunit/regress/regress-crbug-517592.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ var source =
88
"var foo = function foo() {\n" +
99
" return 1;\n" +
1010
"}\n" +
11-
"//# sourceURL=test";
11+
"//@ sourceURL=test";
1212

1313
Debug = debug.Debug;
1414
Debug.setListener(listener);

test/mjsunit/stack-traces.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ function testEvalWithSourceURL() {
6969

7070
function testNestedEvalWithSourceURL() {
7171
var x = "FAIL";
72-
var innerEval = 'function Inner() { eval(x); }\n//# sourceURL=res://inner-eval';
72+
var innerEval = 'function Inner() { eval(x); }\n//@ sourceURL=res://inner-eval';
7373
eval("function Outer() { eval(innerEval); Inner(); }; Outer();\n//# sourceURL=res://outer-eval");
7474
}
7575

0 commit comments

Comments
 (0)