| Index: ios/web/web_state/ui/web_view_js_utils.mm
|
| diff --git a/ios/web/web_state/ui/web_view_js_utils.mm b/ios/web/web_state/ui/web_view_js_utils.mm
|
| index 1afe2d8a9ba9d9cbe6f6463aa4df09fa90d931a6..6bdca3bbceaef1ee18faa5c4734e158c3356ed66 100644
|
| --- a/ios/web/web_state/ui/web_view_js_utils.mm
|
| +++ b/ios/web/web_state/ui/web_view_js_utils.mm
|
| @@ -9,11 +9,14 @@
|
|
|
| #include "base/logging.h"
|
| #include "base/mac/foundation_util.h"
|
| -#import "base/mac/scoped_nsobject.h"
|
| #include "base/memory/ptr_util.h"
|
| #include "base/strings/sys_string_conversions.h"
|
| #include "base/values.h"
|
|
|
| +#if !defined(__has_feature) || !__has_feature(objc_arc)
|
| +#error "This file requires ARC support."
|
| +#endif
|
| +
|
| namespace {
|
|
|
| // Converts result of WKWebView script evaluation to base::Value, parsing
|
| @@ -30,7 +33,8 @@ std::unique_ptr<base::Value> ValueResultFromWKResult(id wk_result,
|
| return result;
|
| }
|
|
|
| - CFTypeID result_type = CFGetTypeID(wk_result);
|
| + CFTypeRef typeRef = (__bridge CFTypeRef)wk_result;
|
| + CFTypeID result_type = CFGetTypeID(typeRef);
|
| if (result_type == CFStringGetTypeID()) {
|
| result.reset(new base::Value(base::SysNSStringToUTF16(wk_result)));
|
| DCHECK(result->IsType(base::Value::Type::STRING));
|
| @@ -91,10 +95,10 @@ void ExecuteJavaScript(WKWebView* web_view,
|
| dispatch_async(dispatch_get_main_queue(), ^{
|
| NSString* error_message =
|
| @"JS evaluation failed because there is no web view.";
|
| - base::scoped_nsobject<NSError> error([[NSError alloc]
|
| + NSError* error = [[NSError alloc]
|
| initWithDomain:kJSEvaluationErrorDomain
|
| code:JS_EVALUATION_ERROR_CODE_NO_WEB_VIEW
|
| - userInfo:@{NSLocalizedDescriptionKey : error_message}]);
|
| + userInfo:@{NSLocalizedDescriptionKey : error_message}];
|
| completion_handler(nil, error);
|
| });
|
| return;
|
|
|