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

Unified Diff: ios/web/public/test/web_view_interaction_test_util.mm

Issue 2761173002: Disallow JS execution on WebUI pages. (Closed)
Patch Set: Addressed review comments Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/chrome/browser/ui/toolbar/toolbar_egtest.mm ('k') | ios/web/web_state/ui/crw_web_controller.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/public/test/web_view_interaction_test_util.mm
diff --git a/ios/web/public/test/web_view_interaction_test_util.mm b/ios/web/public/test/web_view_interaction_test_util.mm
index da4e786561c629b4084dad239cb5510a9b337e37..9e629c5d7f980c8fc58acb553ce15feaacfae0a6 100644
--- a/ios/web/public/test/web_view_interaction_test_util.mm
+++ b/ios/web/public/test/web_view_interaction_test_util.mm
@@ -142,11 +142,15 @@ bool RunActionOnWebViewElementWithId(web::WebState* web_state,
element_id.c_str(), js_action];
__block bool did_complete = false;
__block bool element_found = false;
- [web_controller executeUserJavaScript:script
- completionHandler:^(id result, NSError*) {
- did_complete = true;
- element_found = [result boolValue];
- }];
+
+ // |executeUserJavaScript:completionHandler:| is no-op for app-specific URLs,
+ // so simulate a user gesture by calling TouchTracking method.
+ [web_controller touched:YES];
+ [web_controller executeJavaScript:script
+ completionHandler:^(id result, NSError*) {
+ did_complete = true;
+ element_found = [result boolValue];
+ }];
testing::WaitUntilConditionOrTimeout(testing::kWaitForJSCompletionTimeout, ^{
return did_complete;
« no previous file with comments | « ios/chrome/browser/ui/toolbar/toolbar_egtest.mm ('k') | ios/web/web_state/ui/crw_web_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698