New History changes do not compile for Chromium/V8
authoratwilson@chromium.org <atwilson@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Dec 2009 06:40:56 +0000 (06:40 +0000)
committeratwilson@chromium.org <atwilson@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Dec 2009 06:40:56 +0000 (06:40 +0000)
https://bugs.webkit.org/show_bug.cgi?id=32148

Reviewed by Adam Barth.

Existing tests suffice (just trying to get code to compile).

* WebCore.gypi:
Added V8HistoryCustom.cpp and other missing files.
* bindings/v8/custom/V8CustomBinding.h:
Added custom handlers for History.pushState()/replaceState().
* bindings/v8/custom/V8HistoryCustom.cpp: Added.
Added custom handlers for History.pushState()/replaceState().
* history/BackForwardListChromium.cpp:
(WebCore::BackForwardList::pushStateItem):
Stubbed out this routine for now - will implement in the future.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@51681 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/WebCore.gypi
WebCore/bindings/v8/custom/V8CustomBinding.h
WebCore/bindings/v8/custom/V8HistoryCustom.cpp [new file with mode: 0644]
WebCore/history/BackForwardListChromium.cpp

index 2b3587ea743e2d1886a92f77496ac66c2cfc2c56..2972fd4ce7a103bb68633b478a026a908cc6595c 100644 (file)
@@ -1,3 +1,22 @@
+2009-12-03  Drew Wilson  <atwilson@chromium.org>
+
+        Reviewed by Adam Barth.
+
+        New History changes do not compile for Chromium/V8
+        https://bugs.webkit.org/show_bug.cgi?id=32148
+
+        Existing tests suffice (just trying to get code to compile).
+
+        * WebCore.gypi:
+        Added V8HistoryCustom.cpp and other missing files.
+        * bindings/v8/custom/V8CustomBinding.h:
+        Added custom handlers for History.pushState()/replaceState().
+        * bindings/v8/custom/V8HistoryCustom.cpp: Added.
+        Added custom handlers for History.pushState()/replaceState().
+        * history/BackForwardListChromium.cpp:
+        (WebCore::BackForwardList::pushStateItem):
+        Stubbed out this routine for now - will implement in the future.
+
 2009-12-03  Adam Barth  <abarth@webkit.org>
 
         Reviewed by Eric Seidel.
index af25f4e79ba478d6da7aa287783310d2f285bade..c88f81ef0b25a01dc5e2646b6d6fea9357b0f778 100644 (file)
@@ -66,6 +66,7 @@
             'dom/Notation.idl',
             'dom/OverflowEvent.idl',
             'dom/PageTransitionEvent.idl',
+            'dom/PopStateEvent.idl',
             'dom/ProcessingInstruction.idl',
             'dom/ProgressEvent.idl',
             'dom/Range.idl',
             'bindings/v8/custom/V8EventCustom.cpp',
             'bindings/v8/custom/V8FileListCustom.cpp',
             'bindings/v8/custom/V8GeolocationCustom.cpp',
+            'bindings/v8/custom/V8HistoryCustom.cpp',
             'bindings/v8/custom/V8HTMLAudioElementConstructor.cpp',
             'bindings/v8/custom/V8HTMLAudioElementConstructor.h',
             'bindings/v8/custom/V8HTMLAllCollectionCustom.cpp',
             'dom/OptionGroupElement.h',
             'dom/OverflowEvent.cpp',
             'dom/OverflowEvent.h',
+            'dom/PopStateEvent.cpp',
+            'dom/PopStateEvent.h',
             'dom/PageTransitionEvent.cpp',
             'dom/PageTransitionEvent.h',
             'dom/Position.cpp',
             'platform/chromium/FramelessScrollView.cpp',
             'platform/chromium/FramelessScrollView.h',
             'platform/chromium/FramelessScrollViewClient.h',
-            'platform/chromium/GeolocationServiceChromium.cpp',
             'platform/chromium/KeyCodeConversion.h',
             'platform/chromium/KeyCodeConversionGtk.cpp',
             'platform/chromium/KeyboardCodesPosix.h',
