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

Side by Side Diff: Source/bindings/v8/custom/V8InjectedScriptHostCustom.cpp

Issue 303363002: Fix toV8 and ExceptionState with empty context. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/bindings/v8/V8WindowShell.cpp ('k') | Source/bindings/v8/custom/V8WindowCustom.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007-2011 Google Inc. All rights reserved. 2 * Copyright (C) 2007-2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 return V8Node::toNative(v8::Handle<v8::Object>::Cast(value.v8Value())); 72 return V8Node::toNative(v8::Handle<v8::Object>::Cast(value.v8Value()));
73 } 73 }
74 74
75 ScriptValue InjectedScriptHost::nodeAsScriptValue(ScriptState* scriptState, Node * node) 75 ScriptValue InjectedScriptHost::nodeAsScriptValue(ScriptState* scriptState, Node * node)
76 { 76 {
77 v8::Isolate* isolate = scriptState->isolate(); 77 v8::Isolate* isolate = scriptState->isolate();
78 v8::HandleScope scope(isolate); 78 v8::HandleScope scope(isolate);
79 v8::Local<v8::Context> context = scriptState->context(); 79 v8::Local<v8::Context> context = scriptState->context();
80 v8::Context::Scope contextScope(context); 80 v8::Context::Scope contextScope(context);
81 81
82 ExceptionState exceptionState(ExceptionState::ExecutionContext, "nodeAsScrip tValue", "InjectedScriptHost", v8::Handle<v8::Object>(), isolate); 82 ExceptionState exceptionState(ExceptionState::ExecutionContext, "nodeAsScrip tValue", "InjectedScriptHost", context->Global(), isolate);
83 if (!BindingSecurity::shouldAllowAccessToNode(isolate, node, exceptionState) ) 83 if (!BindingSecurity::shouldAllowAccessToNode(isolate, node, exceptionState) )
84 return ScriptValue(scriptState, v8::Null(isolate)); 84 return ScriptValue(scriptState, v8::Null(isolate));
85 return ScriptValue(scriptState, toV8(node, v8::Handle<v8::Object>(), isolate )); 85 return ScriptValue(scriptState, toV8(node, context->Global(), isolate));
86 } 86 }
87 87
88 void V8InjectedScriptHost::inspectedObjectMethodCustom(const v8::FunctionCallbac kInfo<v8::Value>& info) 88 void V8InjectedScriptHost::inspectedObjectMethodCustom(const v8::FunctionCallbac kInfo<v8::Value>& info)
89 { 89 {
90 if (info.Length() < 1) 90 if (info.Length() < 1)
91 return; 91 return;
92 92
93 if (!info[0]->IsInt32()) { 93 if (!info[0]->IsInt32()) {
94 throwTypeError("argument has to be an integer", info.GetIsolate()); 94 throwTypeError("argument has to be an integer", info.GetIsolate());
95 return; 95 return;
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 OwnPtr<v8::Handle<v8::Value>[]> argv = adoptArrayPtr(new v8::Handle<v8::Valu e>[argc]); 441 OwnPtr<v8::Handle<v8::Value>[]> argv = adoptArrayPtr(new v8::Handle<v8::Valu e>[argc]);
442 for (size_t i = 0; i < argc; ++i) 442 for (size_t i = 0; i < argc; ++i)
443 argv[i] = info[i + 2]; 443 argv[i] = info[i + 2];
444 444
445 v8::Local<v8::Value> result = function->Call(receiver, argc, argv.get()); 445 v8::Local<v8::Value> result = function->Call(receiver, argc, argv.get());
446 debugServer.unmuteWarningsAndDeprecations(); 446 debugServer.unmuteWarningsAndDeprecations();
447 v8SetReturnValue(info, result); 447 v8SetReturnValue(info, result);
448 } 448 }
449 449
450 } // namespace WebCore 450 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/V8WindowShell.cpp ('k') | Source/bindings/v8/custom/V8WindowCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698