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

Side by Side Diff: ios/web/web_state/ui/web_view_js_utils.h

Issue 2335483004: Limit depth of parsing of dictionaries returned by JS evaluation. (Closed)
Patch Set: Addressed comment. Created 4 years, 3 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 | « no previous file | ios/web/web_state/ui/web_view_js_utils.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef IOS_WEB_WEB_STATE_UI_WEB_VIEW_JS_UTILS_H_ 5 #ifndef IOS_WEB_WEB_STATE_UI_WEB_VIEW_JS_UTILS_H_
6 #define IOS_WEB_WEB_STATE_UI_WEB_VIEW_JS_UTILS_H_ 6 #define IOS_WEB_WEB_STATE_UI_WEB_VIEW_JS_UTILS_H_
7 7
8 #import <Foundation/Foundation.h> 8 #import <Foundation/Foundation.h>
9 #include <memory> 9 #include <memory>
10 10
11 #include "ios/web/public/block_types.h" 11 #include "ios/web/public/block_types.h"
12 12
13 @class WKWebView; 13 @class WKWebView;
14 14
15 namespace base { 15 namespace base {
16 class Value; 16 class Value;
17 } // namespace base 17 } // namespace base
18 18
19 namespace web { 19 namespace web {
20 20
21 // The domain for JS evaluation NSErrors in web. 21 // The domain for JS evaluation NSErrors in web.
22 extern NSString* const kJSEvaluationErrorDomain; 22 extern NSString* const kJSEvaluationErrorDomain;
23 23
24 // The maximum recursion depth when parsing JS results.
25 extern int const kMaximumParsingRecursionDepth;
26
24 // The type of errors that can occur while evaluating JS. 27 // The type of errors that can occur while evaluating JS.
25 enum JSEvaluationErrorCode { 28 enum JSEvaluationErrorCode {
26 // No web view present to evaluate JS. 29 // No web view present to evaluate JS.
27 JS_EVALUATION_ERROR_CODE_NO_WEB_VIEW = 1, 30 JS_EVALUATION_ERROR_CODE_NO_WEB_VIEW = 1,
28 }; 31 };
29 32
30 // Converts result of WKWebView script evaluation to base::Value. 33 // Converts result of WKWebView script evaluation to base::Value.
31 std::unique_ptr<base::Value> ValueResultFromWKResult(id result); 34 std::unique_ptr<base::Value> ValueResultFromWKResult(id result);
32 35
33 // Executes JavaScript on WKWebView. If the web view cannot execute JS at the 36 // Executes JavaScript on WKWebView. If the web view cannot execute JS at the
34 // moment, |completion_handler| is called with an NSError. 37 // moment, |completion_handler| is called with an NSError.
35 void ExecuteJavaScript(WKWebView* web_view, 38 void ExecuteJavaScript(WKWebView* web_view,
36 NSString* script, 39 NSString* script,
37 JavaScriptResultBlock completion_handler); 40 JavaScriptResultBlock completion_handler);
38 41
39 } // namespace web 42 } // namespace web
40 43
41 #endif // IOS_WEB_WEB_STATE_UI_WEB_VIEW_JS_UTILS_H_ 44 #endif // IOS_WEB_WEB_STATE_UI_WEB_VIEW_JS_UTILS_H_
OLDNEW
« no previous file with comments | « no previous file | ios/web/web_state/ui/web_view_js_utils.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698