summaryrefslogtreecommitdiffstats
path: root/WebCore/bindings/js/ScriptController.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/bindings/js/ScriptController.cpp')
-rw-r--r--WebCore/bindings/js/ScriptController.cpp59
1 files changed, 34 insertions, 25 deletions
diff --git a/WebCore/bindings/js/ScriptController.cpp b/WebCore/bindings/js/ScriptController.cpp
index 11d2945..fbca680 100644
--- a/WebCore/bindings/js/ScriptController.cpp
+++ b/WebCore/bindings/js/ScriptController.cpp
@@ -21,34 +21,24 @@
#include "config.h"
#include "ScriptController.h"
-#include "Console.h"
-#include "DOMWindow.h"
-#include "Document.h"
#include "Event.h"
#include "EventNames.h"
#include "Frame.h"
-#include "FrameLoader.h"
#include "GCController.h"
-#include "JSDOMWindow.h"
+#include "HTMLPlugInElement.h"
#include "JSDocument.h"
-#include "JSEventListener.h"
-#include "npruntime_impl.h"
+#include "JSLazyEventListener.h"
#include "NP_jsobject.h"
#include "Page.h"
#include "PageGroup.h"
-#include "runtime_root.h"
#include "ScriptSourceCode.h"
#include "ScriptValue.h"
#include "Settings.h"
-
-#include <runtime/Completion.h>
+#include "npruntime_impl.h"
+#include "runtime_root.h"
#include <debugger/Debugger.h>
#include <runtime/JSLock.h>
-#if ENABLE(NETSCAPE_PLUGIN_API)
-#include "HTMLPlugInElement.h"
-#endif
-
using namespace JSC;
namespace WebCore {
@@ -110,16 +100,16 @@ ScriptValue ScriptController::evaluate(const ScriptSourceCode& sourceCode)
// so we start the keep alive timer here.
m_frame->keepAlive();
- m_windowShell->window()->startTimeoutCheck();
+ m_windowShell->window()->globalData()->timeoutChecker.start();
Completion comp = JSC::evaluate(exec, exec->dynamicGlobalObject()->globalScopeChain(), jsSourceCode, m_windowShell);
- m_windowShell->window()->stopTimeoutCheck();
+ m_windowShell->window()->globalData()->timeoutChecker.stop();
if (comp.complType() == Normal || comp.complType() == ReturnValue) {
m_sourceURL = savedSourceURL;
return comp.value();
}
- if (comp.complType() == Throw)
+ if (comp.complType() == Throw || comp.complType() == Interrupted)
reportException(exec, comp.value());
m_sourceURL = savedSourceURL;
@@ -133,6 +123,7 @@ void ScriptController::clearWindowShell()
JSLock lock(false);
m_windowShell->window()->clear();
+ m_liveFormerWindows.add(m_windowShell->window());
m_windowShell->setWindow(m_frame->domWindow());
if (Page* page = m_frame->page()) {
attachDebugger(page->debugger());
@@ -151,12 +142,14 @@ PassRefPtr<EventListener> ScriptController::createInlineEventListener(const Stri
}
#if ENABLE(SVG)
+
PassRefPtr<EventListener> ScriptController::createSVGEventHandler(const String& functionName, const String& code, Node* node)
{
initScriptIfNeeded();
JSLock lock(false);
return JSLazyEventListener::create(JSLazyEventListener::SVGLazyEventListener, functionName, code, m_windowShell->window(), node, m_handlerLineno);
}
+
#endif
void ScriptController::initScript()
@@ -167,7 +160,7 @@ void ScriptController::initScript()
JSLock lock(false);
m_windowShell = new JSDOMWindowShell(m_frame->domWindow());
- m_windowShell->window()->updateDocument();
+ updateDocument();
if (Page* page = m_frame->page()) {
attachDebugger(page->debugger());
@@ -264,6 +257,9 @@ void ScriptController::updateDocument()
JSLock lock(false);
if (m_windowShell)
m_windowShell->window()->updateDocument();
+ HashSet<JSDOMWindow*>::iterator end = m_liveFormerWindows.end();
+ for (HashSet<JSDOMWindow*>::iterator it = m_liveFormerWindows.begin(); it != end; ++it)
+ (*it)->updateDocument();
}
void ScriptController::updateSecurityOrigin()
@@ -296,6 +292,7 @@ PassRefPtr<Bindings::RootObject> ScriptController::createRootObject(void* native
}
#if ENABLE(NETSCAPE_PLUGIN_API)
+
NPObject* ScriptController::windowScriptNPObject()
{
if (!m_windowScriptNPObject) {
@@ -319,23 +316,34 @@ NPObject* ScriptController::windowScriptNPObject()
NPObject* ScriptController::createScriptObjectForPluginElement(HTMLPlugInElement* plugin)
{
- // Can't create NPObjects when JavaScript is disabled
- if (!isEnabled())
+ JSObject* object = jsObjectForPluginElement(plugin);
+ if (!object)
return _NPN_CreateNoScriptObject();
+ // Wrap the JSObject in an NPObject
+ return _NPN_CreateScriptObject(0, object, bindingRootObject());
+}
+
+#endif
+
+JSObject* ScriptController::jsObjectForPluginElement(HTMLPlugInElement* plugin)
+{
+ // Can't create JSObjects when JavaScript is disabled
+ if (!isEnabled())
+ return 0;
+
// Create a JSObject bound to this element
JSLock lock(false);
ExecState* exec = globalObject()->globalExec();
JSValuePtr jsElementValue = toJS(exec, plugin);
if (!jsElementValue || !jsElementValue.isObject())
- return _NPN_CreateNoScriptObject();
-
- // Wrap the JSObject in an NPObject
- return _NPN_CreateScriptObject(0, jsElementValue.getObject(), bindingRootObject());
+ return 0;
+
+ return jsElementValue.getObject();
}
-#endif
#if !PLATFORM(MAC)
+
void ScriptController::updatePlatformScriptObjects()
{
}
@@ -343,6 +351,7 @@ void ScriptController::updatePlatformScriptObjects()
void ScriptController::disconnectPlatformScriptObjects()
{
}
+
#endif
void ScriptController::cleanupScriptObjectsForPlugin(void* nativeHandle)