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

Unified Diff: Source/bindings/core/v8/V8NodeFilterCondition.cpp

Issue 932633002: Call NodeFilter.acceptNode() with correct this value (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/fast/dom/TreeWalker/script-tests/acceptNode-filter.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/core/v8/V8NodeFilterCondition.cpp
diff --git a/Source/bindings/core/v8/V8NodeFilterCondition.cpp b/Source/bindings/core/v8/V8NodeFilterCondition.cpp
index f66b5ac0f48a4979e86d542880502816994cba65..f530be4d87a1f8f927ccd82902b3c3346dac1566 100644
--- a/Source/bindings/core/v8/V8NodeFilterCondition.cpp
+++ b/Source/bindings/core/v8/V8NodeFilterCondition.cpp
@@ -71,8 +71,10 @@ short V8NodeFilterCondition::acceptNode(Node* node, ExceptionState& exceptionSta
v8::TryCatch exceptionCatcher;
v8::Handle<v8::Function> callback;
+ v8::Handle<v8::Value> receiver;
if (filter->IsFunction()) {
callback = v8::Handle<v8::Function>::Cast(filter);
+ receiver = v8::Undefined(isolate);
} else {
v8::Local<v8::Value> value = filter->ToObject(isolate)->Get(v8AtomicString(isolate, "acceptNode"));
if (value.IsEmpty() || !value->IsFunction()) {
@@ -80,13 +82,13 @@ short V8NodeFilterCondition::acceptNode(Node* node, ExceptionState& exceptionSta
return NodeFilter::FILTER_REJECT;
}
callback = v8::Handle<v8::Function>::Cast(value);
+ receiver = filter;
}
OwnPtr<v8::Handle<v8::Value>[]> info = adoptArrayPtr(new v8::Handle<v8::Value>[1]);
- v8::Handle<v8::Object> context = m_scriptState->context()->Global();
- info[0] = toV8(node, context, isolate);
+ info[0] = toV8(node, m_scriptState->context()->Global(), isolate);
- v8::Handle<v8::Value> result = ScriptController::callFunction(m_scriptState->executionContext(), callback, context, 1, info.get(), isolate);
+ v8::Handle<v8::Value> result = ScriptController::callFunction(m_scriptState->executionContext(), callback, receiver, 1, info.get(), isolate);
if (exceptionCatcher.HasCaught()) {
exceptionState.rethrowV8Exception(exceptionCatcher.Exception());
« no previous file with comments | « LayoutTests/fast/dom/TreeWalker/script-tests/acceptNode-filter.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698