[SCM] WebKit Debian packaging branch, debian/experimental, updated. debian/1.3.8-1-1049-g2e11a8e

abarth at webkit.org abarth at webkit.org
Fri Jan 21 14:49:40 UTC 2011


The following commit has been merged in the debian/experimental branch:
commit 90ba778d6e912becb243c42f64531c928f900935
Author: abarth at webkit.org <abarth at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Dec 31 19:56:29 2010 +0000

    2010-12-31  Adam Barth  <abarth at webkit.org>
    
            Reviewed by Eric Seidel.
    
            Move V8 to WebCore Location implementation
            https://bugs.webkit.org/show_bug.cgi?id=51768
    
            * bindings/generic/BindingFrame.h:
            * bindings/generic/BindingLocation.h:
            * bindings/v8/V8Binding.h:
            * bindings/v8/V8DOMWindowShell.cpp:
            (WebCore::V8DOMWindowShell::setLocation):
            * bindings/v8/V8Utilities.cpp:
            * bindings/v8/V8Utilities.h:
            * bindings/v8/custom/V8LocationCustom.cpp:
            (WebCore::V8Location::hashAccessorSetter):
            (WebCore::V8Location::hostAccessorSetter):
            (WebCore::V8Location::hostnameAccessorSetter):
            (WebCore::V8Location::hrefAccessorSetter):
            (WebCore::V8Location::pathnameAccessorSetter):
            (WebCore::V8Location::portAccessorSetter):
            (WebCore::V8Location::protocolAccessorSetter):
            (WebCore::V8Location::searchAccessorSetter):
            (WebCore::V8Location::reloadCallback):
            (WebCore::V8Location::replaceCallback):
            (WebCore::V8Location::assignCallback):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@74833 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 35e160b..1a49b56 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,30 @@
+2010-12-31  Adam Barth  <abarth at webkit.org>
+
+        Reviewed by Eric Seidel.
+
+        Move V8 to WebCore Location implementation
+        https://bugs.webkit.org/show_bug.cgi?id=51768
+
+        * bindings/generic/BindingFrame.h:
+        * bindings/generic/BindingLocation.h:
+        * bindings/v8/V8Binding.h:
+        * bindings/v8/V8DOMWindowShell.cpp:
+        (WebCore::V8DOMWindowShell::setLocation):
+        * bindings/v8/V8Utilities.cpp:
+        * bindings/v8/V8Utilities.h:
+        * bindings/v8/custom/V8LocationCustom.cpp:
+        (WebCore::V8Location::hashAccessorSetter):
+        (WebCore::V8Location::hostAccessorSetter):
+        (WebCore::V8Location::hostnameAccessorSetter):
+        (WebCore::V8Location::hrefAccessorSetter):
+        (WebCore::V8Location::pathnameAccessorSetter):
+        (WebCore::V8Location::portAccessorSetter):
+        (WebCore::V8Location::protocolAccessorSetter):
+        (WebCore::V8Location::searchAccessorSetter):
+        (WebCore::V8Location::reloadCallback):
+        (WebCore::V8Location::replaceCallback):
+        (WebCore::V8Location::assignCallback):
+
 2010-12-31  Yi Shen  <yi.4.shen at nokia.com>
 
         Reviewed by Eric Seidel.
diff --git a/WebCore/bindings/generic/BindingFrame.h b/WebCore/bindings/generic/BindingFrame.h
index b194972..04b0902 100644
--- a/WebCore/bindings/generic/BindingFrame.h
+++ b/WebCore/bindings/generic/BindingFrame.h
@@ -31,28 +31,6 @@
 #ifndef BindingFrame_h
 #define BindingFrame_h
 
