Diff
Modified: branches/safari-536.26-branch/Source/WebCore/ChangeLog (124950 => 124951)
--- branches/safari-536.26-branch/Source/WebCore/ChangeLog 2012-08-08 00:11:29 UTC (rev 124950)
+++ branches/safari-536.26-branch/Source/WebCore/ChangeLog 2012-08-08 00:18:06 UTC (rev 124951)
@@ -1,5 +1,32 @@
2012-08-07 Lucas Forschler <[email protected]>
+ Merge 124510
+
+ 2012-08-02 Oliver Hunt <[email protected]>
+
+ A few objects aren't being safely protected from GC in all cases
+ https://bugs.webkit.org/show_bug.cgi?id=93031
+
+ Reviewed by Filip Pizlo.
+
+ I haven't seen evidence that anyone is hitting bugs due to this, but any
+ GC error can lead to later -- hard to diagnose -- bugs if they result in
+ resurrecting dead objects.
+
+ * bindings/js/JSCustomXPathNSResolver.cpp:
+ (WebCore::JSCustomXPathNSResolver::create):
+ (WebCore::JSCustomXPathNSResolver::JSCustomXPathNSResolver):
+ (WebCore::JSCustomXPathNSResolver::lookupNamespaceURI):
+ * bindings/js/JSCustomXPathNSResolver.h:
+ (JSCustomXPathNSResolver):
+ * bindings/js/JSDictionary.cpp:
+ (WebCore::JSDictionary::tryGetProperty):
+ * bindings/js/JSDictionary.h:
+ (WebCore::JSDictionary::JSDictionary):
+ (WebCore::JSDictionary::initializerObject):
+
+2012-08-07 Lucas Forschler <[email protected]>
+
Merge 124489
2012-08-02 Beth Dakin <[email protected]>
Modified: branches/safari-536.26-branch/Source/WebCore/bindings/js/JSCustomXPathNSResolver.cpp (124950 => 124951)
--- branches/safari-536.26-branch/Source/WebCore/bindings/js/JSCustomXPathNSResolver.cpp 2012-08-08 00:11:29 UTC (rev 124950)
+++ branches/safari-536.26-branch/Source/WebCore/bindings/js/JSCustomXPathNSResolver.cpp 2012-08-08 00:18:06 UTC (rev 124951)
@@ -39,7 +39,7 @@
using namespace JSC;
-PassRefPtr<JSCustomXPathNSResolver> JSCustomXPathNSResolver::create(JSC::ExecState* exec, JSC::JSValue value)
+PassRefPtr<JSCustomXPathNSResolver> JSCustomXPathNSResolver::create(ExecState* exec, JSValue value)
{
if (value.isUndefinedOrNull())
return 0;
@@ -50,12 +50,12 @@
return 0;
}
- return adoptRef(new JSCustomXPathNSResolver(resolverObject, asJSDOMWindow(exec->dynamicGlobalObject())));
+ return adoptRef(new JSCustomXPathNSResolver(exec, resolverObject, asJSDOMWindow(exec->dynamicGlobalObject())));
}
-JSCustomXPathNSResolver::JSCustomXPathNSResolver(JSObject* customResolver, JSDOMWindow* globalObject)
- : m_customResolver(customResolver)
- , m_globalObject(globalObject)
+JSCustomXPathNSResolver::JSCustomXPathNSResolver(ExecState* exec, JSObject* customResolver, JSDOMWindow* globalObject)
+ : m_customResolver(exec->globalData(), customResolver)
+ , m_globalObject(exec->globalData(), globalObject)
{
}
@@ -75,13 +75,13 @@
CallData callData;
CallType callType = getCallData(function, callData);
if (callType == CallTypeNone) {
- callType = m_customResolver->methodTable()->getCallData(m_customResolver, callData);
+ callType = m_customResolver->methodTable()->getCallData(m_customResolver.get(), callData);
if (callType == CallTypeNone) {
// FIXME: Pass actual line number and source URL.
m_globalObject->impl()->console()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "XPathNSResolver does not have a lookupNamespaceURI method.");
return String();
}
- function = m_customResolver;
+ function = m_customResolver.get();
}
RefPtr<JSCustomXPathNSResolver> selfProtector(this);
@@ -90,7 +90,7 @@
args.append(jsString(exec, prefix));
m_globalObject->globalData().timeoutChecker.start();
- JSValue retval = JSMainThreadExecState::call(exec, function, callType, callData, m_customResolver, args);
+ JSValue retval = JSMainThreadExecState::call(exec, function, callType, callData, m_customResolver.get(), args);
m_globalObject->globalData().timeoutChecker.stop();
String result;
Modified: branches/safari-536.26-branch/Source/WebCore/bindings/js/JSCustomXPathNSResolver.h (124950 => 124951)
--- branches/safari-536.26-branch/Source/WebCore/bindings/js/JSCustomXPathNSResolver.h 2012-08-08 00:11:29 UTC (rev 124950)
+++ branches/safari-536.26-branch/Source/WebCore/bindings/js/JSCustomXPathNSResolver.h 2012-08-08 00:18:06 UTC (rev 124951)
@@ -27,6 +27,8 @@
#define JSCustomXPathNSResolver_h
#include "XPathNSResolver.h"
+#include <heap/Strong.h>
+#include <heap/StrongInlines.h>
#include <runtime/JSValue.h>
#include <wtf/Forward.h>
#include <wtf/RefPtr.h>
@@ -50,11 +52,11 @@
virtual String lookupNamespaceURI(const String& prefix);
private:
- JSCustomXPathNSResolver(JSC::JSObject*, JSDOMWindow*);
+ JSCustomXPathNSResolver(JSC::ExecState*, JSC::JSObject*, JSDOMWindow*);
- // JSCustomXPathNSResolvers are always temporary, thus no need to GC protect the objects.
- JSC::JSObject* m_customResolver;
- JSDOMWindow* m_globalObject;
+ // JSCustomXPathNSResolvers are always temporary so using a Strong reference is safe here.
+ JSC::Strong<JSC::JSObject> m_customResolver;
+ JSC::Strong<JSDOMWindow> m_globalObject;
};
} // namespace WebCore
Modified: branches/safari-536.26-branch/Source/WebCore/bindings/js/JSDictionary.cpp (124950 => 124951)
--- branches/safari-536.26-branch/Source/WebCore/bindings/js/JSDictionary.cpp 2012-08-08 00:11:29 UTC (rev 124950)
+++ branches/safari-536.26-branch/Source/WebCore/bindings/js/JSDictionary.cpp 2012-08-08 00:18:06 UTC (rev 124951)
@@ -45,9 +45,9 @@
JSDictionary::GetPropertyResult JSDictionary::tryGetProperty(const char* propertyName, JSValue& finalResult) const
{
Identifier identifier(m_exec, propertyName);
- PropertySlot slot(m_initializerObject);
+ PropertySlot slot(m_initializerObject.get());
- if (!m_initializerObject->getPropertySlot(m_exec, identifier, slot))
+ if (!m_initializerObject.get()->getPropertySlot(m_exec, identifier, slot))
return NoPropertyFound;
if (m_exec->hadException())
Modified: branches/safari-536.26-branch/Source/WebCore/bindings/js/JSDictionary.h (124950 => 124951)
--- branches/safari-536.26-branch/Source/WebCore/bindings/js/JSDictionary.h 2012-08-08 00:11:29 UTC (rev 124950)
+++ branches/safari-536.26-branch/Source/WebCore/bindings/js/JSDictionary.h 2012-08-08 00:18:06 UTC (rev 124951)
@@ -27,6 +27,8 @@
#define JSDictionary_h
#include "MessagePort.h"
+#include <heap/Strong.h>
+#include <heap/StrongInlines.h>
#include <interpreter/CallFrame.h>
#include <wtf/Forward.h>
@@ -44,7 +46,7 @@
public:
JSDictionary(JSC::ExecState* exec, JSC::JSObject* initializerObject)
: m_exec(exec)
- , m_initializerObject(initializerObject)
+ , m_initializerObject(exec->globalData(), initializerObject)
{
}
@@ -59,6 +61,7 @@
bool get(const char* propertyName, Result&) const;
JSC::ExecState* execState() const { return m_exec; }
+ JSC::JSObject* initializerObject() const { return m_initializerObject.get(); }
bool isValid() const { return m_exec && m_initializerObject; }
private:
@@ -102,7 +105,7 @@
#endif
JSC::ExecState* m_exec;
- JSC::JSObject* m_initializerObject;
+ JSC::Strong<JSC::JSObject> m_initializerObject;
};
template <typename T, typename Result>