Commit 75e16bb3 authored by weinig@apple.com's avatar weinig@apple.com

Convert another callback type object to store the global object

instead of the frame.

Reviewed by Gavin 'BearClaw' Barraclough.

* bindings/js/JSCustomXPathNSResolver.cpp:
(WebCore::JSCustomXPathNSResolver::create):
(WebCore::JSCustomXPathNSResolver::JSCustomXPathNSResolver):
(WebCore::JSCustomXPathNSResolver::lookupNamespaceURI):
* bindings/js/JSCustomXPathNSResolver.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@48530 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 9c050adc
2009-09-18 Sam Weinig <sam@webkit.org>
Reviewed by Gavin 'BearClaw' Barraclough.
Convert another callback type object to store the global object
instead of the frame.
* bindings/js/JSCustomXPathNSResolver.cpp:
(WebCore::JSCustomXPathNSResolver::create):
(WebCore::JSCustomXPathNSResolver::JSCustomXPathNSResolver):
(WebCore::JSCustomXPathNSResolver::lookupNamespaceURI):
* bindings/js/JSCustomXPathNSResolver.h:
2009-09-18 Anders Carlsson <andersca@apple.com>
Reviewed by Sam Weinig.
......@@ -49,13 +49,13 @@ PassRefPtr<JSCustomXPathNSResolver> JSCustomXPathNSResolver::create(JSC::ExecSta
setDOMException(exec, TYPE_MISMATCH_ERR);
return 0;
}
return adoptRef(new JSCustomXPathNSResolver(resolverObject, asJSDOMWindow(exec->dynamicGlobalObject())->impl()->frame()));
return adoptRef(new JSCustomXPathNSResolver(resolverObject, asJSDOMWindow(exec->dynamicGlobalObject())));
}
JSCustomXPathNSResolver::JSCustomXPathNSResolver(JSObject* customResolver, Frame* frame)
JSCustomXPathNSResolver::JSCustomXPathNSResolver(JSObject* customResolver, JSDOMWindow* globalObject)
: m_customResolver(customResolver)
, m_frame(frame)
, m_globalObject(globalObject)
{
}
......@@ -67,15 +67,9 @@ String JSCustomXPathNSResolver::lookupNamespaceURI(const String& prefix)
{
ASSERT(m_customResolver);
if (!m_frame)
return String();
if (!m_frame->script()->isEnabled())
return String();
JSLock lock(SilenceAssertionsOnly);
JSGlobalObject* globalObject = m_frame->script()->globalObject();
ExecState* exec = globalObject->globalExec();
ExecState* exec = m_globalObject->globalExec();
JSValue function = m_customResolver->get(exec, Identifier(exec, "lookupNamespaceURI"));
CallData callData;
......@@ -84,7 +78,7 @@ String JSCustomXPathNSResolver::lookupNamespaceURI(const String& prefix)
callType = m_customResolver->getCallData(callData);
if (callType == CallTypeNone) {
// FIXME: Pass actual line number and source URL.
m_frame->domWindow()->console()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "XPathNSResolver does not have a lookupNamespaceURI method.", 0, String());
m_globalObject->impl()->console()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "XPathNSResolver does not have a lookupNamespaceURI method.", 0, String());
return String();
}
function = m_customResolver;
......@@ -95,9 +89,9 @@ String JSCustomXPathNSResolver::lookupNamespaceURI(const String& prefix)
MarkedArgumentBuffer args;
args.append(jsString(exec, prefix));
globalObject->globalData()->timeoutChecker.start();
m_globalObject->globalData()->timeoutChecker.start();
JSValue retval = call(exec, function, callType, callData, m_customResolver, args);
globalObject->globalData()->timeoutChecker.stop();
m_globalObject->globalData()->timeoutChecker.stop();
String result;
if (exec->hadException())
......
......@@ -41,6 +41,7 @@ namespace JSC {
namespace WebCore {
class Frame;
class JSDOMWindow;
class JSCustomXPathNSResolver : public XPathNSResolver {
public:
......@@ -51,10 +52,11 @@ namespace WebCore {
virtual String lookupNamespaceURI(const String& prefix);
private:
JSCustomXPathNSResolver(JSC::JSObject*, Frame*);
JSCustomXPathNSResolver(JSC::JSObject*, JSDOMWindow*);
JSC::JSObject* m_customResolver; // JSCustomXPathNSResolvers are always temporary, thus no need to GC protect the object.
RefPtr<Frame> m_frame;
// JSCustomXPathNSResolvers are always temporary, thus no need to GC protect the objects.
JSC::JSObject* m_customResolver;
JSDOMWindow* m_globalObject;
};
} // namespace WebCore
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment