WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
135446
REGRESSION: Exception causing crash in UIWebView iOS 8 Beta
https://bugs.webkit.org/show_bug.cgi?id=135446
Summary
REGRESSION: Exception causing crash in UIWebView iOS 8 Beta
zack.ulrich
Reported
2014-07-30 18:18:50 PDT
Created
attachment 235789
[details]
Stack trace from crash I was testing out calling some Javascript with my iOS app and noticed that I could crash the app by causing an exception. The JS that I'm calling is attached below as well as the objective c code that I'm using to call it. I'm calling a named autoexecuting function which just has a generic try catch inside. The second time the function executes and the exception is caused the app crashes. I tested this same function using the new WKWebView and it doesn't crash the app but it seems to crash my the webview, I can't execute anything on it the second time the function runs. I've run this code on iOS 7 and it doesn't cause a crash. function ActivateDemo() { this.testFunction = function() { if (document.body.style.backgroundColor == "red") { document.body.style.backgroundColor="blue"; } else { document.body.style.backgroundColor="red"; } (function namedFunc() { try{ eval("console.log('hey from function'aa')") } catch(e) { console.log('exception ' + e) } })(); } } var AD = window.AD = new ActivateDemo(); ////objc code ////////////// - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. NSString *fullURL = @"
http://10.20.11.166/testWeb.html
"; NSURL *url = [NSURL URLWithString:fullURL]; NSURLRequest *requestObj = [NSURLRequest requestWithURL:url]; self.wkTest = [[WKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 300)]; [self.view addSubview:self.wkTest]; [self.wkTest loadRequest:requestObj]; self.testButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 350, 50, 50)]; [self.testButton setBackgroundColor:[UIColor blueColor]]; [self.testButton setTitle:@"Test" forState:UIControlStateNormal]; [self.testButton addTarget:self action:@selector(testBut) forControlEvents:UIControlEventTouchUpInside]; self.testWebView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 400, 100, 300)]; [self.view addSubview:self.testWebView]; [self.testWebView loadRequest:requestObj]; [self.view addSubview:self.testButton]; } -(void)testBut { [self.wkTest evaluateJavaScript:@"AD.testFunction()" completionHandler:nil]; [self.testWebView stringByEvaluatingJavaScriptFromString:@"AD.testFunction();"]; } //
Attachments
Stack trace from crash
(1.79 KB, application/octet-stream)
2014-07-30 18:18 PDT
,
zack.ulrich
no flags
Details
JS function
(451 bytes, application/x-javascript)
2014-07-30 18:19 PDT
,
zack.ulrich
no flags
Details
Objc code
(1.61 KB, application/octet-stream)
2014-07-30 18:20 PDT
,
zack.ulrich
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
zack.ulrich
Comment 1
2014-07-30 18:19:47 PDT
Created
attachment 235791
[details]
JS function
zack.ulrich
Comment 2
2014-07-30 18:20:31 PDT
Created
attachment 235792
[details]
Objc code
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug