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

Unified Diff: Source/WebCore/bindings/v8/custom/V8MessageEventCustom.cpp

Issue 8041034: Merge 95689 - [Chromium] Protect message ports from being deleted in V8MessageEvent::portsAccesso... (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/835/
Patch Set: Created 9 years, 3 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/message-port-deleted-by-accessor-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/bindings/v8/custom/V8MessageEventCustom.cpp
===================================================================
--- Source/WebCore/bindings/v8/custom/V8MessageEventCustom.cpp (revision 95974)
+++ Source/WebCore/bindings/v8/custom/V8MessageEventCustom.cpp (working copy)
@@ -50,10 +50,12 @@
MessagePortArray* ports = event->ports();
if (!ports || ports->isEmpty())
return v8::Null();
+
+ MessagePortArray portsCopy(*ports);
- v8::Local<v8::Array> portArray = v8::Array::New(ports->size());
- for (size_t i = 0; i < ports->size(); ++i)
- portArray->Set(v8::Integer::New(i), toV8((*ports)[i].get()));
+ v8::Local<v8::Array> portArray = v8::Array::New(portsCopy.size());
+ for (size_t i = 0; i < portsCopy.size(); ++i)
+ portArray->Set(v8::Integer::New(i), toV8(portsCopy[i].get()));
return portArray;
}
« no previous file with comments | « LayoutTests/fast/dom/message-port-deleted-by-accessor-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698