#include "ExceptionCode.h"
#include "Frame.h"
#include "FrameLoader.h"
+#include "JSBinding.h"
+#include "JSBindingState.h"
#include "JSDOMBinding.h"
#include "JSDOMWindowCustom.h"
#include "KURL.h"
namespace WebCore {
-static JSValue nonCachingStaticReplaceFunctionGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot&)
+static JSValue nonCachingStaticReplaceFunctionGetter(ExecState* exec, JSValue, const Identifier& propertyName)
{
- return new (exec) NativeFunctionWrapper(exec, exec->lexicalGlobalObject()->prototypeFunctionStructure(), 1, propertyName, jsLocationPrototypeFunctionReplace);
+ return new (exec) NativeFunctionWrapper(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->prototypeFunctionStructure(), 1, propertyName, jsLocationPrototypeFunctionReplace);
}
-static JSValue nonCachingStaticReloadFunctionGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot&)
+static JSValue nonCachingStaticReloadFunctionGetter(ExecState* exec, JSValue, const Identifier& propertyName)
{
- return new (exec) NativeFunctionWrapper(exec, exec->lexicalGlobalObject()->prototypeFunctionStructure(), 0, propertyName, jsLocationPrototypeFunctionReload);
+ return new (exec) NativeFunctionWrapper(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->prototypeFunctionStructure(), 0, propertyName, jsLocationPrototypeFunctionReload);
}
-static JSValue nonCachingStaticAssignFunctionGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot&)
+static JSValue nonCachingStaticAssignFunctionGetter(ExecState* exec, JSValue, const Identifier& propertyName)
{
- return new (exec) NativeFunctionWrapper(exec, exec->lexicalGlobalObject()->prototypeFunctionStructure(), 1, propertyName, jsLocationPrototypeFunctionAssign);
+ return new (exec) NativeFunctionWrapper(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->prototypeFunctionStructure(), 1, propertyName, jsLocationPrototypeFunctionAssign);
}
bool JSLocation::getOwnPropertySlotDelegate(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
static void navigateIfAllowed(ExecState* exec, Frame* frame, const KURL& url, bool lockHistory, bool lockBackForwardList)
{
- Frame* lexicalFrame = toLexicalFrame(exec);
- if (!lexicalFrame)
- return;
-
- if (!protocolIsJavaScript(url) || allowsAccessFromFrame(exec, frame))
- frame->redirectScheduler()->scheduleLocationChange(url.string(), lexicalFrame->loader()->outgoingReferrer(), lockHistory, lockBackForwardList, processingUserGesture(exec));
+ JSBindingState state(exec);
+ JSBinding::Frame::navigateIfAllowed(&state, frame, url, lockHistory, lockBackForwardList);
}
void JSLocation::setHref(ExecState* exec, JSValue value)
Frame* frame = impl()->frame();
ASSERT(frame);
- KURL url = completeURL(exec, value.toString(exec));
+ KURL url = completeURL(exec, ustringToString(value.toString(exec)));
if (url.isNull())
return;
ASSERT(frame);
KURL url = frame->loader()->url();
- if (!url.setProtocol(value.toString(exec))) {
+ if (!url.setProtocol(ustringToString(value.toString(exec)))) {
setDOMException(exec, SYNTAX_ERR);
return;
}
ASSERT(frame);
KURL url = frame->loader()->url();
- url.setHostAndPort(value.toString(exec));
+ url.setHostAndPort(ustringToString(value.toString(exec)));
navigateIfAllowed(exec, frame, url, !frame->script()->anyPageIsProcessingUserGesture(), false);
}
ASSERT(frame);
KURL url = frame->loader()->url();
- url.setHost(value.toString(exec));
+ url.setHost(ustringToString(value.toString(exec)));
navigateIfAllowed(exec, frame, url, !frame->script()->anyPageIsProcessingUserGesture(), false);
}
KURL url = frame->loader()->url();
// FIXME: Could make this a little less ugly if String provided a toUnsignedShort function.
const UString& portString = value.toString(exec);
- int port = charactersToInt(portString.data(), portString.size());
+ int port = charactersToInt(portString.characters(), portString.length());
if (port < 0 || port > 0xFFFF)
url.removePort();
else
ASSERT(frame);
KURL url = frame->loader()->url();
- url.setPath(value.toString(exec));
+ url.setPath(ustringToString(value.toString(exec)));
navigateIfAllowed(exec, frame, url, !frame->script()->anyPageIsProcessingUserGesture(), false);
}
ASSERT(frame);
KURL url = frame->loader()->url();
- url.setQuery(value.toString(exec));
+ url.setQuery(ustringToString(value.toString(exec)));
navigateIfAllowed(exec, frame, url, !frame->script()->anyPageIsProcessingUserGesture(), false);
}
KURL url = frame->loader()->url();
String oldFragmentIdentifier = url.fragmentIdentifier();
- String str = value.toString(exec);
+ String str = ustringToString(value.toString(exec));
if (str.startsWith("#"))
str = str.substring(1);
if (equalIgnoringNullity(oldFragmentIdentifier, str))
navigateIfAllowed(exec, frame, url, !frame->script()->anyPageIsProcessingUserGesture(), false);
}
-JSValue JSLocation::replace(ExecState* exec, const ArgList& args)
+JSValue JSLocation::replace(ExecState* exec)
{
- Frame* frame = impl()->frame();
- if (!frame)
- return jsUndefined();
-
- KURL url = completeURL(exec, args.at(0).toString(exec));
- if (url.isNull())
- return jsUndefined();
-
- if (!shouldAllowNavigation(exec, frame))
- return jsUndefined();
-
- navigateIfAllowed(exec, frame, url, true, true);
+ JSBindingState state(exec);
+ JSBinding::Location::replace(&state, impl(), ustringToString(exec->argument(0).toString(exec)));
return jsUndefined();
}
-JSValue JSLocation::reload(ExecState* exec, const ArgList&)
+JSValue JSLocation::reload(ExecState* exec)
{
Frame* frame = impl()->frame();
if (!frame || !allowsAccessFromFrame(exec, frame))
return jsUndefined();
if (!protocolIsJavaScript(frame->loader()->url()))
- frame->redirectScheduler()->scheduleRefresh(processingUserGesture(exec));
+ frame->navigationScheduler()->scheduleRefresh();
return jsUndefined();
}
-JSValue JSLocation::assign(ExecState* exec, const ArgList& args)
+JSValue JSLocation::assign(ExecState* exec)
{
Frame* frame = impl()->frame();
if (!frame)
return jsUndefined();
- KURL url = completeURL(exec, args.at(0).toString(exec));
+ KURL url = completeURL(exec, ustringToString(exec->argument(0).toString(exec)));
if (url.isNull())
return jsUndefined();
return jsUndefined();
}
-JSValue JSLocation::toString(ExecState* exec, const ArgList&)
+JSValue JSLocation::toString(ExecState* exec)
{
Frame* frame = impl()->frame();
if (!frame || !allowsAccessFromFrame(exec, frame))