index 5e3fe6694ebeebf5c4cf6083e6a065a22de9fa1f..d2735bd07da40ed5b2d194e6988c2ab68914a762 100644 (file)
@@ -417,6 +417,9 @@ namespace WebCore {
         DECLARE_CALLBACK(ElementSetAttributeNS);
         DECLARE_CALLBACK(ElementSetAttributeNodeNS);
 
+        DECLARE_CALLBACK(HistoryPushState);
+        DECLARE_CALLBACK(HistoryReplaceState);
+
         DECLARE_PROPERTY_ACCESSOR_SETTER(LocationProtocol);
         DECLARE_PROPERTY_ACCESSOR_SETTER(LocationHost);
         DECLARE_PROPERTY_ACCESSOR_SETTER(LocationHostname);
@@ -433,7 +436,6 @@ namespace WebCore {
         DECLARE_CALLBACK(LocationReload);
         DECLARE_CALLBACK(LocationToString);
         DECLARE_CALLBACK(LocationValueOf);
-
         DECLARE_CALLBACK(NodeAddEventListener);
         DECLARE_CALLBACK(NodeRemoveEventListener);
         DECLARE_CALLBACK(NodeInsertBefore);
diff --git a/WebCore/bindings/v8/custom/V8HistoryCustom.cpp b/WebCore/bindings/v8/custom/V8HistoryCustom.cpp
new file mode 100644 (file)
index 0000000..c884d15
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "History.h"
+
+#include "ExceptionCode.h"
+#include "SerializedScriptValue.h"
+#include "V8Binding.h"
+#include "V8CustomBinding.h"
+#include "V8Proxy.h"
+
+namespace WebCore {
+CALLBACK_FUNC_DECL(HistoryPushState)
+{
+    RefPtr<SerializedScriptValue> historyState = SerializedScriptValue::create(toWebCoreString(args[0]));
+
+    v8::TryCatch tryCatch;
+    String title = toWebCoreStringWithNullOrUndefinedCheck(args[1]);
+    if (tryCatch.HasCaught())
+        return v8::Undefined();
+    String url;
+    if (args.Length() > 2) {
+        url = toWebCoreStringWithNullOrUndefinedCheck(args[2]);
+        if (tryCatch.HasCaught())
+            return v8::Undefined();
+    }
+
+    ExceptionCode ec = 0;
+    History* history = V8DOMWrapper::convertToNativeObject<History>(V8ClassIndex::HISTORY, args.Holder());
+    history->stateObjectAdded(historyState.release(), title, url, History::StateObjectPush, ec);
+    return throwError(ec);
+}
+
+CALLBACK_FUNC_DECL(HistoryReplaceState)
+{
+    RefPtr<SerializedScriptValue> historyState = SerializedScriptValue::create(toWebCoreString(args[0]));
+
+    v8::TryCatch tryCatch;
+    String title = toWebCoreStringWithNullOrUndefinedCheck(args[1]);
+    if (tryCatch.HasCaught())
+        return v8::Undefined();
+    String url;
+    if (args.Length() > 2) {
+        url = toWebCoreStringWithNullOrUndefinedCheck(args[2]);
+        if (tryCatch.HasCaught())
+            return v8::Undefined();
+    }
+
+    ExceptionCode ec = 0;
+    History* history = V8DOMWrapper::convertToNativeObject<History>(V8ClassIndex::HISTORY, args.Holder());
+    history->stateObjectAdded(historyState.release(), title, url, History::StateObjectReplace, ec);
+    return throwError(ec);
+}
+
+} // namespace WebCore
index 34f294ca844a71369c083b6bb1d6a1420b0afb2c..f539e807e7aed31945f04b8ea795bca715d8dce7 100644 (file)
@@ -121,6 +121,11 @@ HistoryItem* BackForwardList::itemAtIndex(int index)
     return m_client->itemAtIndex(index);
 }
 
+void BackForwardList::pushStateItem(PassRefPtr<HistoryItem> newItem)
+{
+  // FIXME: Need to implement state support for chromium.
+}
+
 HistoryItemVector& BackForwardList::entries()
 {
     static HistoryItemVector noEntries;