Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(173)

Unified Diff: third_party/WebKit/Source/bindings/core/v8/PrivateScriptRunner.cpp

Issue 2529163002: Don't touch the prototype chain to get the private script controller. (Closed)
Patch Set: v8CallBoolean removed. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/bindings/core/v8/PrivateScriptRunner.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/PrivateScriptRunner.cpp b/third_party/WebKit/Source/bindings/core/v8/PrivateScriptRunner.cpp
index 77b88f46afa5d47ffc73ea9549231bf1216244de..08b18f9db1b37e088b0a12b3c360e2c279b9a84a 100644
--- a/third_party/WebKit/Source/bindings/core/v8/PrivateScriptRunner.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/PrivateScriptRunner.cpp
@@ -57,12 +57,12 @@ static v8::Local<v8::Value> compileAndRunPrivateScript(ScriptState* scriptState,
v8::Local<v8::Context> context = scriptState->context();
v8::Local<v8::Object> global = context->Global();
- v8::Local<v8::Value> privateScriptController =
- global->Get(context, v8String(isolate, "privateScriptController"))
- .ToLocalChecked();
- RELEASE_ASSERT(privateScriptController->IsUndefined() ||
- privateScriptController->IsObject());
- if (privateScriptController->IsObject()) {
+ v8::Local<v8::String> key = v8String(isolate, "privateScriptController");
+
+ if (global->HasOwnProperty(context, key).FromMaybe(false)) {
Yuki 2016/11/28 08:01:29 Could you use FromJust() instead? When FromMaybe(
haraken 2016/11/28 08:04:57 We should use ToChecked() :) The plan is to deprec
Mariusz Mlynski 2016/11/28 08:18:20 Done.
+ v8::Local<v8::Value> privateScriptController =
+ global->Get(context, key).ToLocalChecked();
+ CHECK(privateScriptController->IsObject());
v8::Local<v8::Object> privateScriptControllerObject =
privateScriptController.As<v8::Object>();
v8::Local<v8::Value> importFunctionValue =

Powered by Google App Engine
This is Rietveld 408576698