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

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

Issue 2763173002: Form submission with blank target is broken. (Closed)
Patch Set: Fix JS formatting. Created 3 years, 8 months 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 | « ios/web/web_state/js/resources/core.js ('k') | 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 2537 matching lines...) Expand 10 before | Expand all | Expand 10 after
2548 return YES; 2548 return YES;
2549 } 2549 }
2550 2550
2551 - (BOOL)handleDocumentSubmitMessage:(base::DictionaryValue*)message 2551 - (BOOL)handleDocumentSubmitMessage:(base::DictionaryValue*)message
2552 context:(NSDictionary*)context { 2552 context:(NSDictionary*)context {
2553 std::string href; 2553 std::string href;
2554 if (!message->GetString("href", &href)) { 2554 if (!message->GetString("href", &href)) {
2555 DLOG(WARNING) << "JS message parameter not found: href"; 2555 DLOG(WARNING) << "JS message parameter not found: href";
2556 return NO; 2556 return NO;
2557 } 2557 }
2558 const GURL targetURL(href);
2559 const GURL currentURL([self currentURL]);
2560 bool targetsFrame = false;
2561 message->GetBoolean("targetsFrame", &targetsFrame);
2562 if (!targetsFrame && web::UrlHasWebScheme(targetURL)) {
2563 // The referrer is not known yet, and will be updated later.
2564 const web::Referrer emptyReferrer;
2565 [self registerLoadRequest:targetURL
2566 referrer:emptyReferrer
2567 transition:ui::PAGE_TRANSITION_FORM_SUBMIT];
2568 }
2569 std::string formName; 2558 std::string formName;
2570 message->GetString("formName", &formName); 2559 message->GetString("formName", &formName);
2571 base::scoped_nsobject<NSSet> observers([_observers copy]); 2560 base::scoped_nsobject<NSSet> observers([_observers copy]);
2572 // We decide the form is user-submitted if the user has interacted with 2561 // We decide the form is user-submitted if the user has interacted with
2573 // the main page (using logic from the popup blocker), or if the keyboard 2562 // the main page (using logic from the popup blocker), or if the keyboard
2574 // is visible. 2563 // is visible.
2575 BOOL submittedByUser = [context[kUserIsInteractingKey] boolValue] || 2564 BOOL submittedByUser = [context[kUserIsInteractingKey] boolValue] ||
2576 [_webViewProxy keyboardAccessory]; 2565 [_webViewProxy keyboardAccessory];
2577 _webStateImpl->OnDocumentSubmitted(formName, submittedByUser); 2566 _webStateImpl->OnDocumentSubmitted(formName, submittedByUser);
2578 return YES; 2567 return YES;
(...skipping 2508 matching lines...) Expand 10 before | Expand all | Expand 10 after
5087 - (void)simulateLoadRequestWithURL:(const GURL&)URL { 5076 - (void)simulateLoadRequestWithURL:(const GURL&)URL {
5088 _lastRegisteredRequestURL = URL; 5077 _lastRegisteredRequestURL = URL;
5089 _loadPhase = web::LOAD_REQUESTED; 5078 _loadPhase = web::LOAD_REQUESTED;
5090 } 5079 }
5091 5080
5092 - (NSString*)referrerFromNavigationAction:(WKNavigationAction*)action { 5081 - (NSString*)referrerFromNavigationAction:(WKNavigationAction*)action {
5093 return [action.request valueForHTTPHeaderField:kReferrerHeaderName]; 5082 return [action.request valueForHTTPHeaderField:kReferrerHeaderName];
5094 } 5083 }
5095 5084
5096 @end 5085 @end
OLDNEW
« no previous file with comments | « ios/web/web_state/js/resources/core.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698