diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-17 17:58:43 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-17 17:58:43 +0000 |
commit | ccbe04e3b032c3a3acbf6a2221ee1f90b39c4598 (patch) | |
tree | b8be8967400bf09d66e47738a950483f1bfd563a /webkit/glue/glue_serialize.cc | |
parent | 0bda44defc2da589b24c6936d8ac55b979eb8901 (diff) | |
download | chromium_src-ccbe04e3b032c3a3acbf6a2221ee1f90b39c4598.zip chromium_src-ccbe04e3b032c3a3acbf6a2221ee1f90b39c4598.tar.gz chromium_src-ccbe04e3b032c3a3acbf6a2221ee1f90b39c4598.tar.bz2 |
Add chromium-side support for history.{push,replace}State.
Enables the feature so that all but 2 of the related layout tests pass.
Modifies TestShell to correctly update its location bar as navigations occur.
It was incorrectly showing firstPartyForCookies for some crazy reason.
Modifies glue_serialize.cc to store the state object associated with a session
history entry.
Modifies navigation_controller.cc to always replace the current navigation
entry when observing an in-page navigation. This is required since the page ID
isn't changing for an in-page navigation.
BUG=29393
R=brettw
TEST=covered by layout tests
Review URL: http://codereview.chromium.org/1036003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41850 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/glue_serialize.cc')
-rw-r--r-- | webkit/glue/glue_serialize.cc | 18 |
1 files changed, 17 insertions, 1 deletions
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); |