Diff
Modified: branches/safari-534.52-branch/Source/WebKit2/ChangeLog (98478 => 98479)
--- branches/safari-534.52-branch/Source/WebKit2/ChangeLog 2011-10-26 14:44:44 UTC (rev 98478)
+++ branches/safari-534.52-branch/Source/WebKit2/ChangeLog 2011-10-26 14:50:41 UTC (rev 98479)
@@ -1,5 +1,31 @@
2011-10-26 Lucas Forschler <lforsch...@apple.com>
+ Merge 93720
+
+ 2011-08-24 Oliver Hunt <oli...@apple.com>
+
+ JSNPObject and JSNPMethod create their structure in their constructors
+ https://bugs.webkit.org/show_bug.cgi?id=66879
+
+ Reviewed by Anders Carlsson.
+
+ It's not safe to create the Structure for an object inside its constructor
+ so we hoist construction out into their ::create methods and move the methods
+ into the cpp file.
+
+ * WebProcess/Plugins/Netscape/JSNPMethod.cpp:
+ (WebKit::JSNPMethod::JSNPMethod):
+ (WebKit::JSNPMethod::create):
+ * WebProcess/Plugins/Netscape/JSNPMethod.h:
+ (WebKit::JSNPMethod::create):
+ * WebProcess/Plugins/Netscape/JSNPObject.cpp:
+ (WebKit::JSNPObject::JSNPObject):
+ (WebKit::JSNPObject::create):
+ * WebProcess/Plugins/Netscape/JSNPObject.h:
+ (WebKit::JSNPObject::create):
+
+2011-10-26 Lucas Forschler <lforsch...@apple.com>
+
Merge 98153
2011-10-21 Alexey Proskuryakov <a...@apple.com>
Modified: branches/safari-534.52-branch/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPMethod.cpp (98478 => 98479)
--- branches/safari-534.52-branch/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPMethod.cpp 2011-10-26 14:44:44 UTC (rev 98478)
+++ branches/safari-534.52-branch/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPMethod.cpp 2011-10-26 14:50:41 UTC (rev 98479)
@@ -41,13 +41,19 @@
const ClassInfo JSNPMethod::s_info = { "NPMethod", &InternalFunction::s_info, 0, 0 };
-JSNPMethod::JSNPMethod(ExecState* exec, JSGlobalObject* globalObject, const Identifier& name, NPIdentifier npIdentifier)
- : InternalFunction(&exec->globalData(), globalObject, createStructure(exec->globalData(), globalObject->functionPrototype()), name)
+JSNPMethod::JSNPMethod(ExecState* exec, JSGlobalObject* globalObject, const Identifier& name, NPIdentifier npIdentifier, Structure* structure)
+ : InternalFunction(&exec->globalData(), globalObject, structure, name)
, m_npIdentifier(npIdentifier)
{
ASSERT(inherits(&s_info));
}
+JSNPMethod* JSNPMethod::create(ExecState* exec, JSGlobalObject* globalObject, const Identifier& ident, NPIdentifier npIdent)
+{
+ JSC::Structure* structure = createStructure(exec->globalData(), globalObject->functionPrototype());
+ return new (JSC::allocateCell<JSNPMethod>(*exec->heap())) JSNPMethod(exec, globalObject, ident, npIdent, structure);
+}
+
static EncodedJSValue JSC_HOST_CALL callMethod(ExecState* exec)
{
JSNPMethod* jsNPMethod = static_cast<JSNPMethod*>(exec->callee());
Modified: branches/safari-534.52-branch/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPMethod.h (98478 => 98479)
--- branches/safari-534.52-branch/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPMethod.h 2011-10-26 14:44:44 UTC (rev 98478)
+++ branches/safari-534.52-branch/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPMethod.h 2011-10-26 14:50:41 UTC (rev 98479)
@@ -35,17 +35,14 @@
// A JSObject that wraps an NPMethod.
class JSNPMethod : public JSC::InternalFunction {
public:
- static JSNPMethod* create(JSC::ExecState* exec, JSC::JSGlobalObject* globalObject, const JSC::Identifier& ident, NPIdentifier npIdent)
- {
- return new (JSC::allocateCell<JSNPMethod>(*exec->heap())) JSNPMethod(exec, globalObject, ident, npIdent);
- }
+ static JSNPMethod* create(JSC::ExecState*, JSC::JSGlobalObject*, const JSC::Identifier&, NPIdentifier);
static const JSC::ClassInfo s_info;
NPIdentifier npIdentifier() const { return m_npIdentifier; }
private:
- JSNPMethod(JSC::ExecState*, JSC::JSGlobalObject*, const JSC::Identifier&, NPIdentifier);
+ JSNPMethod(JSC::ExecState*, JSC::JSGlobalObject*, const JSC::Identifier&, NPIdentifier, JSC::Structure*);
static JSC::Structure* createStructure(JSC::JSGlobalData& globalData, JSC::JSValue prototype)
{
Modified: branches/safari-534.52-branch/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPObject.cpp (98478 => 98479)
--- branches/safari-534.52-branch/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPObject.cpp 2011-10-26 14:44:44 UTC (rev 98478)
+++ branches/safari-534.52-branch/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPObject.cpp 2011-10-26 14:50:41 UTC (rev 98479)
@@ -49,8 +49,8 @@
const ClassInfo JSNPObject::s_info = { "NPObject", &JSObjectWithGlobalObject::s_info, 0, 0 };
-JSNPObject::JSNPObject(JSGlobalObject* globalObject, NPRuntimeObjectMap* objectMap, NPObject* npObject)
- : JSObjectWithGlobalObject(globalObject, createStructure(globalObject->globalData(), globalObject->objectPrototype()))
+JSNPObject::JSNPObject(JSGlobalObject* globalObject, NPRuntimeObjectMap* objectMap, NPObject* npObject, Structure* structure)
+ : JSObjectWithGlobalObject(globalObject, structure)
, m_objectMap(objectMap)
, m_npObject(npObject)
{
@@ -62,6 +62,12 @@
retainNPObject(m_npObject);
}
+JSNPObject* JSNPObject::create(JSC::JSGlobalObject* globalObject, NPRuntimeObjectMap* objectMap, NPObject* npObject)
+{
+ Structure* structure = createStructure(globalObject->globalData(), globalObject->objectPrototype());
+ return new (JSC::allocateCell<JSNPObject>(globalObject->globalData().heap)) JSNPObject(globalObject, objectMap, npObject, structure);
+}
+
JSNPObject::~JSNPObject()
{
ASSERT(!m_npObject);
Modified: branches/safari-534.52-branch/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPObject.h (98478 => 98479)
--- branches/safari-534.52-branch/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPObject.h 2011-10-26 14:44:44 UTC (rev 98478)
+++ branches/safari-534.52-branch/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPObject.h 2011-10-26 14:50:41 UTC (rev 98479)
@@ -39,11 +39,7 @@
class JSNPObject : public JSC::JSObjectWithGlobalObject {
public:
- static JSNPObject* create(JSC::JSGlobalObject* globalObject, NPRuntimeObjectMap* objectMap, NPObject* npObject)
- {
- return new (JSC::allocateCell<JSNPObject>(globalObject->globalData().heap)) JSNPObject(globalObject, objectMap, npObject);
- }
-
+ static JSNPObject* create(JSC::JSGlobalObject*, NPRuntimeObjectMap*, NPObject*);
~JSNPObject();
void invalidate();
@@ -60,7 +56,7 @@
NPObject* npObject() const { return m_npObject; }
private:
- JSNPObject(JSC::JSGlobalObject*, NPRuntimeObjectMap*, NPObject*);
+ JSNPObject(JSC::JSGlobalObject*, NPRuntimeObjectMap*, NPObject*, JSC::Structure*);
static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::OverridesGetPropertyNames | JSObject::StructureFlags;