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

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

Issue 1527007: Support setting brekpoint by script name set in //@ scriptURL= comment, (Closed)
Patch Set: Created 10 years, 8 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
« no previous file with comments | « src/messages.js ('k') | test/mjsunit/debug-setbreakpoint.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 1710 matching lines...) Expand 10 before | Expand all | Expand 10 after
1721 } 1721 }
1722 inherits(ScriptMirror, Mirror); 1722 inherits(ScriptMirror, Mirror);
1723 1723
1724 1724
1725 ScriptMirror.prototype.value = function() { 1725 ScriptMirror.prototype.value = function() {
1726 return this.script_; 1726 return this.script_;
1727 }; 1727 };
1728 1728
1729 1729
1730 ScriptMirror.prototype.name = function() { 1730 ScriptMirror.prototype.name = function() {
1731 // If we have name, we trust it more than sourceURL from comments 1731 return this.script_.name || this.script_.nameOrSourceURL();
1732 return this.script_.name || this.sourceUrlFromComment_();
1733 }; 1732 };
1734 1733
1735 1734
1736 ScriptMirror.prototype.id = function() { 1735 ScriptMirror.prototype.id = function() {
1737 return this.script_.id; 1736 return this.script_.id;
1738 }; 1737 };
1739 1738
1740 1739
1741 ScriptMirror.prototype.source = function() { 1740 ScriptMirror.prototype.source = function() {
1742 return this.script_.source; 1741 return this.script_.source;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
1818 result += this.lineOffset() + this.lineCount() - 1; 1817 result += this.lineOffset() + this.lineCount() - 1;
1819 } else { 1818 } else {
1820 result += this.lineCount(); 1819 result += this.lineCount();
1821 } 1820 }
1822 result += ')'; 1821 result += ')';
1823 return result; 1822 return result;
1824 } 1823 }
1825 1824
1826 1825
1827 /** 1826 /**
1828 * Returns a suggested script URL from comments in script code (if found),
1829 * undefined otherwise. Used primarily by debuggers for identifying eval()'ed
1830 * scripts. See
1831 * http://fbug.googlecode.com/svn/branches/firebug1.1/docs/ReleaseNotes_1.1.txt
1832 * for details.
1833 *
1834 * @return {?string} value for //@ sourceURL comment
1835 */
1836 ScriptMirror.prototype.sourceUrlFromComment_ = function() {
1837 if (!('sourceUrl_' in this) && this.source()) {
1838 // TODO(608): the spaces in a regexp below had to be escaped as \040
1839 // because this file is being processed by js2c whose handling of spaces
1840 // in regexps is broken.
1841 // We're not using \s here to prevent \n from matching.
1842 var sourceUrlPattern = /\/\/@[\040\t]sourceURL=[\040\t]*(\S+)[\040\t]*$/m;
1843 var match = sourceUrlPattern.exec(this.source());
1844 this.sourceUrl_ = match ? match[1] : undefined;
1845 }
1846 return this.sourceUrl_;
1847 };
1848
1849
1850 /**
1851 * Mirror object for context. 1827 * Mirror object for context.
1852 * @param {Object} data The context data 1828 * @param {Object} data The context data
1853 * @constructor 1829 * @constructor
1854 * @extends Mirror 1830 * @extends Mirror
1855 */ 1831 */
1856 function ContextMirror(data) { 1832 function ContextMirror(data) {
1857 Mirror.call(this, CONTEXT_TYPE); 1833 Mirror.call(this, CONTEXT_TYPE);
1858 this.data_ = data; 1834 this.data_ = data;
1859 this.allocateHandle_(); 1835 this.allocateHandle_();
1860 } 1836 }
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
2353 } 2329 }
2354 if (!isFinite(value)) { 2330 if (!isFinite(value)) {
2355 if (value > 0) { 2331 if (value > 0) {
2356 return 'Infinity'; 2332 return 'Infinity';
2357 } else { 2333 } else {
2358 return '-Infinity'; 2334 return '-Infinity';
2359 } 2335 }
2360 } 2336 }
2361 return value; 2337 return value;
2362 } 2338 }
OLDNEW
« no previous file with comments | « src/messages.js ('k') | test/mjsunit/debug-setbreakpoint.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698