Changeset 86206 in webkit


Ignore:
Timestamp:
May 10, 2011 7:11:56 PM (13 years ago)
Author:
oliver@apple.com
Message:

2011-05-10 Oliver Hunt <oliver@apple.com>

Reviewed by Geoffrey Garen.

Assertion failure in JSC::Structure::typeInfo when reloading weather.com video page
https://bugs.webkit.org/show_bug.cgi?id=60580

The plugin object map was incorrect trying to implement a weak map itself using
destructors. Switch to a WeakGCMap and the problem is fixed.

  • WebProcess/Plugins/Netscape/JSNPObject.cpp: (WebKit::JSNPObject::~JSNPObject):
  • WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp: (WebKit::NPRuntimeObjectMap::getOrCreateJSObject): (WebKit::NPRuntimeObjectMap::invalidate):
  • WebProcess/Plugins/Netscape/NPRuntimeObjectMap.h:
Location:
trunk/Source/WebKit2
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r86198 r86206  
     12011-05-10  Oliver Hunt  <oliver@apple.com>
     2
     3        Reviewed by Geoffrey Garen.
     4
     5        Assertion failure in JSC::Structure::typeInfo when reloading weather.com video page
     6        https://bugs.webkit.org/show_bug.cgi?id=60580
     7
     8        The plugin object map was incorrect trying to implement a weak map itself using
     9        destructors.  Switch to a WeakGCMap and the problem is fixed.
     10
     11        * WebProcess/Plugins/Netscape/JSNPObject.cpp:
     12        (WebKit::JSNPObject::~JSNPObject):
     13        * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp:
     14        (WebKit::NPRuntimeObjectMap::getOrCreateJSObject):
     15        (WebKit::NPRuntimeObjectMap::invalidate):
     16        * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.h:
     17
    1182011-05-10  Sam Weinig  <sam@webkit.org>
    219
  • trunk/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPObject.cpp

    r81272 r86206  
    6767    if (!m_npObject)
    6868        return;
    69 
    70     m_objectMap->jsNPObjectDestroyed(this);
    7169    releaseNPObject(m_npObject);
    7270}
  • trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp

    r83390 r86206  
    100100
    101101    JSNPObject* jsNPObject = new (&globalObject->globalData()) JSNPObject(globalObject, this, npObject);
    102     m_jsNPObjects.set(npObject, jsNPObject);
     102    m_jsNPObjects.set(globalObject->globalData(), npObject, jsNPObject);
    103103
    104104    return jsNPObject;
    105 }
    106 
    107 void NPRuntimeObjectMap::jsNPObjectDestroyed(JSNPObject* jsNPObject)
    108 {
    109     // Remove the object from the map.
    110     ASSERT(m_jsNPObjects.contains(jsNPObject->npObject()));
    111     m_jsNPObjects.remove(jsNPObject->npObject());
    112105}
    113106
     
    225218    ASSERT(m_npJSObjects.isEmpty());
    226219
    227     Vector<JSNPObject*> jsNPObjects;
    228     copyValuesToVector(m_jsNPObjects, jsNPObjects);
    229 
    230     // Invalidate all the JSObjects that wrap NPObjects.
    231     for (size_t i = 0; i < jsNPObjects.size(); ++i)
    232         jsNPObjects[i]->invalidate();
    233 
     220    WeakGCMap<NPObject*, JSNPObject>::iterator end = m_jsNPObjects.end();
     221    for (WeakGCMap<NPObject*, JSNPObject>::iterator ptr = m_jsNPObjects.begin(); ptr != end; ++ptr)
     222        ptr.get().second->invalidate();
    234223    m_jsNPObjects.clear();
    235224}
  • trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.h

    r78634 r86206  
    2727#define NPJSObjectWrapperMap_h
    2828
     29#include <JavaScriptCore/WeakGCMap.h>
    2930#include <wtf/Forward.h>
    3031#include <wtf/HashMap.h>
     
    8889
    8990    HashMap<JSC::JSObject*, NPJSObject*> m_npJSObjects;
    90     HashMap<NPObject*, JSNPObject*> m_jsNPObjects;
     91    JSC::WeakGCMap<NPObject*, JSNPObject> m_jsNPObjects;
    9192};
    9293
Note: See TracChangeset for help on using the changeset viewer.