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

Side by Side Diff: Source/bindings/v8/V8Binding.cpp

Issue 21274004: Fix Document leak from NodeFilter. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: add TreeWalker leak test Created 7 years, 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009 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 19 matching lines...) Expand all
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "bindings/v8/V8Binding.h" 32 #include "bindings/v8/V8Binding.h"
33 33
34 #include "V8DOMStringList.h" 34 #include "V8DOMStringList.h"
35 #include "V8Element.h" 35 #include "V8Element.h"
36 #include "V8Window.h" 36 #include "V8Window.h"
37 #include "V8WorkerGlobalScope.h" 37 #include "V8WorkerGlobalScope.h"
38 #include "V8XPathNSResolver.h" 38 #include "V8XPathNSResolver.h"
39 #include "bindings/v8/ScriptController.h" 39 #include "bindings/v8/ScriptController.h"
40 #include "bindings/v8/V8NodeFilterCondition.h"
41 #include "bindings/v8/V8ObjectConstructor.h" 40 #include "bindings/v8/V8ObjectConstructor.h"
42 #include "bindings/v8/V8WindowShell.h" 41 #include "bindings/v8/V8WindowShell.h"
43 #include "bindings/v8/WorkerScriptController.h" 42 #include "bindings/v8/WorkerScriptController.h"
44 #include "bindings/v8/custom/V8CustomXPathNSResolver.h" 43 #include "bindings/v8/custom/V8CustomXPathNSResolver.h"
45 #include "core/dom/DOMStringList.h" 44 #include "core/dom/DOMStringList.h"
46 #include "core/dom/Element.h" 45 #include "core/dom/Element.h"
47 #include "core/dom/NodeFilter.h"
48 #include "core/dom/QualifiedName.h" 46 #include "core/dom/QualifiedName.h"
49 #include "core/inspector/BindingVisitors.h" 47 #include "core/inspector/BindingVisitors.h"
50 #include "core/loader/FrameLoader.h" 48 #include "core/loader/FrameLoader.h"
51 #include "core/loader/FrameLoaderClient.h" 49 #include "core/loader/FrameLoaderClient.h"
52 #include "core/page/Frame.h" 50 #include "core/page/Frame.h"
53 #include "core/page/Settings.h" 51 #include "core/page/Settings.h"
54 #include "core/workers/WorkerGlobalScope.h" 52 #include "core/workers/WorkerGlobalScope.h"
55 #include "core/xml/XPathNSResolver.h" 53 #include "core/xml/XPathNSResolver.h"
56 #include "wtf/ArrayBufferContents.h" 54 #include "wtf/ArrayBufferContents.h"
57 #include "wtf/MainThread.h" 55 #include "wtf/MainThread.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 133
136 Vector<v8::Handle<v8::Value> > toVectorOfArguments(const v8::FunctionCallbackInf o<v8::Value>& args) 134 Vector<v8::Handle<v8::Value> > toVectorOfArguments(const v8::FunctionCallbackInf o<v8::Value>& args)
137 { 135 {
138 Vector<v8::Handle<v8::Value> > result; 136 Vector<v8::Handle<v8::Value> > result;
139 size_t length = args.Length(); 137 size_t length = args.Length();
140 for (size_t i = 0; i < length; ++i) 138 for (size_t i = 0; i < length; ++i)
141 result.append(args[i]); 139 result.append(args[i]);
142 return result; 140 return result;
143 } 141 }
144 142
145 PassRefPtr<NodeFilter> toNodeFilter(v8::Handle<v8::Value> callback)
146 {
147 return NodeFilter::create(V8NodeFilterCondition::create(callback));
148 }
149
150 static const int8_t kMaxInt8 = 127; 143 static const int8_t kMaxInt8 = 127;
151 static const int8_t kMinInt8 = -128; 144 static const int8_t kMinInt8 = -128;
152 static const uint8_t kMaxUInt8 = 255; 145 static const uint8_t kMaxUInt8 = 255;
153 const int32_t kMaxInt32 = 0x7fffffff; 146 const int32_t kMaxInt32 = 0x7fffffff;
154 const int32_t kMinInt32 = -kMaxInt32 - 1; 147 const int32_t kMinInt32 = -kMaxInt32 - 1;
155 const uint32_t kMaxUInt32 = 0xffffffff; 148 const uint32_t kMaxUInt32 = 0xffffffff;
156 const int64_t kJSMaxInteger = 0x20000000000000LL - 1; // 2^53 - 1, maximum integ er exactly representable in ECMAScript. 149 const int64_t kJSMaxInteger = 0x20000000000000LL - 1; // 2^53 - 1, maximum integ er exactly representable in ECMAScript.
157 150
158 static double enforceRange(double x, double minimum, double maximum, bool& ok) 151 static double enforceRange(double x, double minimum, double maximum, bool& ok)
159 { 152 {
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 return DOMWrapperWorld::isolatedWorld(v8::Context::GetCurrent()); 545 return DOMWrapperWorld::isolatedWorld(v8::Context::GetCurrent());
553 } 546 }
554 547
555 v8::Local<v8::Value> getHiddenValueFromMainWorldWrapper(v8::Isolate* isolate, Sc riptWrappable* wrappable, v8::Handle<v8::String> key) 548 v8::Local<v8::Value> getHiddenValueFromMainWorldWrapper(v8::Isolate* isolate, Sc riptWrappable* wrappable, v8::Handle<v8::String> key)
556 { 549 {
557 v8::Local<v8::Object> wrapper = wrappable->newLocalWrapper(isolate); 550 v8::Local<v8::Object> wrapper = wrappable->newLocalWrapper(isolate);
558 return wrapper.IsEmpty() ? v8::Local<v8::Value>() : wrapper->GetHiddenValue( key); 551 return wrapper.IsEmpty() ? v8::Local<v8::Value>() : wrapper->GetHiddenValue( key);
559 } 552 }
560 553
561 } // namespace WebCore 554 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698