Index: trunk/Source/core/frame/LocalDOMWindow.cpp |
=================================================================== |
--- trunk/Source/core/frame/LocalDOMWindow.cpp (revision 181866) |
+++ trunk/Source/core/frame/LocalDOMWindow.cpp (working copy) |
@@ -556,14 +556,22 @@ |
void LocalDOMWindow::willDestroyDocumentInFrame() |
{ |
- for (WillBeHeapHashSet<RawPtrWillBeMember<DOMWindowProperty> >::const_iterator it = m_properties.begin(); it != m_properties.end(); ++it) |
- (*it)->willDestroyGlobalObjectInFrame(); |
+ // It is necessary to copy m_properties to a separate vector because the DOMWindowProperties may |
+ // unregister themselves from the LocalDOMWindow as a result of the call to willDestroyGlobalObjectInFrame. |
+ WillBeHeapVector<RawPtrWillBeMember<DOMWindowProperty> > properties; |
+ copyToVector(m_properties, properties); |
+ for (size_t i = 0; i < properties.size(); ++i) |
+ properties[i]->willDestroyGlobalObjectInFrame(); |
} |
void LocalDOMWindow::willDetachDocumentFromFrame() |
{ |
- for (WillBeHeapHashSet<RawPtrWillBeMember<DOMWindowProperty> >::const_iterator it = m_properties.begin(); it != m_properties.end(); ++it) |
- (*it)->willDetachGlobalObjectFromFrame(); |
+ // It is necessary to copy m_properties to a separate vector because the DOMWindowProperties may |
+ // unregister themselves from the LocalDOMWindow as a result of the call to willDetachGlobalObjectFromFrame. |
+ WillBeHeapVector<RawPtrWillBeMember<DOMWindowProperty> > properties; |
+ copyToVector(m_properties, properties); |
+ for (size_t i = 0; i < properties.size(); ++i) |
+ properties[i]->willDetachGlobalObjectFromFrame(); |
} |
void LocalDOMWindow::registerProperty(DOMWindowProperty* property) |
@@ -571,6 +579,11 @@ |
m_properties.add(property); |
} |
+void LocalDOMWindow::unregisterProperty(DOMWindowProperty* property) |
+{ |
+ m_properties.remove(property); |
+} |
+ |
void LocalDOMWindow::reset() |
{ |
willDestroyDocumentInFrame(); |