Ignore:
Timestamp:
Nov 3, 2011, 5:02:05 AM (14 years ago)
Author:
[email protected]
Message:

Web Inspector: preserve script location for inline handlers.
https://bugs.webkit.org/show_bug.cgi?id=71367

Source/JavaScriptCore:

Makes SourceCode factories receive TextPosition instead of the line number;
Stores consistent position values in SourceCode and SourceProvider;

Patch by Pavel Feldman <[email protected]> on 2011-11-03
Reviewed by Yury Semikhatsky.

  • API/JSBase.cpp:

(JSEvaluateScript):
(JSCheckScriptSyntax):

  • API/JSObjectRef.cpp:

(JSObjectMakeFunction):

  • parser/SourceCode.h:

(JSC::makeSource):

  • parser/SourceProvider.h:

(JSC::SourceProvider::SourceProvider):
(JSC::SourceProvider::startPosition):
(JSC::UStringSourceProvider::create):
(JSC::UStringSourceProvider::UStringSourceProvider):

  • runtime/FunctionConstructor.cpp:

(JSC::constructFunction):
(JSC::constructFunctionSkippingEvalEnabledCheck):

  • runtime/FunctionConstructor.h:

Source/WebCore:

Makes eventHandler report position, not line number;

Patch by Pavel Feldman <[email protected]> on 2011-11-03
Reviewed by Yury Semikhatsky.

  • bindings/js/CachedScriptSourceProvider.h:

(WebCore::CachedScriptSourceProvider::CachedScriptSourceProvider):

  • bindings/js/JSLazyEventListener.cpp:

(WebCore::JSLazyEventListener::JSLazyEventListener):
(WebCore::JSLazyEventListener::initializeJSFunction):

  • bindings/js/JSLazyEventListener.h:

(WebCore::JSLazyEventListener::create):

  • bindings/js/ScriptController.cpp:

(WebCore::ScriptController::eventHandlerPosition):

  • bindings/js/ScriptController.h:
  • bindings/js/ScriptEventListener.cpp:

(WebCore::createAttributeEventListener):

  • bindings/js/ScriptSourceProvider.h:

(WebCore::ScriptSourceProvider::ScriptSourceProvider):

  • bindings/js/StringSourceProvider.h:

(WebCore::StringSourceProvider::create):
(WebCore::StringSourceProvider::StringSourceProvider):
(WebCore::makeSource):

LayoutTests:

Linkifier test reimplemented for simplisity.

Patch by Pavel Feldman <[email protected]> on 2011-11-03
Reviewed by Yury Semikhatsky.

  • inspector/debugger/debugger-scripts-expected.txt:
  • inspector/debugger/debugger-scripts.html:
  • inspector/debugger/linkifier-expected.txt:
  • inspector/debugger/linkifier.html:
  • platform/chromium/inspector/debugger/debugger-scripts-expected.txt: Copied from LayoutTests/inspector/debugger/debugger-scripts-expected.txt.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/parser/SourceProvider.h

    r98624 r99167  
    4141    class SourceProvider : public RefCounted<SourceProvider> {
    4242    public:
    43         SourceProvider(const UString& url, SourceProviderCache* cache = 0)
     43        SourceProvider(const UString& url, const TextPosition& startPosition, SourceProviderCache* cache = 0)
    4444            : m_url(url)
     45            , m_startPosition(startPosition)
    4546            , m_validated(false)
    4647            , m_cache(cache ? cache : new SourceProviderCache)
     
    6061       
    6162        const UString& url() { return m_url; }
    62         virtual TextPosition startPosition() const { return TextPosition::minimumPosition(); }
     63        TextPosition startPosition() const { return m_startPosition; }
    6364        intptr_t asID() { return reinterpret_cast<intptr_t>(this); }
    6465
     
    7374
    7475        UString m_url;
     76        TextPosition m_startPosition;
    7577        bool m_validated;
    7678        SourceProviderCache* m_cache;
     
    8082    class UStringSourceProvider : public SourceProvider {
    8183    public:
    82         static PassRefPtr<UStringSourceProvider> create(const UString& source, const UString& url)
     84        static PassRefPtr<UStringSourceProvider> create(const UString& source, const UString& url, const TextPosition& startPosition = TextPosition::minimumPosition())
    8385        {
    84             return adoptRef(new UStringSourceProvider(source, url));
     86            return adoptRef(new UStringSourceProvider(source, url, startPosition));
    8587        }
    8688
     
    9395
    9496    private:
    95         UStringSourceProvider(const UString& source, const UString& url)
    96             : SourceProvider(url)
     97        UStringSourceProvider(const UString& source, const UString& url, const TextPosition& startPosition)
     98            : SourceProvider(url, startPosition)
    9799            , m_source(source)
    98100            , m_data(m_source.characters16())
Note: See TracChangeset for help on using the changeset viewer.