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 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
628 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(m _pausedScriptState); | 628 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(m _pausedScriptState); |
629 if (injectedScript.hasNoValue()) { | 629 if (injectedScript.hasNoValue()) { |
630 ASSERT_NOT_REACHED(); | 630 ASSERT_NOT_REACHED(); |
631 return Array<TypeBuilder::Debugger::CallFrame>::create(); | 631 return Array<TypeBuilder::Debugger::CallFrame>::create(); |
632 } | 632 } |
633 return injectedScript.wrapCallFrames(m_currentCallStack); | 633 return injectedScript.wrapCallFrames(m_currentCallStack); |
634 } | 634 } |
635 | 635 |
636 String InspectorDebuggerAgent::sourceMapURLForScript(const Script& script) | 636 String InspectorDebuggerAgent::sourceMapURLForScript(const Script& script) |
637 { | 637 { |
638 DEFINE_STATIC_LOCAL(String, sourceMapHttpHeader, (ASCIILiteral("X-SourceMap" ))); | 638 bool deprecated; |
639 | 639 String sourceMapURL = ContentSearchUtils::findSourceMapURL(script.source, Co ntentSearchUtils::JavaScriptMagicComment, &deprecated); |
640 String sourceMapURL = ContentSearchUtils::findSourceMapURL(script.source, Co ntentSearchUtils::JavaScriptMagicComment); | 640 if (!sourceMapURL.isEmpty()) { |
641 if (!sourceMapURL.isEmpty()) | 641 if (deprecated) |
642 addConsoleMessage(NetworkMessageSource, WarningMessageLevel, "\"//@ sourceMapURL=\" source mapping url declaration is deprecated, \"//# sourceMapURL =\" declaration should be used instead.", script.url); | |
apavlov
2013/05/29 13:58:05
url -> URL ?
apavlov
2013/05/29 13:58:05
Perhaps, "...is deprecated and will be unsupported
| |
642 return sourceMapURL; | 643 return sourceMapURL; |
644 } | |
643 | 645 |
644 if (script.url.isEmpty()) | 646 if (script.url.isEmpty()) |
645 return String(); | 647 return String(); |
646 | 648 |
647 InspectorPageAgent* pageAgent = m_instrumentingAgents->inspectorPageAgent(); | 649 InspectorPageAgent* pageAgent = m_instrumentingAgents->inspectorPageAgent(); |
648 if (!pageAgent) | 650 if (!pageAgent) |
649 return String(); | 651 return String(); |
650 | 652 return pageAgent->resourceSourceMapURL(script.url); |
651 CachedResource* resource = pageAgent->cachedResource(pageAgent->mainFrame(), KURL(ParsedURLString, script.url)); | |
652 if (resource) | |
653 return resource->response().httpHeaderField(sourceMapHttpHeader); | |
654 return String(); | |
655 } | 653 } |
656 | 654 |
657 // JavaScriptDebugListener functions | 655 // JavaScriptDebugListener functions |
658 | 656 |
659 void InspectorDebuggerAgent::didParseSource(const String& scriptId, const Script & script) | 657 void InspectorDebuggerAgent::didParseSource(const String& scriptId, const Script & script) |
660 { | 658 { |
661 // Don't send script content to the front end until it's really needed. | 659 // Don't send script content to the front end until it's really needed. |
662 const bool* isContentScript = script.isContentScript ? &script.isContentScri pt : 0; | 660 const bool* isContentScript = script.isContentScript ? &script.isContentScri pt : 0; |
663 String sourceMapURL = sourceMapURLForScript(script); | 661 String sourceMapURL = sourceMapURLForScript(script); |
664 String* sourceMapURLParam = sourceMapURL.isNull() ? 0 : &sourceMapURL; | 662 String* sourceMapURLParam = sourceMapURL.isNull() ? 0 : &sourceMapURL; |
665 String sourceURL; | 663 String sourceURL; |
666 if (!script.startLine && !script.startColumn) | 664 if (!script.startLine && !script.startColumn) { |
667 sourceURL = ContentSearchUtils::findSourceURL(script.source, ContentSear chUtils::JavaScriptMagicComment); | 665 bool deprecated; |
666 sourceURL = ContentSearchUtils::findSourceURL(script.source, ContentSear chUtils::JavaScriptMagicComment, &deprecated); | |
667 if (deprecated) | |
668 addConsoleMessage(NetworkMessageSource, WarningMessageLevel, "\"//@ sourceURL=\" source url declaration is deprecated, \"//# sourceURL=\" declaratio n should be used instead.", script.url); | |
apavlov
2013/05/29 13:58:05
Ditto for the message contents.
| |
669 } | |
668 bool hasSourceURL = !sourceURL.isEmpty(); | 670 bool hasSourceURL = !sourceURL.isEmpty(); |
669 String scriptURL = hasSourceURL ? sourceURL : script.url; | 671 String scriptURL = hasSourceURL ? sourceURL : script.url; |
670 bool* hasSourceURLParam = hasSourceURL ? &hasSourceURL : 0; | 672 bool* hasSourceURLParam = hasSourceURL ? &hasSourceURL : 0; |
671 m_frontend->scriptParsed(scriptId, scriptURL, script.startLine, script.start Column, script.endLine, script.endColumn, isContentScript, sourceMapURLParam, ha sSourceURLParam); | 673 m_frontend->scriptParsed(scriptId, scriptURL, script.startLine, script.start Column, script.endLine, script.endColumn, isContentScript, sourceMapURLParam, ha sSourceURLParam); |
672 | 674 |
673 m_scripts.set(scriptId, script); | 675 m_scripts.set(scriptId, script); |
674 | 676 |
675 if (scriptURL.isEmpty()) | 677 if (scriptURL.isEmpty()) |
676 return; | 678 return; |
677 | 679 |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
794 void InspectorDebuggerAgent::reset() | 796 void InspectorDebuggerAgent::reset() |
795 { | 797 { |
796 m_scripts.clear(); | 798 m_scripts.clear(); |
797 m_breakpointIdToDebugServerBreakpointIds.clear(); | 799 m_breakpointIdToDebugServerBreakpointIds.clear(); |
798 if (m_frontend) | 800 if (m_frontend) |
799 m_frontend->globalObjectCleared(); | 801 m_frontend->globalObjectCleared(); |
800 } | 802 } |
801 | 803 |
802 } // namespace WebCore | 804 } // namespace WebCore |
803 | 805 |
OLD | NEW |