Changeset 223732 in webkit


Ignore:
Timestamp:
Oct 19, 2017 6:34:03 PM (7 years ago)
Author:
Chris Dumez
Message:

SerializedScriptValue passed to postMessage() cannot be null
https://bugs.webkit.org/show_bug.cgi?id=178550

Reviewed by Youenn Fablet.

SerializedScriptValue passed to postMessage() cannot be null. Therefore, we
should use Ref<> type, not RefPtr<>.

  • dom/MessagePortChannel.h:
  • dom/default/PlatformMessagePortChannel.cpp:

(WebCore::MessagePortChannel::postMessageToRemote):

  • workers/WorkerGlobalScopeProxy.h:
  • workers/WorkerMessagingProxy.cpp:

(WebCore::WorkerMessagingProxy::postMessageToWorkerObject):
(WebCore::WorkerMessagingProxy::postMessageToWorkerGlobalScope):

  • workers/WorkerMessagingProxy.h:
  • workers/WorkerObjectProxy.h:
  • workers/service/context/ServiceWorkerThread.cpp:
Location:
trunk/Source/WebCore
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r223728 r223732  
     12017-10-19  Chris Dumez  <cdumez@apple.com>
     2
     3        SerializedScriptValue passed to postMessage() cannot be null
     4        https://bugs.webkit.org/show_bug.cgi?id=178550
     5
     6        Reviewed by Youenn Fablet.
     7
     8        SerializedScriptValue passed to postMessage() cannot be null. Therefore, we
     9        should use Ref<> type, not RefPtr<>.
     10
     11        * dom/MessagePortChannel.h:
     12        * dom/default/PlatformMessagePortChannel.cpp:
     13        (WebCore::MessagePortChannel::postMessageToRemote):
     14        * workers/WorkerGlobalScopeProxy.h:
     15        * workers/WorkerMessagingProxy.cpp:
     16        (WebCore::WorkerMessagingProxy::postMessageToWorkerObject):
     17        (WebCore::WorkerMessagingProxy::postMessageToWorkerGlobalScope):
     18        * workers/WorkerMessagingProxy.h:
     19        * workers/WorkerObjectProxy.h:
     20        * workers/service/context/ServiceWorkerThread.cpp:
     21
    1222017-10-19  Daniel Bates  <dabates@apple.com>
    223
  • trunk/Source/WebCore/dom/MessagePortChannel.h

    r212609 r223732  
    8383
    8484        // Sends a message and optional cloned port to the remote port.
    85         void postMessageToRemote(Ref<SerializedScriptValue>&&, std::unique_ptr<MessagePortChannelArray>);
     85        void postMessageToRemote(Ref<SerializedScriptValue>&&, std::unique_ptr<MessagePortChannelArray>&&);
    8686
    8787        // Extracts a message from the message queue for this port.
  • trunk/Source/WebCore/dom/default/PlatformMessagePortChannel.cpp

    r223728 r223732  
    8181}
    8282
    83 void MessagePortChannel::postMessageToRemote(Ref<SerializedScriptValue>&& message, std::unique_ptr<MessagePortChannelArray> channels)
     83void MessagePortChannel::postMessageToRemote(Ref<SerializedScriptValue>&& message, std::unique_ptr<MessagePortChannelArray>&& channels)
    8484{
    8585    LockHolder lock(m_channel->m_mutex);
  • trunk/Source/WebCore/workers/WorkerGlobalScopeProxy.h

    r223728 r223732  
    5353    virtual void startWorkerGlobalScope(const URL& scriptURL, const String& userAgent, const String& sourceCode, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, MonotonicTime timeOrigin, JSC::RuntimeFlags, PAL::SessionID) = 0;
    5454    virtual void terminateWorkerGlobalScope() = 0;
    55     virtual void postMessageToWorkerGlobalScope(RefPtr<SerializedScriptValue>&&, std::unique_ptr<MessagePortChannelArray>) = 0;
     55    virtual void postMessageToWorkerGlobalScope(Ref<SerializedScriptValue>&&, std::unique_ptr<MessagePortChannelArray>&&) = 0;
    5656    virtual bool hasPendingActivity() const = 0;
    5757    virtual void workerObjectDestroyed() = 0;
  • trunk/Source/WebCore/workers/WorkerMessagingProxy.cpp

    r220857 r223732  
    9595}
    9696
    97 void WorkerMessagingProxy::postMessageToWorkerObject(RefPtr<SerializedScriptValue>&& message, std::unique_ptr<MessagePortChannelArray> channels)
     97void WorkerMessagingProxy::postMessageToWorkerObject(Ref<SerializedScriptValue>&& message, std::unique_ptr<MessagePortChannelArray>&& channels)
    9898{
    9999    m_scriptExecutionContext->postTask([this, channels = WTFMove(channels), message = WTFMove(message)] (ScriptExecutionContext& context) mutable {
     
    107107}
    108108
    109 void WorkerMessagingProxy::postMessageToWorkerGlobalScope(RefPtr<SerializedScriptValue>&& message, std::unique_ptr<MessagePortChannelArray> channels)
     109void WorkerMessagingProxy::postMessageToWorkerGlobalScope(Ref<SerializedScriptValue>&& message, std::unique_ptr<MessagePortChannelArray>&& channels)
    110110{
    111111    if (m_askedToTerminate)
  • trunk/Source/WebCore/workers/WorkerMessagingProxy.h

    r220857 r223732  
    4848    void startWorkerGlobalScope(const URL& scriptURL, const String& userAgent, const String& sourceCode, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, MonotonicTime timeOrigin, JSC::RuntimeFlags, PAL::SessionID) final;
    4949    void terminateWorkerGlobalScope() final;
    50     void postMessageToWorkerGlobalScope(RefPtr<SerializedScriptValue>&&, std::unique_ptr<MessagePortChannelArray>) final;
     50    void postMessageToWorkerGlobalScope(Ref<SerializedScriptValue>&&, std::unique_ptr<MessagePortChannelArray>&&) final;
    5151    bool hasPendingActivity() const final;
    5252    void workerObjectDestroyed() final;
     
    5555    // Implementations of WorkerObjectProxy.
    5656    // (Only use these functions in the worker context thread.)
    57     void postMessageToWorkerObject(RefPtr<SerializedScriptValue>&&, std::unique_ptr<MessagePortChannelArray>) final;
     57    void postMessageToWorkerObject(Ref<SerializedScriptValue>&&, std::unique_ptr<MessagePortChannelArray>&&) final;
    5858    void postExceptionToWorkerObject(const String& errorMessage, int lineNumber, int columnNumber, const String& sourceURL) final;
    5959    void postMessageToPageInspector(const String&) final;
  • trunk/Source/WebCore/workers/WorkerObjectProxy.h

    r207546 r223732  
    4242    class WorkerObjectProxy : public WorkerReportingProxy {
    4343    public:
    44         virtual void postMessageToWorkerObject(RefPtr<SerializedScriptValue>&&, std::unique_ptr<MessagePortChannelArray>) = 0;
     44        virtual void postMessageToWorkerObject(Ref<SerializedScriptValue>&&, std::unique_ptr<MessagePortChannelArray>&&) = 0;
    4545
    4646        virtual void confirmMessageFromWorkerObject(bool hasPendingActivity) = 0;
  • trunk/Source/WebCore/workers/service/context/ServiceWorkerThread.cpp

    r223728 r223732  
    5656    void postMessageToPageInspector(const String&) final { };
    5757    void workerGlobalScopeDestroyed() final { };
    58     void postMessageToWorkerObject(RefPtr<SerializedScriptValue>&&, std::unique_ptr<MessagePortChannelArray>) final { };
     58    void postMessageToWorkerObject(Ref<SerializedScriptValue>&&, std::unique_ptr<MessagePortChannelArray>&&) final { };
    5959    void confirmMessageFromWorkerObject(bool) final { };
    6060    void reportPendingActivity(bool) final { };
Note: See TracChangeset for help on using the changeset viewer.