summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/tab_contents/navigation_controller.cc7
-rw-r--r--chrome/browser/tab_contents/navigation_controller.h2
-rw-r--r--chrome/browser/tab_contents/navigation_controller_unittest.cc41
-rw-r--r--chrome/renderer/render_thread.cc2
-rw-r--r--chrome/renderer/render_view.cc2
-rw-r--r--chrome/renderer/render_view.h2
-rw-r--r--webkit/glue/glue_serialize.cc18
-rw-r--r--webkit/tools/layout_tests/test_expectations.txt9
-rw-r--r--webkit/tools/test_shell/test_shell_webkit_init.h1
-rw-r--r--webkit/tools/test_shell/test_webview_delegate.cc12
-rw-r--r--webkit/tools/test_shell/test_webview_delegate.h4
11 files changed, 75 insertions, 25 deletions
diff --git a/chrome/browser/tab_contents/navigation_controller.cc b/chrome/browser/tab_contents/navigation_controller.cc
index 85eaa1d..96e5fa9 100644
--- a/chrome/browser/tab_contents/navigation_controller.cc
+++ b/chrome/browser/tab_contents/navigation_controller.cc
@@ -795,9 +795,10 @@ void NavigationController::RendererDidNavigateInPage(
if (new_entry->update_virtual_url_with_url())
UpdateVirtualURLToURL(new_entry, params.url);
new_entry->set_url(params.url);
- *did_replace_entry = IsRedirect(params) &&
- IsLikelyAutoNavigation(base::TimeTicks::Now());
- InsertOrReplaceEntry(new_entry, *did_replace_entry);
+
+ // This replaces the existing entry since the page ID didn't change.
+ *did_replace_entry = true;
+ InsertOrReplaceEntry(new_entry, true);
}
void NavigationController::RendererDidNavigateNewSubframe(
diff --git a/chrome/browser/tab_contents/navigation_controller.h b/chrome/browser/tab_contents/navigation_controller.h
index 810f8b9..1efdc3d 100644
--- a/chrome/browser/tab_contents/navigation_controller.h
+++ b/chrome/browser/tab_contents/navigation_controller.h
@@ -89,7 +89,7 @@ class NavigationController {
bool is_auto;
// True if the committed entry has replaced the exisiting one.
- // A non-user initiated redierct causes such replacement.
+ // A non-user initiated redirect causes such replacement.
// This is somewhat similiar to is_auto, but not exactly the same.
bool did_replace_entry;
diff --git a/chrome/browser/tab_contents/navigation_controller_unittest.cc b/chrome/browser/tab_contents/navigation_controller_unittest.cc
index f880eed..f5d3ae1 100644
--- a/chrome/browser/tab_contents/navigation_controller_unittest.cc
+++ b/chrome/browser/tab_contents/navigation_controller_unittest.cc
@@ -1043,15 +1043,14 @@ TEST_F(NavigationControllerTest, InPage) {
TestNotificationTracker notifications;
RegisterForAllNavNotifications(&notifications, &controller());
- // Main page. Note that we need "://" so this URL is treated as "standard"
- // which are the only ones that can have a ref.
- const GURL url1("http:////foo");
+ // Main page.
+ const GURL url1("http://foo");
rvh()->SendNavigate(0, url1);
EXPECT_TRUE(notifications.Check1AndReset(
NotificationType::NAV_ENTRY_COMMITTED));
// First navigation.
- const GURL url2("http:////foo#a");
+ const GURL url2("http://foo#a");
ViewHostMsg_FrameNavigate_Params params = {0};
params.page_id = 1;
params.url = url2;
@@ -1066,6 +1065,7 @@ TEST_F(NavigationControllerTest, InPage) {
EXPECT_TRUE(notifications.Check1AndReset(
NotificationType::NAV_ENTRY_COMMITTED));
EXPECT_TRUE(details.is_in_page);
+ EXPECT_FALSE(details.did_replace_entry);
EXPECT_EQ(2, controller().entry_count());
// Go back one.
@@ -1109,7 +1109,7 @@ TEST_F(NavigationControllerTest, InPage) {
controller().GetActiveEntry()->url());
// Finally, navigate to an unrelated URL to make sure in_page is not sticky.
- const GURL url3("http:////bar");
+ const GURL url3("http://bar");
params.page_id = 2;
params.url = url3;
notifications.Reset();
@@ -1119,6 +1119,37 @@ TEST_F(NavigationControllerTest, InPage) {
EXPECT_FALSE(details.is_in_page);
}
+TEST_F(NavigationControllerTest, InPage_Replace) {
+ TestNotificationTracker notifications;
+ RegisterForAllNavNotifications(&notifications, &controller());
+
+ // Main page.
+ const GURL url1("http://foo");
+ rvh()->SendNavigate(0, url1);
+ EXPECT_TRUE(notifications.Check1AndReset(
+ NotificationType::NAV_ENTRY_COMMITTED));
+
+ // First navigation.
+ const GURL url2("http://foo#a");
+ ViewHostMsg_FrameNavigate_Params params = {0};
+ params.page_id = 0; // Same page_id
+ params.url = url2;
+ params.transition = PageTransition::LINK;
+ params.should_update_history = false;
+ params.gesture = NavigationGestureUser;
+ params.is_post = false;
+
+ // This should NOT generate a new entry.
+ NavigationController::LoadCommittedDetails details;
+ EXPECT_TRUE(controller().RendererDidNavigate(params, 0, &details));
+ EXPECT_TRUE(notifications.Check2AndReset(
+ NotificationType::NAV_LIST_PRUNED,
+ NotificationType::NAV_ENTRY_COMMITTED));
+ EXPECT_TRUE(details.is_in_page);
+ EXPECT_TRUE(details.did_replace_entry);
+ EXPECT_EQ(1, controller().entry_count());
+}
+
// NotificationObserver implementation used in verifying we've received the
// NotificationType::NAV_LIST_PRUNED method.
class PrunedListener : public NotificationObserver {
diff --git a/chrome/renderer/render_thread.cc b/chrome/renderer/render_thread.cc
index bc9a2a5..ad4ec2a 100644
--- a/chrome/renderer/render_thread.cc
+++ b/chrome/renderer/render_thread.cc
@@ -817,6 +817,8 @@ void RenderThread::EnsureWebKitInitialized() {
WebRuntimeFeatures::enableWebGL(
command_line.HasSwitch(switches::kEnableExperimentalWebGL));
+
+ WebRuntimeFeatures::enablePushState(true);
}
void RenderThread::IdleHandler() {
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index 3624f3f..a3c2ec6 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -2711,7 +2711,7 @@ void RenderView::didFinishLoad(WebFrame* frame) {
navigation_state->user_script_idle_scheduler()->DidFinishLoad();
}
-void RenderView::didChangeLocationWithinPage(
+void RenderView::didNavigateWithinPage(
WebFrame* frame, bool is_new_navigation) {
// Determine if the UserScriptIdleScheduler already ran scripts on this page,
diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h
index c2cf199..dc3f0d22 100644
--- a/chrome/renderer/render_view.h
+++ b/chrome/renderer/render_view.h
@@ -352,7 +352,7 @@ class RenderView : public RenderWidget,
virtual void didFailLoad(
WebKit::WebFrame* frame, const WebKit::WebURLError& error);
virtual void didFinishLoad(WebKit::WebFrame* frame);
- virtual void didChangeLocationWithinPage(
+ virtual void didNavigateWithinPage(
WebKit::WebFrame* frame, bool is_new_navigation);
virtual void didUpdateCurrentHistoryItem(WebKit::WebFrame* frame);
virtual void assignIdentifierToRequest(
diff --git a/webkit/glue/glue_serialize.cc b/webkit/glue/glue_serialize.cc
index f27b549..802f57d 100644
--- a/webkit/glue/glue_serialize.cc
+++ b/webkit/glue/glue_serialize.cc
@@ -13,6 +13,7 @@
#include "third_party/WebKit/WebKit/chromium/public/WebHistoryItem.h"
#include "third_party/WebKit/WebKit/chromium/public/WebHTTPBody.h"
#include "third_party/WebKit/WebKit/chromium/public/WebPoint.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebSerializedScriptValue.h"
#include "third_party/WebKit/WebKit/chromium/public/WebString.h"
#include "third_party/WebKit/WebKit/chromium/public/WebVector.h"
#include "webkit/glue/webkit_glue.h"
@@ -21,6 +22,7 @@ using WebKit::WebData;
using WebKit::WebHistoryItem;
using WebKit::WebHTTPBody;
using WebKit::WebPoint;
+using WebKit::WebSerializedScriptValue;
using WebKit::WebString;
using WebKit::WebUChar;
using WebKit::WebVector;
@@ -50,12 +52,13 @@ struct SerializeObject {
// 4: Adds support for storing FormData::identifier().
// 5: Adds support for empty FormData
// 6: Adds support for documentSequenceNumbers
+// 7: Adds support for stateObject
// Should be const, but unit tests may modify it.
//
// NOTE: If the version is -1, then the pickle contains only a URL string.
// See CreateHistoryStateForURL.
//
-int kVersion = 6;
+int kVersion = 7;
// A bunch of convenience functions to read/write to SerializeObjects.
// The serializers assume the input data is in the correct format and so does
@@ -290,6 +293,12 @@ static void WriteHistoryItem(
if (kVersion >= 6)
WriteInteger64(item.documentSequenceNumber(), obj);
+ if (kVersion >= 7) {
+ bool has_state_object = !item.stateObject().isNull();
+ WriteBoolean(has_state_object, obj);
+ if (has_state_object)
+ WriteString(item.stateObject().toString(), obj);
+ }
// Yes, the referrer is written twice. This is for backwards
// compatibility with the format.
@@ -343,6 +352,13 @@ static WebHistoryItem ReadHistoryItem(
if (obj->version >= 6)
item.setDocumentSequenceNumber(ReadInteger64(obj));
+ if (obj->version >= 7) {
+ bool has_state_object = ReadBoolean(obj);
+ if (has_state_object) {
+ item.setStateObject(
+ WebSerializedScriptValue::fromString(ReadString(obj)));
+ }
+ }
// The extra referrer string is read for backwards compat.
const WebHTTPBody& http_body = ReadFormData(obj);
diff --git a/webkit/tools/layout_tests/test_expectations.txt b/webkit/tools/layout_tests/test_expectations.txt
index 7229689..e74dd72 100644
--- a/webkit/tools/layout_tests/test_expectations.txt
+++ b/webkit/tools/layout_tests/test_expectations.txt
@@ -2398,10 +2398,8 @@ BUG29167 MAC DEBUG : fast/dom/replaceChild.html = IMAGE PASS
BUG29239 : fast/css/variables/misplaced-import-test.html = FAIL
// Failures from WebKit merge 51642:51681
-// Skip these tests since they all timeout and add ~1 minute to cycle time!
-BUG29393 SKIP DEFER : fast/loader/stateobjects = TIMEOUT
-// Asserts in DEBUG, will continue until we implement pushState.
-BUG29393 SKIP : fast/loader/document-with-fragment-url-3.html = CRASH
+BUG29393 : fast/loader/stateobjects/pushstate-object-types.html = TEXT
+BUG29393 : fast/loader/stateobjects/state-api-on-detached-frame-crash.html = TEXT
BUG29944 WIN : websocket/tests/unicode.html = TEXT PASS
@@ -2768,9 +2766,6 @@ BUG_JIANLI : http/tests/local/send-sliced-dragged-file.html = FAIL
// WebKit roll 55670 -> 55674
BUG37684 SKIP : http/tests/cookies/third-party-cookie-relaxing.html = FAIL
-// WebKit roll r55683 -> r55709
-BUG29393 : http/tests/loading/state-object-security-exception.html = TEXT
-
// Bugs that went unreported when we upstreamed run_webkit_tests
BUG37896 MAC LINUX : fast/backgrounds/animated-svg-as-background.html = IMAGE
// New test, added http://trac.webkit.org/changeset/55737
diff --git a/webkit/tools/test_shell/test_shell_webkit_init.h b/webkit/tools/test_shell/test_shell_webkit_init.h
index afff8ca..c182269 100644
--- a/webkit/tools/test_shell/test_shell_webkit_init.h
+++ b/webkit/tools/test_shell/test_shell_webkit_init.h
@@ -62,6 +62,7 @@ class TestShellWebKitInit : public webkit_glue::WebKitClientImpl {
WebKit::WebRuntimeFeatures::enableApplicationCache(true);
WebKit::WebRuntimeFeatures::enableDatabase(true);
WebKit::WebRuntimeFeatures::enableWebGL(true);
+ WebKit::WebRuntimeFeatures::enablePushState(true);
// Load libraries for media and enable the media player.
FilePath module_path;
diff --git a/webkit/tools/test_shell/test_webview_delegate.cc b/webkit/tools/test_shell/test_webview_delegate.cc
index ff019cd..b1d9993 100644
--- a/webkit/tools/test_shell/test_webview_delegate.cc
+++ b/webkit/tools/test_shell/test_webview_delegate.cc
@@ -877,16 +877,18 @@ void TestWebViewDelegate::didFinishLoad(WebFrame* frame) {
LocationChangeDone(frame);
}
-void TestWebViewDelegate::didChangeLocationWithinPage(
+void TestWebViewDelegate::didNavigateWithinPage(
WebFrame* frame, bool is_new_navigation) {
frame->dataSource()->setExtraData(pending_extra_data_.release());
+ UpdateForCommittedLoad(frame, is_new_navigation);
+}
+
+void TestWebViewDelegate::didChangeLocationWithinPage(WebFrame* frame) {
if (shell_->ShouldDumpFrameLoadCallbacks()) {
printf("%S - didChangeLocationWithinPageForFrame\n",
GetFrameDescription(frame).c_str());
}
-
- UpdateForCommittedLoad(frame, is_new_navigation);
}
void TestWebViewDelegate::assignIdentifierToRequest(
@@ -1087,8 +1089,7 @@ void TestWebViewDelegate::UpdateAddressBar(WebView* webView) {
if (!data_source)
return;
- // TODO(abarth): This is wrong!
- SetAddressBarURL(data_source->request().firstPartyForCookies());
+ SetAddressBarURL(data_source->request().url());
}
void TestWebViewDelegate::LocationChangeDone(WebFrame* frame) {
@@ -1156,6 +1157,7 @@ void TestWebViewDelegate::UpdateURL(WebFrame* frame) {
shell_->navigation_controller()->DidNavigateToEntry(entry.release());
shell_->UpdateNavigationControls();
+ UpdateAddressBar(frame->view());
last_page_id_updated_ = std::max(last_page_id_updated_, page_id_);
}
diff --git a/webkit/tools/test_shell/test_webview_delegate.h b/webkit/tools/test_shell/test_webview_delegate.h
index 8b12590..f6b4ace 100644
--- a/webkit/tools/test_shell/test_webview_delegate.h
+++ b/webkit/tools/test_shell/test_webview_delegate.h
@@ -190,8 +190,10 @@ class TestWebViewDelegate : public WebKit::WebViewClient,
virtual void didFailLoad(
WebKit::WebFrame*, const WebKit::WebURLError&);
virtual void didFinishLoad(WebKit::WebFrame*);
+ virtual void didNavigateWithinPage(
+ WebKit::WebFrame*, bool is_new_navigation);
virtual void didChangeLocationWithinPage(
- WebKit::WebFrame*, bool isNewNavigation);
+ WebKit::WebFrame*);
virtual void assignIdentifierToRequest(
WebKit::WebFrame*, unsigned identifier, const WebKit::WebURLRequest&);
virtual void willSendRequest(