summaryrefslogtreecommitdiffstats
path: root/WebCore/bindings/js
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2010-08-27 11:02:25 +0100
committerSteve Block <steveblock@google.com>2010-09-02 17:17:20 +0100
commite8b154fd68f9b33be40a3590e58347f353835f5c (patch)
tree0733ce26384183245aaa5656af26c653636fe6c1 /WebCore/bindings/js
parentda56157816334089526a7a115a85fd85a6e9a1dc (diff)
downloadexternal_webkit-e8b154fd68f9b33be40a3590e58347f353835f5c.zip
external_webkit-e8b154fd68f9b33be40a3590e58347f353835f5c.tar.gz
external_webkit-e8b154fd68f9b33be40a3590e58347f353835f5c.tar.bz2
Merge WebKit at r66079 : Initial merge by git
Change-Id: Ie2e1440fb9d487d24e52c247342c076fecaecac7
Diffstat (limited to 'WebCore/bindings/js')
-rw-r--r--WebCore/bindings/js/JSInjectedScriptHostCustom.cpp6
-rw-r--r--WebCore/bindings/js/JSInspectorFrontendHostCustom.cpp19
-rw-r--r--WebCore/bindings/js/JSNodeFilterCondition.cpp19
-rw-r--r--WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp20
-rw-r--r--WebCore/bindings/js/ScriptDebugServer.cpp5
-rw-r--r--WebCore/bindings/js/ScriptDebugServer.h1
-rw-r--r--WebCore/bindings/js/ScriptProfiler.cpp5
-rw-r--r--WebCore/bindings/js/ScriptProfiler.h1
8 files changed, 67 insertions, 9 deletions
diff --git a/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp b/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp
index 06360fb..ac5225e 100644
--- a/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp
+++ b/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp
@@ -103,6 +103,12 @@ ScriptObject InjectedScriptHost::createInjectedScript(const String& source, Scri
return ScriptObject();
}
+void InjectedScriptHost::discardInjectedScript(ScriptState* scriptState)
+{
+ JSDOMGlobalObject* globalObject = static_cast<JSDOMGlobalObject*>(scriptState->lexicalGlobalObject());
+ globalObject->setInjectedScript(0);
+}
+
#if ENABLE(JAVASCRIPT_DEBUGGER)
JSValue JSInjectedScriptHost::currentCallFrame(ExecState* exec)
{
diff --git a/WebCore/bindings/js/JSInspectorFrontendHostCustom.cpp b/WebCore/bindings/js/JSInspectorFrontendHostCustom.cpp
index b724f50..1df1af0 100644
--- a/WebCore/bindings/js/JSInspectorFrontendHostCustom.cpp
+++ b/WebCore/bindings/js/JSInspectorFrontendHostCustom.cpp
@@ -40,6 +40,7 @@
#include "InspectorFrontendHost.h"
#include "JSEvent.h"
#include "MouseEvent.h"
+#include "PlatformString.h"
#include <runtime/JSArray.h>
#include <runtime/JSLock.h>
#include <runtime/JSObject.h>
@@ -90,14 +91,26 @@ JSValue JSInspectorFrontendHost::showContextMenu(ExecState* exec)
for (size_t i = 0; i < array->length(); ++i) {
JSObject* item = asObject(array->getIndex(i));
JSValue label = item->get(exec, Identifier(exec, "label"));
+ JSValue type = item->get(exec, Identifier(exec, "type"));
JSValue id = item->get(exec, Identifier(exec, "id"));
- if (label.isUndefined() || id.isUndefined())
+ JSValue enabled = item->get(exec, Identifier(exec, "enabled"));
+ JSValue checked = item->get(exec, Identifier(exec, "checked"));
+ if (!type.isString())
+ continue;
+
+ String typeString = ustringToString(type.toString(exec));
+ if (typeString == "separator") {
items.append(new ContextMenuItem(SeparatorType,
ContextMenuItemCustomTagNoAction,
String()));
- else {
+ } else {
ContextMenuAction typedId = static_cast<ContextMenuAction>(ContextMenuItemBaseCustomTag + id.toInt32(exec));
- items.append(new ContextMenuItem(ActionType, typedId, ustringToString(label.toString(exec))));
+ ContextMenuItem* menuItem = new ContextMenuItem((typeString == "checkbox" ? CheckableActionType : ActionType), typedId, ustringToString(label.toString(exec)));
+ if (!enabled.isUndefined())
+ menuItem->setEnabled(enabled.toBoolean(exec));
+ if (!checked.isUndefined())
+ menuItem->setChecked(checked.toBoolean(exec));
+ items.append(menuItem);
}
}
diff --git a/WebCore/bindings/js/JSNodeFilterCondition.cpp b/WebCore/bindings/js/JSNodeFilterCondition.cpp
index b723286..b269e5f 100644
--- a/WebCore/bindings/js/JSNodeFilterCondition.cpp
+++ b/WebCore/bindings/js/JSNodeFilterCondition.cpp
@@ -23,6 +23,7 @@
#include "JSNode.h"
#include "JSNodeFilter.h"
#include "NodeFilter.h"
+#include <runtime/Error.h>
#include <runtime/JSLock.h>
namespace WebCore {
@@ -45,9 +46,7 @@ short JSNodeFilterCondition::acceptNode(JSC::ExecState* exec, Node* filterNode)
{
JSLock lock(SilenceAssertionsOnly);
- CallData callData;
- CallType callType = getCallData(m_filter, callData);
- if (callType == CallTypeNone)
+ if (!m_filter.isObject())
return NodeFilter::FILTER_ACCEPT;
// The exec argument here should only be null if this was called from a
@@ -59,6 +58,18 @@ short JSNodeFilterCondition::acceptNode(JSC::ExecState* exec, Node* filterNode)
if (!exec)
return NodeFilter::FILTER_REJECT;
+ JSValue function = m_filter;
+ CallData callData;
+ CallType callType = getCallData(function, callData);
+ if (callType == CallTypeNone) {
+ function = m_filter.get(exec, Identifier(exec, "acceptNode"));
+ callType = getCallData(function, callData);
+ if (callType == CallTypeNone) {
+ throwError(exec, createTypeError(exec, "NodeFilter object does not have an acceptNode function"));
+ return NodeFilter::FILTER_REJECT;
+ }
+ }
+
MarkedArgumentBuffer args;
// FIXME: The node should have the prototype chain that came from its document, not
// whatever prototype chain might be on the window this filter came from. Bug 27662
@@ -66,7 +77,7 @@ short JSNodeFilterCondition::acceptNode(JSC::ExecState* exec, Node* filterNode)
if (exec->hadException())
return NodeFilter::FILTER_REJECT;
- JSValue result = JSC::call(exec, m_filter, callType, callData, m_filter, args);
+ JSValue result = JSC::call(exec, function, callType, callData, m_filter, args);
if (exec->hadException())
return NodeFilter::FILTER_REJECT;
diff --git a/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp b/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp
index 0342ab6..4b31659 100644
--- a/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp
+++ b/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp
@@ -167,6 +167,8 @@ JSValue JSWebGLRenderingContext::getAttachedShaders(ExecState* exec)
return throwSyntaxError(exec);
ExceptionCode ec = 0;
WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl());
+ if (exec->argumentCount() > 0 && !exec->argument(0).isUndefinedOrNull() && !exec->argument(0).inherits(&JSWebGLProgram::s_info))
+ return throwTypeError(exec);
WebGLProgram* program = toWebGLProgram(exec->argument(0));
if (exec->hadException())
return jsUndefined();
@@ -238,6 +240,8 @@ JSValue JSWebGLRenderingContext::getProgramParameter(ExecState* exec)
ExceptionCode ec = 0;
WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl());
+ if (exec->argumentCount() > 0 && !exec->argument(0).isUndefinedOrNull() && !exec->argument(0).inherits(&JSWebGLProgram::s_info))
+ return throwTypeError(exec);
WebGLProgram* program = toWebGLProgram(exec->argument(0));
unsigned pname = exec->argument(1).toInt32(exec);
if (exec->hadException())
@@ -262,6 +266,8 @@ JSValue JSWebGLRenderingContext::getShaderParameter(ExecState* exec)
ExceptionCode ec = 0;
WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl());
+ if (exec->argumentCount() > 0 && !exec->argument(0).isUndefinedOrNull() && !exec->argument(0).inherits(&JSWebGLShader::s_info))
+ return throwTypeError(exec);
WebGLShader* shader = toWebGLShader(exec->argument(0));
unsigned pname = exec->argument(1).toInt32(exec);
if (exec->hadException())
@@ -286,7 +292,11 @@ JSValue JSWebGLRenderingContext::getUniform(ExecState* exec)
ExceptionCode ec = 0;
WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl());
+ if (exec->argumentCount() > 0 && !exec->argument(0).isUndefinedOrNull() && !exec->argument(0).inherits(&JSWebGLProgram::s_info))
+ return throwTypeError(exec);
WebGLProgram* program = toWebGLProgram(exec->argument(0));
+ if (exec->argumentCount() > 1 && !exec->argument(1).isUndefinedOrNull() && !exec->argument(1).inherits(&JSWebGLUniformLocation::s_info))
+ return throwTypeError(exec);
WebGLUniformLocation* loc = toWebGLUniformLocation(exec->argument(1));
if (exec->hadException())
return jsUndefined();
@@ -354,9 +364,11 @@ static JSC::JSValue dataFunctionf(DataFunctionToCall f, JSC::ExecState* exec, We
WebGLUniformLocation* location = 0;
long index = -1;
- if (functionForUniform(f))
+ if (functionForUniform(f)) {
+ if (exec->argumentCount() > 0 && !exec->argument(0).isUndefinedOrNull() && !exec->argument(0).inherits(&JSWebGLUniformLocation::s_info))
+ return throwTypeError(exec);
location = toWebGLUniformLocation(exec->argument(0));
- else
+ } else
index = exec->argument(0).toInt32(exec);
if (exec->hadException())
@@ -439,6 +451,8 @@ static JSC::JSValue dataFunctioni(DataFunctionToCall f, JSC::ExecState* exec, We
if (exec->argumentCount() != 2)
return throwSyntaxError(exec);
+ if (exec->argumentCount() > 0 && !exec->argument(0).isUndefinedOrNull() && !exec->argument(0).inherits(&JSWebGLUniformLocation::s_info))
+ return throwTypeError(exec);
WebGLUniformLocation* location = toWebGLUniformLocation(exec->argument(0));
if (exec->hadException())
@@ -502,6 +516,8 @@ static JSC::JSValue dataFunctionMatrix(DataFunctionMatrixToCall f, JSC::ExecStat
if (exec->argumentCount() != 3)
return throwSyntaxError(exec);
+ if (exec->argumentCount() > 0 && !exec->argument(0).isUndefinedOrNull() && !exec->argument(0).inherits(&JSWebGLUniformLocation::s_info))
+ return throwTypeError(exec);
WebGLUniformLocation* location = toWebGLUniformLocation(exec->argument(0));
if (exec->hadException())
diff --git a/WebCore/bindings/js/ScriptDebugServer.cpp b/WebCore/bindings/js/ScriptDebugServer.cpp
index cd80de4..ecb7fa6 100644
--- a/WebCore/bindings/js/ScriptDebugServer.cpp
+++ b/WebCore/bindings/js/ScriptDebugServer.cpp
@@ -205,6 +205,11 @@ void ScriptDebugServer::pause()
m_pauseOnNextStatement = true;
}
+void ScriptDebugServer::breakProgram()
+{
+ // FIXME(WK43332): implement this.
+}
+
void ScriptDebugServer::continueProgram()
{
if (!m_paused)
diff --git a/WebCore/bindings/js/ScriptDebugServer.h b/WebCore/bindings/js/ScriptDebugServer.h
index fd8976b..432fe9a 100644
--- a/WebCore/bindings/js/ScriptDebugServer.h
+++ b/WebCore/bindings/js/ScriptDebugServer.h
@@ -79,6 +79,7 @@ public:
void setPauseOnExceptionsState(PauseOnExceptionsState);
void pause();
+ void breakProgram();
void continueProgram();
void stepIntoStatement();
void stepOverStatement();
diff --git a/WebCore/bindings/js/ScriptProfiler.cpp b/WebCore/bindings/js/ScriptProfiler.cpp
index f372c3c..62ae9ba 100644
--- a/WebCore/bindings/js/ScriptProfiler.cpp
+++ b/WebCore/bindings/js/ScriptProfiler.cpp
@@ -46,6 +46,11 @@ PassRefPtr<ScriptProfile> ScriptProfiler::stop(ScriptState* state, const String&
return ScriptProfile::create(profile);
}
+bool ScriptProfiler::isProfilerAlwaysEnabled()
+{
+ return false;
+}
+
} // namespace WebCore
#endif // ENABLE(JAVASCRIPT_DEBUGGER)
diff --git a/WebCore/bindings/js/ScriptProfiler.h b/WebCore/bindings/js/ScriptProfiler.h
index 4fa331c..180c49f 100644
--- a/WebCore/bindings/js/ScriptProfiler.h
+++ b/WebCore/bindings/js/ScriptProfiler.h
@@ -41,6 +41,7 @@ public:
static PassRefPtr<ScriptProfile> stop(ScriptState* state, const String& title);
static void takeHeapSnapshot() { }
static long getProfilerLogLines(long, String*) { return 0; }
+ static bool isProfilerAlwaysEnabled();
};
} // namespace WebCore