Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Side by Side Diff: ios/web/web_state/ui/crw_web_controller.mm

Issue 2565673003: Fix window.history.go() with no parameter. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "ios/web/web_state/ui/crw_web_controller.h" 5 #import "ios/web/web_state/ui/crw_web_controller.h"
6 6
7 #import <WebKit/WebKit.h> 7 #import <WebKit/WebKit.h>
8 8
9 #import <objc/runtime.h> 9 #import <objc/runtime.h>
10 #include <stddef.h> 10 #include <stddef.h>
(...skipping 3066 matching lines...) Expand 10 before | Expand all | Expand 10 after
3077 } 3077 }
3078 3078
3079 - (BOOL)handleWindowHistoryForwardMessage:(base::DictionaryValue*)message 3079 - (BOOL)handleWindowHistoryForwardMessage:(base::DictionaryValue*)message
3080 context:(NSDictionary*)context { 3080 context:(NSDictionary*)context {
3081 [self goDelta:1]; 3081 [self goDelta:1];
3082 return YES; 3082 return YES;
3083 } 3083 }
3084 3084
3085 - (BOOL)handleWindowHistoryGoMessage:(base::DictionaryValue*)message 3085 - (BOOL)handleWindowHistoryGoMessage:(base::DictionaryValue*)message
3086 context:(NSDictionary*)context { 3086 context:(NSDictionary*)context {
3087 std::string valueKey = "value";
3088 if (!message->HasKey(valueKey)) {
3089 // window.history.go() with no input parameter should behave as
Eugene But (OOO till 7-30) 2016/12/09 22:58:19 Should we fix this in JS as follows?: |invokeOnHo
kkhorimoto 2016/12/13 00:30:56 Done.
3090 // window.history.go(0).
3091 [self goDelta:0];
3092 return YES;
3093 }
3087 int delta = 0; 3094 int delta = 0;
3088 if (message->GetInteger("value", &delta)) { 3095 if (message->GetInteger(valueKey, &delta)) {
3089 [self goDelta:delta]; 3096 [self goDelta:delta];
3090 return YES; 3097 return YES;
3091 } 3098 }
3092 return NO; 3099 return NO;
3093 } 3100 }
3094 3101
3095 - (BOOL)handleWindowHistoryWillChangeStateMessage:(base::DictionaryValue*)unused 3102 - (BOOL)handleWindowHistoryWillChangeStateMessage:(base::DictionaryValue*)unused
3096 context:(NSDictionary*)unusedContext { 3103 context:(NSDictionary*)unusedContext {
3097 _changingHistoryState = YES; 3104 _changingHistoryState = YES;
3098 return YES; 3105 return YES;
(...skipping 2693 matching lines...) Expand 10 before | Expand all | Expand 10 after
5792 } 5799 }
5793 5800
5794 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC; 5801 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC;
5795 } 5802 }
5796 5803
5797 - (NSString*)refererFromNavigationAction:(WKNavigationAction*)action { 5804 - (NSString*)refererFromNavigationAction:(WKNavigationAction*)action {
5798 return [action.request valueForHTTPHeaderField:@"Referer"]; 5805 return [action.request valueForHTTPHeaderField:@"Referer"];
5799 } 5806 }
5800 5807
5801 @end 5808 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698