⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 271239 in webkit


Ignore:
Timestamp:
Jan 7, 2021, 9:23:23 AM (6 years ago)
Author:
commit-queue@webkit.org
Message:

Null check global object in Blob::stream
https://bugs.webkit.org/show_bug.cgi?id=220393
<rdar://problem/71626701>

Patch by Alex Christensen <achristensen@webkit.org> on 2021-01-07
Reviewed by Chris Dumez.

Source/WebCore:

Sometimes during a frame teardown we could dereference null.
Attached a test that hit it about 10% of the time for me in WebKitTestRunner before this change.

Test: fast/files/blob-stream-crash.html

  • fileapi/Blob.cpp:

(WebCore::Blob::stream):

LayoutTests:

  • fast/files/blob-stream-crash-expected.txt: Added.
  • fast/files/blob-stream-crash.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r271235 r271239  
     12021-01-07  Alex Christensen  <achristensen@webkit.org>
     2
     3        Null check global object in Blob::stream
     4        https://bugs.webkit.org/show_bug.cgi?id=220393
     5        <rdar://problem/71626701>
     6
     7        Reviewed by Chris Dumez.
     8
     9        * fast/files/blob-stream-crash-expected.txt: Added.
     10        * fast/files/blob-stream-crash.html: Added.
     11
    1122021-01-07  Lauro Moura  <lmoura@igalia.com>
    213
  • trunk/Source/WebCore/ChangeLog

    r271235 r271239  
     12021-01-07  Alex Christensen  <achristensen@webkit.org>
     2
     3        Null check global object in Blob::stream
     4        https://bugs.webkit.org/show_bug.cgi?id=220393
     5        <rdar://problem/71626701>
     6
     7        Reviewed by Chris Dumez.
     8
     9        Sometimes during a frame teardown we could dereference null.
     10        Attached a test that hit it about 10% of the time for me in WebKitTestRunner before this change.
     11
     12        Test: fast/files/blob-stream-crash.html
     13
     14        * fileapi/Blob.cpp:
     15        (WebCore::Blob::stream):
     16
    1172021-01-07  Lauro Moura  <lmoura@igalia.com>
    218
  • trunk/Source/WebCore/fileapi/Blob.cpp

    r268700 r271239  
    278278    };
    279279
    280     return ReadableStream::create(*scriptExecutionContext.globalObject(), adoptRef(*new BlobStreamSource(scriptExecutionContext, *this)));
     280    auto* globalObject = scriptExecutionContext.globalObject();
     281    if (!globalObject)
     282        return Exception { InvalidStateError };
     283    return ReadableStream::create(*globalObject, adoptRef(*new BlobStreamSource(scriptExecutionContext, *this)));
    281284}
    282285
Note: See TracChangeset for help on using the changeset viewer.