OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2010 Apple Inc. All rights reserved. |
3 * Copyright (C) 2010-2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2010-2011 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 return Array<TypeBuilder::Debugger::CallFrame>::create(); | 659 return Array<TypeBuilder::Debugger::CallFrame>::create(); |
660 } | 660 } |
661 return injectedScript.wrapCallFrames(m_currentCallStack); | 661 return injectedScript.wrapCallFrames(m_currentCallStack); |
662 } | 662 } |
663 | 663 |
664 String InspectorDebuggerAgent::sourceMapURLForScript(const Script& script) | 664 String InspectorDebuggerAgent::sourceMapURLForScript(const Script& script) |
665 { | 665 { |
666 bool deprecated; | 666 bool deprecated; |
667 String sourceMapURL = ContentSearchUtils::findSourceMapURL(script.source, Co
ntentSearchUtils::JavaScriptMagicComment, &deprecated); | 667 String sourceMapURL = ContentSearchUtils::findSourceMapURL(script.source, Co
ntentSearchUtils::JavaScriptMagicComment, &deprecated); |
668 if (!sourceMapURL.isEmpty()) { | 668 if (!sourceMapURL.isEmpty()) { |
669 if (deprecated) | 669 // FIXME: add deprecated console message here. |
670 addConsoleMessage(NetworkMessageSource, WarningMessageLevel, "\"//@
sourceMappingURL=\" source mapping URL declaration is deprecated, \"//# sourceMa
ppingURL=\" declaration should be used instead.", script.url); | |
671 return sourceMapURL; | 670 return sourceMapURL; |
672 } | 671 } |
673 | 672 |
674 if (script.url.isEmpty()) | 673 if (script.url.isEmpty()) |
675 return String(); | 674 return String(); |
676 | 675 |
677 InspectorPageAgent* pageAgent = m_instrumentingAgents->inspectorPageAgent(); | 676 InspectorPageAgent* pageAgent = m_instrumentingAgents->inspectorPageAgent(); |
678 if (!pageAgent) | 677 if (!pageAgent) |
679 return String(); | 678 return String(); |
680 return pageAgent->resourceSourceMapURL(script.url); | 679 return pageAgent->resourceSourceMapURL(script.url); |
681 } | 680 } |
682 | 681 |
683 // JavaScriptDebugListener functions | 682 // JavaScriptDebugListener functions |
684 | 683 |
685 void InspectorDebuggerAgent::didParseSource(const String& scriptId, const Script
& script) | 684 void InspectorDebuggerAgent::didParseSource(const String& scriptId, const Script
& script) |
686 { | 685 { |
687 // Don't send script content to the front end until it's really needed. | 686 // Don't send script content to the front end until it's really needed. |
688 const bool* isContentScript = script.isContentScript ? &script.isContentScri
pt : 0; | 687 const bool* isContentScript = script.isContentScript ? &script.isContentScri
pt : 0; |
689 String sourceMapURL = sourceMapURLForScript(script); | 688 String sourceMapURL = sourceMapURLForScript(script); |
690 String* sourceMapURLParam = sourceMapURL.isNull() ? 0 : &sourceMapURL; | 689 String* sourceMapURLParam = sourceMapURL.isNull() ? 0 : &sourceMapURL; |
691 String sourceURL; | 690 String sourceURL; |
692 if (!script.startLine && !script.startColumn) { | 691 if (!script.startLine && !script.startColumn) { |
693 bool deprecated; | 692 bool deprecated; |
694 sourceURL = ContentSearchUtils::findSourceURL(script.source, ContentSear
chUtils::JavaScriptMagicComment, &deprecated); | 693 sourceURL = ContentSearchUtils::findSourceURL(script.source, ContentSear
chUtils::JavaScriptMagicComment, &deprecated); |
695 if (deprecated) | 694 // FIXME: add deprecated console message here. |
696 addConsoleMessage(NetworkMessageSource, WarningMessageLevel, "\"//@
sourceURL=\" source URL declaration is deprecated, \"//# sourceURL=\" declaratio
n should be used instead.", script.url); | |
697 } | 695 } |
698 bool hasSourceURL = !sourceURL.isEmpty(); | 696 bool hasSourceURL = !sourceURL.isEmpty(); |
699 String scriptURL = hasSourceURL ? sourceURL : script.url; | 697 String scriptURL = hasSourceURL ? sourceURL : script.url; |
700 bool* hasSourceURLParam = hasSourceURL ? &hasSourceURL : 0; | 698 bool* hasSourceURLParam = hasSourceURL ? &hasSourceURL : 0; |
701 m_frontend->scriptParsed(scriptId, scriptURL, script.startLine, script.start
Column, script.endLine, script.endColumn, isContentScript, sourceMapURLParam, ha
sSourceURLParam); | 699 m_frontend->scriptParsed(scriptId, scriptURL, script.startLine, script.start
Column, script.endLine, script.endColumn, isContentScript, sourceMapURLParam, ha
sSourceURLParam); |
702 | 700 |
703 m_scripts.set(scriptId, script); | 701 m_scripts.set(scriptId, script); |
704 | 702 |
705 if (scriptURL.isEmpty()) | 703 if (scriptURL.isEmpty()) |
706 return; | 704 return; |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
855 void InspectorDebuggerAgent::reset() | 853 void InspectorDebuggerAgent::reset() |
856 { | 854 { |
857 m_scripts.clear(); | 855 m_scripts.clear(); |
858 m_breakpointIdToDebugServerBreakpointIds.clear(); | 856 m_breakpointIdToDebugServerBreakpointIds.clear(); |
859 if (m_frontend) | 857 if (m_frontend) |
860 m_frontend->globalObjectCleared(); | 858 m_frontend->globalObjectCleared(); |
861 } | 859 } |
862 | 860 |
863 } // namespace WebCore | 861 } // namespace WebCore |
864 | 862 |
OLD | NEW |