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

Unified Diff: Source/bindings/v8/V8Binding.cpp

Issue 21274004: Fix Document leak from NodeFilter. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: don't print numberOfLiveDocuments when test passed Created 7 years, 5 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 | « Source/bindings/v8/V8Binding.h ('k') | Source/bindings/v8/V8HiddenPropertyName.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/v8/V8Binding.cpp
diff --git a/Source/bindings/v8/V8Binding.cpp b/Source/bindings/v8/V8Binding.cpp
index fcbc7de2cffce3ba2c561474ac4439650055e12c..2aca7c58e5714cf3419485b8710f24f18e9cf887 100644
--- a/Source/bindings/v8/V8Binding.cpp
+++ b/Source/bindings/v8/V8Binding.cpp
@@ -33,6 +33,7 @@
#include "V8DOMStringList.h"
#include "V8Element.h"
+#include "V8NodeFilter.h"
#include "V8Window.h"
#include "V8WorkerGlobalScope.h"
#include "V8XPathNSResolver.h"
@@ -142,9 +143,17 @@ Vector<v8::Handle<v8::Value> > toVectorOfArguments(const v8::FunctionCallbackInf
return result;
}
-PassRefPtr<NodeFilter> toNodeFilter(v8::Handle<v8::Value> callback)
+PassRefPtr<NodeFilter> toNodeFilter(v8::Handle<v8::Value> callback, v8::Isolate* isolate)
{
- return NodeFilter::create(V8NodeFilterCondition::create(callback));
+ RefPtr<NodeFilter> filter = NodeFilter::create();
+
+ // FIXME: Should pass in appropriate creationContext
+ v8::Handle<v8::Object> filterWrapper = toV8(filter.get(), v8::Handle<v8::Object>(), isolate).As<v8::Object>();
+
+ RefPtr<NodeFilterCondition> condition = V8NodeFilterCondition::create(callback, filterWrapper);
+ filter->setCondition(condition.release());
+
+ return filter.release();
}
static const int8_t kMaxInt8 = 127;
« no previous file with comments | « Source/bindings/v8/V8Binding.h ('k') | Source/bindings/v8/V8HiddenPropertyName.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698