-#include "Frame.h"
-#include "GenericBinding.h"
-
-namespace WebCore {
-
-template <class Binding>
-class BindingFrame {
-public:
-    static void navigateIfAllowed(State<Binding>*, Frame*, const KURL&, bool lockHistory, bool lockBackForwardList);
-};
-
-template <class Binding>
-void BindingFrame<Binding>::navigateIfAllowed(State<Binding>* state, Frame* frame, const KURL& url, bool lockHistory, bool lockBackForwardList)
-{
-    Frame* activeFrame = state->activeFrame();
-    if (!activeFrame)
-        return;
-    if (!protocolIsJavaScript(url) || state->allowsAccessFromFrame(frame))
-        frame->navigationScheduler()->scheduleLocationChange(activeFrame->document()->securityOrigin(),
-            url.string(), activeFrame->loader()->outgoingReferrer(), lockHistory, lockBackForwardList);
-}
-
-} // namespace WebCore
+// FIXME: Remove this file.
 
 #endif // BindingFrame_h
diff --git a/WebCore/bindings/generic/BindingLocation.h b/WebCore/bindings/generic/BindingLocation.h
index ca52814..f988ab4 100644
--- a/WebCore/bindings/generic/BindingLocation.h
+++ b/WebCore/bindings/generic/BindingLocation.h
@@ -31,35 +31,6 @@
 #ifndef BindingLocation_h
 #define BindingLocation_h
 
-#include "BindingSecurity.h"
-#include "GenericBinding.h"
-#include "Location.h"
-
-namespace WebCore {
-
-template <class Binding>
-class BindingLocation {
-public:
-    static void replace(State<Binding>*, Location*, const String& url);
-};
-
-template <class Binding>
-void BindingLocation<Binding>::replace(State<Binding>* state, Location* location, const String& url)
-{
-    Frame* frame = location->frame();
-    if (!frame)
-        return;
-
-    KURL fullURL = completeURL(state, url);
-    if (fullURL.isNull())
-        return;
-
-    if (!BindingSecurity<Binding>::shouldAllowNavigation(state, frame))
-        return;
-
-    Binding::Frame::navigateIfAllowed(state, frame, fullURL, true, true);
-}
-
-} // namespace WebCore
+// FIXME: Remove this file.
 
 #endif // BindingLocation_h
diff --git a/WebCore/bindings/v8/V8Binding.h b/WebCore/bindings/v8/V8Binding.h
index 566e8ac..b2d5daa 100644
--- a/WebCore/bindings/v8/V8Binding.h
+++ b/WebCore/bindings/v8/V8Binding.h
@@ -31,8 +31,6 @@
 #ifndef V8Binding_h
 #define V8Binding_h
 
-#include "BindingFrame.h"
-#include "BindingLocation.h"
 #include "BindingSecurity.h"
 #include "MathExtras.h"
 #include "PlatformString.h"
@@ -45,17 +43,9 @@ namespace WebCore {
 
     class EventListener;
     class EventTarget;
-    class V8BindingDOMWindow;
 
-    // Instantiate binding template classes for V8.
+    // FIXME: Remove V8Binding.
     class V8Binding {
-    public:
-        typedef v8::Handle<v8::Value> Value;
-        typedef V8BindingDOMWindow DOMWindow;
-        typedef BindingFrame<V8Binding> Frame;
-        typedef BindingLocation<V8Binding> Location;
-
-        static Value emptyScriptValue() { return v8::Local<v8::Value>(); }
     };
     typedef BindingSecurity<V8Binding> V8BindingSecurity;
 
diff --git a/WebCore/bindings/v8/V8DOMWindowShell.cpp b/WebCore/bindings/v8/V8DOMWindowShell.cpp
index c1d2933..5bddbf3 100644
--- a/WebCore/bindings/v8/V8DOMWindowShell.cpp
+++ b/WebCore/bindings/v8/V8DOMWindowShell.cpp
@@ -578,20 +578,10 @@ v8::Local<v8::Object> V8DOMWindowShell::createWrapperFromCacheSlowCase(WrapperTy
     return notHandledByInterceptor();
 }
 
-void V8DOMWindowShell::setLocation(DOMWindow* window, const String& relativeURL)
+void V8DOMWindowShell::setLocation(DOMWindow* window, const String& locationString)
 {
-    Frame* frame = window->frame();
-    if (!frame)
-        return;
-
-    KURL url = completeURL(relativeURL);
-    if (url.isNull())
-        return;
-
-    if (!shouldAllowNavigation(frame))
-        return;
-
-    navigateIfAllowed(frame, url, false, false);
+    State<V8Binding>* state = V8BindingState::Only();
+    window->setLocation(locationString, state->activeWindow(), state->firstWindow());
 }
 
 } // WebCore
