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

Unified Diff: Source/bindings/v8/custom/V8NodeIteratorCustom.cpp

Issue 21274004: Fix Document leak from NodeFilter. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: add assertions to wrap 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
Index: Source/bindings/v8/custom/V8NodeIteratorCustom.cpp
diff --git a/Source/bindings/v8/custom/V8NodeIteratorCustom.cpp b/Source/bindings/v8/custom/V8NodeIteratorCustom.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..5fd84042ccf189bc3fdaa4bda7078673fb9799b7
--- /dev/null
+++ b/Source/bindings/v8/custom/V8NodeIteratorCustom.cpp
@@ -0,0 +1,28 @@
+#include "config.h"
haraken 2013/08/01 13:32:20 Please add a copyright.
kouhei (in TOK) 2013/08/02 03:26:57 Done.
+#include "V8NodeIterator.h"
+
+#include "V8NodeFilter.h"
haraken 2013/08/01 13:32:20 This is not needed.
kouhei (in TOK) 2013/08/02 03:26:57 Won't compile without this file.
+#include "bindings/v8/V8Binding.h"
+#include "bindings/v8/V8HiddenPropertyName.h"
+#include "bindings/v8/V8Utilities.h"
haraken 2013/08/01 13:32:20 This wouldn't be needed. Please be careful not to
kouhei (in TOK) 2013/08/02 03:26:57 Done.
+#include "core/dom/Node.h"
haraken 2013/08/01 13:32:20 Ditto.
kouhei (in TOK) 2013/08/02 03:26:57 Won't compile without this file.
+#include "core/dom/NodeIterator.h"
haraken 2013/08/01 13:32:20 Ditto.
kouhei (in TOK) 2013/08/02 03:26:57 Done.
+
+#include "wtf/RefPtr.h"
haraken 2013/08/01 13:32:20 Ditto.
kouhei (in TOK) 2013/08/02 03:26:57 Done.
kouhei (in TOK) 2013/08/02 03:26:57 Done.
+
+namespace WebCore {
+
+v8::Handle<v8::Object> wrap(NodeIterator* nodeIterator, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
+{
+ ASSERT(nodeIterator);
+ ASSERT(DOMDataStore::getWrapper<V8NodeIterator>(nodeIterator, isolate).IsEmpty());
+
+ v8::Handle<v8::Object> wrapper = V8NodeIterator::createWrapper(nodeIterator, creationContext, isolate);
+
+ if (nodeIterator->filter())
+ V8HiddenPropertyName::setNamedHiddenReference(wrapper, "filter", toV8(nodeIterator->filter(), creationContext, isolate));
+
+ return wrapper;
+}
+
+} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698