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

Side by Side Diff: src/mirror-delay.js

Issue 596088: Land 598061(Process //@ scriptURL=url comment for scripts that don't have nam... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | test/mjsunit/debug-compile-event.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1715 matching lines...) Expand 10 before | Expand all | Expand 10 after
1726 } 1726 }
1727 inherits(ScriptMirror, Mirror); 1727 inherits(ScriptMirror, Mirror);
1728 1728
1729 1729
1730 ScriptMirror.prototype.value = function() { 1730 ScriptMirror.prototype.value = function() {
1731 return this.script_; 1731 return this.script_;
1732 }; 1732 };
1733 1733
1734 1734
1735 ScriptMirror.prototype.name = function() { 1735 ScriptMirror.prototype.name = function() {
1736 return this.script_.name; 1736 // If we have name, we trust it more than sourceURL from comments
1737 return this.script_.name || this.sourceUrlFromComment_();
1737 }; 1738 };
1738 1739
1739 1740
1740 ScriptMirror.prototype.id = function() { 1741 ScriptMirror.prototype.id = function() {
1741 return this.script_.id; 1742 return this.script_.id;
1742 }; 1743 };
1743 1744
1744 1745
1745 ScriptMirror.prototype.source = function() { 1746 ScriptMirror.prototype.source = function() {
1746 return this.script_.source; 1747 return this.script_.source;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
1822 result += this.lineOffset() + this.lineCount() - 1; 1823 result += this.lineOffset() + this.lineCount() - 1;
1823 } else { 1824 } else {
1824 result += this.lineCount(); 1825 result += this.lineCount();
1825 } 1826 }
1826 result += ')'; 1827 result += ')';
1827 return result; 1828 return result;
1828 } 1829 }
1829 1830
1830 1831
1831 /** 1832 /**
1833 * Returns a suggested script URL from comments in script code (if found),
1834 * undefined otherwise. Used primarily by debuggers for identifying eval()'ed
1835 * scripts. See
1836 * http://fbug.googlecode.com/svn/branches/firebug1.1/docs/ReleaseNotes_1.1.txt
1837 * for details.
1838 *
1839 * @return {?string} value for //@ sourceURL comment
1840 */
1841 ScriptMirror.prototype.sourceUrlFromComment_ = function() {
1842 if (!('sourceUrl_' in this) && this.source()) {
1843 // TODO(608): the spaces in a regexp below had to be escaped as \040
1844 // because this file is being processed by js2c whose handling of spaces
1845 // in regexps is broken.
1846 // We're not using \s here to prevent \n from matching.
1847 var sourceUrlPattern = /\/\/@[\040\t]sourceURL=[\040\t]*(\S+)[\040\t]*$/m;
1848 var match = sourceUrlPattern.exec(this.source());
1849 this.sourceUrl_ = match ? match[1] : undefined;
1850 }
1851 return this.sourceUrl_;
1852 };
1853
1854
1855 /**
1832 * Mirror object for context. 1856 * Mirror object for context.
1833 * @param {Object} data The context data 1857 * @param {Object} data The context data
1834 * @constructor 1858 * @constructor
1835 * @extends Mirror 1859 * @extends Mirror
1836 */ 1860 */
1837 function ContextMirror(data) { 1861 function ContextMirror(data) {
1838 Mirror.call(this, CONTEXT_TYPE); 1862 Mirror.call(this, CONTEXT_TYPE);
1839 this.data_ = data; 1863 this.data_ = data;
1840 this.allocateHandle_(); 1864 this.allocateHandle_();
1841 } 1865 }
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
2325 } 2349 }
2326 if (!isFinite(value)) { 2350 if (!isFinite(value)) {
2327 if (value > 0) { 2351 if (value > 0) {
2328 return 'Infinity'; 2352 return 'Infinity';
2329 } else { 2353 } else {
2330 return '-Infinity'; 2354 return '-Infinity';
2331 } 2355 }
2332 } 2356 }
2333 return value; 2357 return value;
2334 } 2358 }
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/debug-compile-event.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698