Commit a9eab1ea authored by Ross McIlroy's avatar Ross McIlroy Committed by Commit Bot

Avoid accessing context when generating NativeFunctionTemplate in SafeBuiltins.

The V8 context shouldn't be accessed when generating context independent code.
Convert some string equality operations which require a context to the StringEquals
function which does not.

BUG=chromium:898076

Change-Id: Ia9a01b27fa9fcfc0c19268a3c862f2174eda7e1d
Reviewed-on: https://chromium-review.googlesource.com/c/1301459Reviewed-by: default avatarJochen Eisinger <jochen@chromium.org>
Commit-Queue: Ross McIlroy <rmcilroy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#603061}
parent d240484b
...@@ -162,10 +162,9 @@ class ExtensionImpl : public v8::Extension { ...@@ -162,10 +162,9 @@ class ExtensionImpl : public v8::Extension {
v8::Local<v8::FunctionTemplate> GetNativeFunctionTemplate( v8::Local<v8::FunctionTemplate> GetNativeFunctionTemplate(
v8::Isolate* isolate, v8::Isolate* isolate,
v8::Local<v8::String> name) override { v8::Local<v8::String> name) override {
v8::Local<v8::Context> context = isolate->GetCurrentContext(); if (name->StringEquals(ToV8StringUnsafe(isolate, "Apply")))
if (IsTrue(name->Equals(context, ToV8StringUnsafe(isolate, "Apply"))))
return v8::FunctionTemplate::New(isolate, Apply); return v8::FunctionTemplate::New(isolate, Apply);
if (IsTrue(name->Equals(context, ToV8StringUnsafe(isolate, "Save")))) if (name->StringEquals(ToV8StringUnsafe(isolate, "Save")))
return v8::FunctionTemplate::New(isolate, Save); return v8::FunctionTemplate::New(isolate, Save);
NOTREACHED() << *v8::String::Utf8Value(isolate, name); NOTREACHED() << *v8::String::Utf8Value(isolate, name);
return v8::Local<v8::FunctionTemplate>(); return v8::Local<v8::FunctionTemplate>();
......
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