| Index: src/d8.cc
|
| diff --git a/src/d8.cc b/src/d8.cc
|
| index 9466ab7d3a727c2fe12d70ac977df0b0cac57f35..2f6f28bb1015932c96c588e47e6d86c13a0238b3 100644
|
| --- a/src/d8.cc
|
| +++ b/src/d8.cc
|
| @@ -548,6 +548,23 @@ void Shell::RealmCreate(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
| args.GetReturnValue().Set(index);
|
| }
|
|
|
| +// Realm.makeSameOrigin(i) sets the security token of i to that of the
|
| +// current realm.
|
| +void Shell::RealmMakeSameOrigin(
|
| + const v8::FunctionCallbackInfo<v8::Value>& args) {
|
| + Isolate* isolate = args.GetIsolate();
|
| + PerIsolateData* data = PerIsolateData::Get(isolate);
|
| + int index = data->RealmIndexOrThrow(args, 0);
|
| + if (index == -1) return;
|
| + if (index == 0 || index == data->realm_current_ ||
|
| + index == data->realm_switch_) {
|
| + Throw(args.GetIsolate(), "Invalid realm index");
|
| + return;
|
| + }
|
| +
|
| + data->realms_[index].Get(isolate)->SetSecurityToken(
|
| + isolate->GetEnteredContext()->GetSecurityToken());
|
| +}
|
|
|
| // Realm.dispose(i) disposes the reference to the realm i.
|
| void Shell::RealmDispose(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
| @@ -1136,6 +1153,10 @@ Local<ObjectTemplate> Shell::CreateGlobalTemplate(Isolate* isolate) {
|
| .ToLocalChecked(),
|
| FunctionTemplate::New(isolate, RealmCreate));
|
| realm_template->Set(
|
| + String::NewFromUtf8(isolate, "makeSameOrigin", NewStringType::kNormal)
|
| + .ToLocalChecked(),
|
| + FunctionTemplate::New(isolate, RealmMakeSameOrigin));
|
| + realm_template->Set(
|
| String::NewFromUtf8(isolate, "dispose", NewStringType::kNormal)
|
| .ToLocalChecked(),
|
| FunctionTemplate::New(isolate, RealmDispose));
|
|
|