Ignore:
Timestamp:
Jan 2, 2019, 9:59:08 AM (6 years ago)
Author:
[email protected]
Message:

SourceProviders should use an actual URL instead of a string
https://bugs.webkit.org/show_bug.cgi?id=192734

Reviewed by Yusuke Suzuki.

Source/JavaScriptCore:

This will be useful for the Module loader API in the future where
by default it will use the relative path from the referring module
to resolve dependencies.

I didn't change the JSC shell's urls to be absolute paths as it
caused problems with the stack traces in our Chakra tests. Since
the absolute paths included system directories the diff would
appear incorrect.
See: https://bugs.webkit.org/show_bug.cgi?id=193077

  • API/JSBase.cpp:

(JSEvaluateScript):
(JSCheckScriptSyntax):

  • API/JSScriptRef.cpp:

(OpaqueJSScript::create):
(OpaqueJSScript::OpaqueJSScript):

  • API/glib/JSCContext.cpp:

(jsc_context_check_syntax):

  • jsc.cpp:

(jscSource):
(GlobalObject::moduleLoaderFetch):
(functionCheckModuleSyntax):
(runWithOptions):

  • parser/SourceCode.h:

(JSC::makeSource):

  • parser/SourceProvider.cpp:

(JSC::SourceProvider::SourceProvider):

  • parser/SourceProvider.h:

(JSC::SourceProvider::url const):
(JSC::StringSourceProvider::create):
(JSC::StringSourceProvider::StringSourceProvider):
(JSC::WebAssemblySourceProvider::create):
(JSC::WebAssemblySourceProvider::WebAssemblySourceProvider):

  • runtime/FunctionConstructor.cpp:

(JSC::constructFunctionSkippingEvalEnabledCheck):

  • tools/CodeProfile.h:

(JSC::CodeProfile::CodeProfile):

  • tools/FunctionOverrides.cpp:

(JSC::initializeOverrideInfo):

Source/WebCore:

Remove ScriptSourceCode's URL member and make the url() method
reference the URL on the SourceProvider. Also, avoid some
ref count churn.

Additionally, this patch fixes an existing bug in
WorkletGlobalScope() that would use a ScriptSourceCode after
WTFMoving it.

  • bindings/js/CachedScriptSourceProvider.h:

(WebCore::CachedScriptSourceProvider::CachedScriptSourceProvider):

  • bindings/js/ScheduledAction.cpp:

(WebCore::ScheduledAction::execute):

  • bindings/js/ScriptController.cpp:

(WebCore::ScriptController::executeScriptInWorld):
(WebCore::ScriptController::executeScript):

  • bindings/js/ScriptSourceCode.h:

(WebCore::ScriptSourceCode::ScriptSourceCode):
(WebCore::ScriptSourceCode::m_code):
(WebCore::ScriptSourceCode::url const):
(WebCore::ScriptSourceCode::m_url): Deleted.

  • dom/ScriptElement.cpp:

(WebCore::ScriptElement::prepareScript):
(WebCore::ScriptElement::requestModuleScript):
(WebCore::ScriptElement::executePendingScript):

  • html/HTMLMediaElement.cpp:

(WebCore::HTMLMediaElement::ensureMediaControlsInjectedScript):

  • page/Frame.cpp:

(WebCore::Frame::injectUserScriptImmediately):

  • workers/WorkerGlobalScope.cpp:

(WebCore::WorkerGlobalScope::importScripts):

  • workers/WorkerThread.cpp:

(WebCore::WorkerThread::workerThread):

  • worklets/WorkletGlobalScope.cpp:

(WebCore::WorkletGlobalScope::WorkletGlobalScope):

  • xml/parser/XMLDocumentParserLibxml2.cpp:

(WebCore::XMLDocumentParser::endElementNs):

File:
1 edited

Legend:

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

    r233377 r239569  
    101101    };
    102102
    103     inline SourceCode makeSource(const String& source, const SourceOrigin& sourceOrigin, const String& url = String(), const TextPosition& startPosition = TextPosition(), SourceProviderSourceType sourceType = SourceProviderSourceType::Program)
     103    inline SourceCode makeSource(const String& source, const SourceOrigin& sourceOrigin, URL&& url = URL(), const TextPosition& startPosition = TextPosition(), SourceProviderSourceType sourceType = SourceProviderSourceType::Program)
    104104    {
    105         return SourceCode(StringSourceProvider::create(source, sourceOrigin, url, startPosition, sourceType), startPosition.m_line.oneBasedInt(), startPosition.m_column.oneBasedInt());
     105        return SourceCode(StringSourceProvider::create(source, sourceOrigin, WTFMove(url), startPosition, sourceType), startPosition.m_line.oneBasedInt(), startPosition.m_column.oneBasedInt());
    106106    }
    107107   
Note: See TracChangeset for help on using the changeset viewer.