Bug 209121 - [JSC] Rename ArrayBuffer::slice to ArrayBuffer::trySlice and insert appropriate checks
Summary: [JSC] Rename ArrayBuffer::slice to ArrayBuffer::trySlice and insert appropria...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Yusuke Suzuki
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-03-15 04:27 PDT by Yusuke Suzuki
Modified: 2020-03-15 12:21 PDT (History)
11 users (show)

See Also:


Attachments
Patch (13.31 KB, patch)
2020-03-15 04:28 PDT, Yusuke Suzuki
mark.lam: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yusuke Suzuki 2020-03-15 04:27:44 PDT
[JSC] Rename ArrayBuffer::slice to ArrayBuffer::trySlice and insert appropriate checks
Comment 1 Yusuke Suzuki 2020-03-15 04:28:50 PDT
Created attachment 393614 [details]
Patch
Comment 2 Mark Lam 2020-03-15 12:21:08 PDT
Comment on attachment 393614 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=393614&action=review

r=me with fix.

> Source/WebCore/bindings/js/StructuredClone.cpp:62
> +            return JSValue::encode(JSC::throwOutOfMemoryError(globalObject, scope));

/globalObject/lexicalGlobalObject/

> Source/WebCore/bindings/js/StructuredClone.cpp:63
> +        return JSValue::encode(JSArrayBuffer::create(lexicalGlobalObject->vm(), lexicalGlobalObject->arrayBufferStructure(ArrayBufferSharingMode::Default), WTFMove(slicedBuffer)));

Not due to your change, but can you jut use vm here instead of lexicalGlobalObject->vm()?  We've already pre-computed it above.