Commit 6a42f35f authored by Yuki Yamada's avatar Yuki Yamada Committed by Commit Bot

Change scope according to passed |creation_context|

Current implementation of DOMArrayBuffer::Wrap() returns a object that
is created in current realm because v8::ArrayBuffer::New() does not
receive |creation_context|, the relevant realm.
(current realm is used here: https://cs.chromium.org/chromium/src/v8/src/heap/factory.cc?sq=package:chromium&g=0&l=3056)
We have to create event in the relevant realm of event's target in
accord with DOM standard: https://dom.spec.whatwg.org/#firing-events
This CL set appropriate realm on creating wrapper.

A test for this already exists:
https://cs.chromium.org/chromium/src/third_party/WebKit/LayoutTests/external/wpt/websockets/multi-globals/message-received.html

Change-Id: Ie225d9e45a0e78fcdbb7d86d04674531f9c745ac
Reviewed-on: https://chromium-review.googlesource.com/1182913
Commit-Queue: Yuki Yamada <yukiy@google.com>
Reviewed-by: default avatarYuki Shiino <yukishiino@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarHitoshi Yoshida <peria@chromium.org>
Cr-Commit-Position: refs/heads/master@{#584667}
parent 0fb00ffa
......@@ -75,8 +75,12 @@ v8::Local<v8::Object> DOMArrayBuffer::Wrap(
DCHECK(!DOMDataStore::ContainsWrapper(this, isolate));
const WrapperTypeInfo* wrapper_type_info = this->GetWrapperTypeInfo();
v8::Local<v8::Object> wrapper =
v8::ArrayBuffer::New(isolate, Data(), ByteLength());
v8::Local<v8::Object> wrapper;
{
v8::Context::Scope context_scope(creation_context->CreationContext());
wrapper = v8::ArrayBuffer::New(isolate, Data(), ByteLength());
}
return AssociateWithWrapper(isolate, wrapper_type_info, wrapper);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment