qtwebkit: add patch to fix indexed access to npapi created objects (pseudo arrays)
[opendreambox.git] / meta-opendreambox / recipes-qt / qt5 / qtwebkit-git / 0007-Fix-Index-Accessor-For-RuntimeObject.patch
1 diff --git a/Source/WebCore/bridge/runtime_object.cpp b/Source/WebCore/bridge/runtime_object.cpp
2 index d28a8f7..386228b 100644
3 --- a/Source/WebCore/bridge/runtime_object.cpp
4 +++ b/Source/WebCore/bridge/runtime_object.cpp
5 @@ -237,6 +237,23 @@ bool RuntimeObject::deleteProperty(JSCell*, ExecState*, PropertyName)
6      return false;
7  }
8  
9 +bool RuntimeObject::getOwnPropertySlotByIndex(JSCell* cell, ExecState *exec, unsigned index, PropertySlot& slot)
10 +{
11 +    if(getOwnPropertySlot(cell, exec, Identifier::from(exec, index), slot));
12 +        return true;
13 +    return JSDestructibleObject::getOwnPropertySlotByIndex(cell, exec, index, slot);
14 +}
15 +
16 +void RuntimeObject::putByIndex(JSCell* cell, ExecState* exec, unsigned index, JSValue value, bool shouldThrow)
17 +{
18 +    JSDestructibleObject::putByIndex(cell, exec, index, value, shouldThrow);
19 +}
20 +
21 +bool RuntimeObject::deletePropertyByIndex(JSCell* cell, ExecState* exec, unsigned index)
22 +{
23 +    return false;
24 +}
25 +
26  JSValue RuntimeObject::defaultValue(const JSObject* object, ExecState* exec, PreferredPrimitiveType hint)
27  {
28      const RuntimeObject* thisObject = jsCast<const RuntimeObject*>(object);
29 diff --git a/Source/WebCore/bridge/runtime_object.h b/Source/WebCore/bridge/runtime_object.h
30 index 15cda65..956086f 100644
31 --- a/Source/WebCore/bridge/runtime_object.h
32 +++ b/Source/WebCore/bridge/runtime_object.h
33 @@ -49,6 +49,9 @@ public:
34      static bool getOwnPropertyDescriptor(JSObject*, ExecState*, PropertyName, PropertyDescriptor&);
35      static void put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&);
36      static bool deleteProperty(JSCell*, ExecState*, PropertyName);
37 +    static bool getOwnPropertySlotByIndex(JSCell*, ExecState*, unsigned, PropertySlot&);
38 +    static void putByIndex(JSCell*, ExecState*, unsigned propertyName, JSValue, bool shouldThrow);
39 +    static bool deletePropertyByIndex(JSCell*, ExecState*, unsigned propertyName);
40      static JSValue defaultValue(const JSObject*, ExecState*, PreferredPrimitiveType);
41      static CallType getCallData(JSCell*, CallData&);
42      static ConstructType getConstructData(JSCell*, ConstructData&);
43 @@ -76,7 +79,7 @@ public:
44  protected:
45      RuntimeObject(ExecState*, JSGlobalObject*, Structure*, PassRefPtr<Instance>);
46      void finishCreation(JSGlobalObject*);
47 -    static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesGetPropertyNames | Base::StructureFlags;
48 +    static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesGetPropertyNames | InterceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero | Base::StructureFlags;
49  
50  private:
51      static JSValue fallbackObjectGetter(ExecState*, JSValue, PropertyName);