Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
e25faa3
[webview_flutter_platform_interface] Update webview platform interfac…
BeMacized Oct 1, 2021
f19b5c3
Fix tests
BeMacized Oct 1, 2021
3a22d00
[webview_flutter] Implemented `runJavaScript` and `runJavaScriptForRe…
BeMacized Oct 1, 2021
2bcec1c
Remove accidental development team inclusion from project.pbxproj
BeMacized Oct 1, 2021
ff493a2
Implemented PR feedback
BeMacized Oct 1, 2021
6bf082f
Merge branch 'webview/js_eval_fix_platform' into webview/js_eval_fix_…
BeMacized Oct 1, 2021
ff125c9
Updated runJavaScriptForResult behaviour
BeMacized Oct 1, 2021
9f661e8
Implemented PR feedback partially
BeMacized Oct 4, 2021
cbc88e8
Implement PR feedback
BeMacized Oct 4, 2021
9f537c7
Merge branch 'webview/js_eval_fix_platform' into webview/js_eval_fix_…
BeMacized Oct 4, 2021
26004c3
Update changelog
BeMacized Oct 4, 2021
283f8a7
Merge branch 'webview/js_eval_fix_platform' into webview/js_eval_fix_…
BeMacized Oct 4, 2021
b95d986
Implement PR feedback from interface PR
BeMacized Oct 4, 2021
3d8b9ce
Update changelog
BeMacized Oct 4, 2021
0ecf641
Revert inclusion of development team
BeMacized Oct 4, 2021
02e1106
Implement PR feedback
BeMacized Oct 5, 2021
d7780dd
Merge branch 'webview/js_eval_fix_platform' into webview/js_eval_fix_…
BeMacized Oct 5, 2021
d8f51ed
Implemented platform interface PR feedback
BeMacized Oct 5, 2021
285c2cc
Merge branch 'master' into webview/js_eval_fix_platform
BeMacized Oct 6, 2021
90cb648
Merge branch 'webview/js_eval_fix_platform' into webview/js_eval_fix_…
BeMacized Oct 6, 2021
bfcacdc
Update pubspec dependency
BeMacized Oct 6, 2021
bcb368c
Merge branch 'master' into webview/js_eval_fix_native
BeMacized Oct 6, 2021
485ead3
Fixed capitalisation
BeMacized Oct 6, 2021
a7d10c0
Fixed capitalisation
BeMacized Oct 6, 2021
d98bc6a
Fix warning
BeMacized Oct 7, 2021
738a9ad
Partially implement PR feedback
BeMacized Oct 8, 2021
527bd67
Partially implement PR feedback
BeMacized Oct 8, 2021
acf5ff9
Format
BeMacized Oct 8, 2021
aed3830
Update podfile
BeMacized Oct 8, 2021
6967c4f
Update podfile
BeMacized Oct 8, 2021
37ba26e
Update podfiles
BeMacized Oct 8, 2021
13076ba
Update iOS project files
BeMacized Oct 8, 2021
0c87362
Update podspec
BeMacized Oct 8, 2021
28ac939
Merge remote-tracking branch 'origin/webview/js_eval_fix_native' into…
BeMacized Oct 8, 2021
962ad02
Remove unnecessary podfile configuration
BeMacized Oct 8, 2021
9184d48
Implemented PR feedback
BeMacized Oct 8, 2021
a111502
Merge branch 'master' into webview/js_eval_fix_native
BeMacized Oct 18, 2021
80cbe9b
Format
BeMacized Oct 18, 2021
9fdab9d
Revert podfile changes
BeMacized Oct 22, 2021
6e609d7
Implemented PR feedback
BeMacized Oct 22, 2021
f6d8cb4
Fix formatting
BeMacized Oct 22, 2021
b019d3c
Fix formatting
BeMacized Oct 22, 2021
2b0f490
Fixed test.
BeMacized Oct 22, 2021
fa9526c
Re-add integration tests for deprecated evaluateJavascript method.
BeMacized Oct 26, 2021
45e799b
Merge branch 'master' into webview/js_eval_fix_native
BeMacized Oct 28, 2021
40a6b38
Merge branch 'master' into webview/js_eval_fix_native
BeMacized Oct 28, 2021
e2f4710
Fix merge conflicts
BeMacized Oct 28, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Updated runJavaScriptForResult behaviour
  • Loading branch information
BeMacized committed Oct 1, 2021
commit ff125c988130c2820736ce4df0f714308642fb35
Original file line number Diff line number Diff line change
Expand Up @@ -273,44 +273,8 @@ - (void)testRunJavaScriptForResultReturnsErrorResultForWKError {
binaryMessenger:self.mockBinaryMessenger];
XCTestExpectation *resultExpectation =
[self expectationWithDescription:@"Should return error result over the method channel."];
NSError *testError =
[NSError errorWithDomain:@""
// Any error code but WKErrorJavaScriptResultTypeIsUnsupported
code:WKErrorJavaScriptResultTypeIsUnsupported + 1
userInfo:@{NSLocalizedDescriptionKey : @"Test Error"}];
FLTWKWebView *mockView = OCMClassMock(FLTWKWebView.class);
[OCMStub([mockView evaluateJavaScript:[OCMArg any]
completionHandler:[OCMArg any]]) andDo:^(NSInvocation *invocation) {
// __unsafe_unretained: https://github.com/erikdoe/ocmock/issues/384#issuecomment-589376668
__unsafe_unretained void (^evalResultHandler)(id, NSError *);
[invocation getArgument:&evalResultHandler atIndex:3];
evalResultHandler(nil, testError);
}];
controller.webView = mockView;

// Run
[controller onMethodCall:[FlutterMethodCall methodCallWithMethodName:@"runJavaScriptForResult"
arguments:@"Test JavaScript String"]
result:^(id _Nullable result) {
XCTAssertTrue([result class] == [FlutterError class]);
[resultExpectation fulfill];
}];

// Verify
[self waitForExpectationsWithTimeout:30.0 handler:nil];
}

- (void)testRunJavaScriptForResultReturnsNilForWKErrorJavaScriptResultTypeIsUnsupported {
// Setup
FLTWebViewController *controller =
[[FLTWebViewController alloc] initWithFrame:CGRectMake(0, 0, 300, 400)
viewIdentifier:1
arguments:nil
binaryMessenger:self.mockBinaryMessenger];
XCTestExpectation *resultExpectation =
[self expectationWithDescription:@"Should return nil result over the method channel."];
NSError *testError = [NSError errorWithDomain:@""
code:WKErrorJavaScriptResultTypeIsUnsupported
code:5
userInfo:@{NSLocalizedDescriptionKey : @"Test Error"}];
FLTWKWebView *mockView = OCMClassMock(FLTWKWebView.class);
[OCMStub([mockView evaluateJavaScript:[OCMArg any]
Expand All @@ -326,7 +290,7 @@ - (void)testRunJavaScriptForResultReturnsNilForWKErrorJavaScriptResultTypeIsUnsu
[controller onMethodCall:[FlutterMethodCall methodCallWithMethodName:@"runJavaScriptForResult"
arguments:@"Test JavaScript String"]
result:^(id _Nullable result) {
XCTAssertNil(result);
XCTAssertTrue([result class] == [FlutterError class]);
[resultExpectation fulfill];
}];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,15 +281,11 @@ - (void)onRunJavaScriptForResult:(FlutterMethodCall*)call result:(FlutterResult)
[_webView evaluateJavaScript:jsString
completionHandler:^(_Nullable id evaluateResult, NSError* _Nullable error) {
if (error) {
if (error.code != WKErrorJavaScriptResultTypeIsUnsupported) {
result([FlutterError
errorWithCode:@"runJavaScriptForResult_failed"
message:@"Failed running JavaScript"
details:[NSString stringWithFormat:@"JavaScript string was: '%@'\n%@",
jsString, error]]);
} else {
result(nil);
}
result([FlutterError
errorWithCode:@"runJavaScriptForResult_failed"
message:@"Failed running JavaScript"
details:[NSString stringWithFormat:@"JavaScript string was: '%@'\n%@",
jsString, error]]);
} else {
result([NSString stringWithFormat:@"%@", evaluateResult]);
}
Expand Down