diff --git a/WebCore/bindings/v8/V8Utilities.cpp b/WebCore/bindings/v8/V8Utilities.cpp
index 7665a0a..eebe6b5 100644
--- a/WebCore/bindings/v8/V8Utilities.cpp
+++ b/WebCore/bindings/v8/V8Utilities.cpp
@@ -114,11 +114,6 @@ KURL completeURL(const String& relativeURL)
     return completeURL(V8BindingState::Only(), relativeURL);
 }
 
-void navigateIfAllowed(Frame* frame, const KURL& url, bool lockHistory, bool lockBackForwardList)
-{
-    return V8Binding::Frame::navigateIfAllowed(V8BindingState::Only(), frame, url, lockHistory, lockBackForwardList);
-}
-
 ScriptExecutionContext* getScriptExecutionContext()
 {
 #if ENABLE(WORKERS)
diff --git a/WebCore/bindings/v8/V8Utilities.h b/WebCore/bindings/v8/V8Utilities.h
index 2b82f4d..1892bb7 100644
--- a/WebCore/bindings/v8/V8Utilities.h
+++ b/WebCore/bindings/v8/V8Utilities.h
@@ -52,7 +52,6 @@ namespace WebCore {
     bool processingUserGesture();
     bool shouldAllowNavigation(Frame*);
     KURL completeURL(const String& relativeURL);
-    void navigateIfAllowed(Frame*, const KURL&, bool lockHistory, bool lockBackForwardList);
 
     ScriptExecutionContext* getScriptExecutionContext();
 
diff --git a/WebCore/bindings/v8/custom/V8LocationCustom.cpp b/WebCore/bindings/v8/custom/V8LocationCustom.cpp
index a13222f..e166323 100644
--- a/WebCore/bindings/v8/custom/V8LocationCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8LocationCustom.cpp
@@ -48,170 +48,103 @@
 
 namespace WebCore {
 
-// Notes about V8/JSC porting of this file.
-// This class is not very JS-engine specific.  If we can move a couple of
-// methods to the scriptController, we should be able to unify the code
-// between JSC and V8:
-//    toCallingFrame()   - in JSC, this needs an ExecState.
-//    isSafeScript()
-// Since JSC and V8 have different mechanisms for getting at the calling frame,
-// we're just making all these custom for now.  The functionality is simple
-// and mirrors JSLocationCustom.cpp.
-
 void V8Location::hashAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
 {
     INC_STATS("DOM.Location.hash._set");
-    v8::Handle<v8::Object> holder = info.Holder();
-    Location* imp = V8Location::toNative(holder);
-    String hash = toWebCoreString(value);
-
-    Frame* frame = imp->frame();
-    if (!frame)
-        return;
+    Location* impl = V8Location::toNative(info.Holder());
+    State<V8Binding>* state = V8BindingState::Only();
 
-    KURL url = frame->loader()->url();
-    String oldRef = url.fragmentIdentifier();
-
-    if (hash.startsWith("#"))
-        hash = hash.substring(1);
-
-    // Note that by parsing the URL and *then* comparing fragments, we are
-    // comparing fragments post-canonicalization, and so this handles the
-    // cases where fragment identifiers are ignored or invalid.
-    url.setFragmentIdentifier(hash);
-    String newRef = url.fragmentIdentifier();
-    if (oldRef == newRef || (oldRef.isNull() && newRef.isEmpty()))
-        return;
+    // FIXME: Handle exceptions correctly.
+    String hash = toWebCoreString(value);
 
-    navigateIfAllowed(frame, url, false, false);
+    impl->setHash(hash, state->activeWindow(), state->firstWindow());
 }
 
 void V8Location::hostAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
 {
     INC_STATS("DOM.Location.host._set");
-    v8::Handle<v8::Object> holder = info.Holder();
-    Location* imp = V8Location::toNative(holder);
-    String host = toWebCoreString(value);
-
-    Frame* frame = imp->frame();
-    if (!frame)
-        return;
+    Location* impl = V8Location::toNative(info.Holder());
+    State<V8Binding>* state = V8BindingState::Only();
 
-    KURL url = frame->loader()->url();
-    String newHost = host.left(host.find(":"));
-    String newPort = host.substring(host.find(":") + 1);
-    url.setHost(newHost);
-    url.setPort(newPort.toUInt());
+    // FIXME: Handle exceptions correctly.
+    String host = toWebCoreString(value);
 
-    navigateIfAllowed(frame, url, false, false);
+    impl->setHost(host, state->activeWindow(), state->firstWindow());
 }
 
 void V8Location::hostnameAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
 {
     INC_STATS("DOM.Location.hostname._set");
-    v8::Handle<v8::Object> holder = info.Holder();
-    Location* imp = V8Location::toNative(holder);
-    String hostname = toWebCoreString(value);
+    Location* impl = V8Location::toNative(info.Holder());
+    State<V8Binding>* state = V8BindingState::Only();
 
-    Frame* frame = imp->frame();
-    if (!frame)
-        return;
-
-    KURL url = frame->loader()->url();
-    url.setHost(hostname);
+    // FIXME: Handle exceptions correctly.
+    String hostname = toWebCoreString(value);
 
-    navigateIfAllowed(frame, url, false, false);
+    impl->setHostname(hostname, state->activeWindow(), state->firstWindow());
 }
 
 void V8Location::hrefAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
 {
     INC_STATS("DOM.Location.href._set");
-    v8::Handle<v8::Object> holder = info.Holder();
-    Location* imp = V8Location::toNative(holder);
+    Location* impl = V8Location::toNative(info.Holder());
+    State<V8Binding>* state = V8BindingState::Only();
 
-    Frame* frame = imp->frame();
-    if (!frame)
-        return;
+    // FIXME: Handle exceptions correctly.
+    String href = toWebCoreString(value);
 
-    KURL url = completeURL(toWebCoreString(value));
-    if (url.isNull())
-        return;
-
-    if (!shouldAllowNavigation(frame))
-        return;
-
-    navigateIfAllowed(frame, url, false, false);
+    impl->setHref(href, state->activeWindow(), state->firstWindow());
 }
 
 void V8Location::pathnameAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
 {
     INC_STATS("DOM.Location.pathname._set");
-    v8::Handle<v8::Object> holder = info.Holder();
-    Location* imp = V8Location::toNative(holder);
-    String pathname = toWebCoreString(value);
-
-    Frame* frame = imp->frame();
-    if (!frame)
-        return;
+    Location* impl = V8Location::toNative(info.Holder());
+    State<V8Binding>* state = V8BindingState::Only();
 
-    KURL url = frame->loader()->url();
-    url.setPath(pathname);
+    // FIXME: Handle exceptions correctly.
+    String pathname = toWebCoreString(value);
 
-    navigateIfAllowed(frame, url, false, false);
+    impl->setPathname(pathname, state->activeWindow(), state->firstWindow());
 }
 
 void V8Location::portAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
 {
     INC_STATS("DOM.Location.port._set");
-    v8::Handle<v8::Object> holder = info.Holder();
-    Location* imp = V8Location::toNative(holder);
-    String port = toWebCoreString(value);
-
-    Frame* frame = imp->frame();
-    if (!frame)
-        return;
+    Location* impl = V8Location::toNative(info.Holder());
+    State<V8Binding>* state = V8BindingState::Only();
 
-    KURL url = frame->loader()->url();
-    url.setPort(port.toUInt());
+    // FIXME: Handle exceptions correctly.
+    String port = toWebCoreString(value);
 
-    navigateIfAllowed(frame, url, false, false);
+    impl->setPort(port, state->activeWindow(), state->firstWindow());
 }
 
 void V8Location::protocolAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
 {
     INC_STATS("DOM.Location.protocol._set");
-    v8::Handle<v8::Object> holder = info.Holder();
-    Location* imp = V8Location::toNative(holder);
-    String protocol = toWebCoreString(value);
+    Location* impl = V8Location::toNative(info.Holder());
+    State<V8Binding>* state = V8BindingState::Only();
 
-    Frame* frame = imp->frame();
-    if (!frame)
-        return;
-
-    KURL url = frame->loader()->url();
-    if (!url.setProtocol(protocol)) {
-        throwError("Can't set protocol", V8Proxy::SyntaxError);
-        return;
-    }
+    // FIXME: Handle exceptions correctly.
+    String protocol = toWebCoreString(value);
 
-    navigateIfAllowed(frame, url, false, false);
+    ExceptionCode ec = 0;
+    impl->setProtocol(protocol, state->activeWindow(), state->firstWindow(), ec);
+    if (UNLIKELY(ec))
+        V8Proxy::setDOMException(ec);
 }
 
 void V8Location::searchAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
 {
     INC_STATS("DOM.Location.search._set");
-    v8::Handle<v8::Object> holder = info.Holder();
-    Location* imp = V8Location::toNative(holder);
-    String query = toWebCoreString(value);
-
-    Frame* frame = imp->frame();
-    if (!frame)
-        return;
+    Location* impl = V8Location::toNative(info.Holder());
+    State<V8Binding>* state = V8BindingState::Only();
 
-    KURL url = frame->loader()->url();
-    url.setQuery(query);
+    // FIXME: Handle exceptions correctly.
+    String search = toWebCoreString(value);
 
-    navigateIfAllowed(frame, url, false, false);
+    impl->setSearch(search, state->activeWindow(), state->firstWindow());
 }
 
 v8::Handle<v8::Value> V8Location::reloadAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
@@ -271,48 +204,37 @@ v8::Handle<v8::Value> V8Location::assignAccessorGetter(v8::Local<v8::String> nam
 
 v8::Handle<v8::Value> V8Location::reloadCallback(const v8::Arguments& args)
 {
-    // FIXME: we ignore the "forceget" parameter.
-
     INC_STATS("DOM.Location.reload");
-    v8::Handle<v8::Object> holder = args.Holder();
-    Location* imp = V8Location::toNative(holder);
-
-    Frame* frame = imp->frame();
-    if (!frame || !ScriptController::isSafeScript(frame))
-        return v8::Undefined();
+    Location* impl = V8Location::toNative(args.Holder());
+    State<V8Binding>* state = V8BindingState::Only();
 
-    if (!protocolIsJavaScript(frame->loader()->url()))
-        frame->navigationScheduler()->scheduleRefresh();
+    impl->reload(state->activeWindow());
     return v8::Undefined();
 }
 
 v8::Handle<v8::Value> V8Location::replaceCallback(const v8::Arguments& args)
 {
     INC_STATS("DOM.Location.replace");
-    v8::Handle<v8::Object> holder = args.Holder();
-    Location* imp = V8Location::toNative(holder);
-    V8Binding::Location::replace(V8BindingState::Only(), imp, toWebCoreString(args[0]));
+    Location* impl = V8Location::toNative(args.Holder());
+    State<V8Binding>* state = V8BindingState::Only();
+
+    // FIXME: Handle exceptions correctly.
+    String urlString = toWebCoreString(args[0]);
+
+    impl->replace(urlString, state->activeWindow(), state->firstWindow());
     return v8::Undefined();
 }
 
 v8::Handle<v8::Value> V8Location::assignCallback(const v8::Arguments& args)
 {
     INC_STATS("DOM.Location.assign");
-    v8::Handle<v8::Object> holder = args.Holder();
-    Location* imp = V8Location::toNative(holder);
-
-    Frame* frame = imp->frame();
-    if (!frame)
-        return v8::Undefined();
+    Location* impl = V8Location::toNative(args.Holder());
+    State<V8Binding>* state = V8BindingState::Only();
 
-    KURL url = completeURL(toWebCoreString(args[0]));
-    if (url.isNull())
-        return v8::Undefined();
-
-    if (!shouldAllowNavigation(frame))
-        return v8::Undefined();
+    // FIXME: Handle exceptions correctly.
+    String urlString = toWebCoreString(args[0]);
 
-    navigateIfAllowed(frame, url, false, false);
+    impl->assign(urlString, state->activeWindow(), state->firstWindow());
     return v8::Undefined();
 }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list