• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: WebView crashes with JavaScript enabled
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: WebView crashes with JavaScript enabled


  • Subject: Re: WebView crashes with JavaScript enabled
  • From: Benjamin Dobson <email@hidden>
  • Date: Sun, 19 Oct 2008 20:02:32 +0100

On 19 Oct 2008, at 19:41:41, Jason Coco wrote:


On Oct 19, 2008, at 14:22 , Stephen J. Butler wrote:

On Sun, Oct 19, 2008 at 8:33 AM, Benjamin Dobson
<email@hidden> wrote:
If I enable JavaScript in my WebView, it exits with status 2, after printing
"Debugger() was called!" to the console. When I disable it, it works fine –
but without JavaScript. My code (URL given as an example):


[[webView mainFrame] loadRequest:[NSURLRequest requestWithURL: [NSURL
URLWithString:@"http://www.w3schools.com/js/js_examples.asp";]]];


That's it. Simply loading the page crashes the application. If this doesn't
crash it, clicking on the "Next" link at the bottom
will.

Works fine for me. Simple Cocoa application, create the proper connections, and put this in the app delegate:

- (void) applicationDidFinishLaunching:(NSNotification*)aNotification
{
  NSLog( @"isJavaScriptEnabled = %d", [[webView preferences]
isJavaScriptEnabled] );
  [[webView mainFrame] loadRequest:[NSURLRequest
requestWithURL:[NSURL
URLWithString:@"http://www.w3schools.com/js/js_examples.asp";]]];
}

Console prints a 1, and the page doesn't crash. I think your problem
lies with some other part of your code.

Actually, the exception you get looks like you're dereferencing an integer somewhere... possibly
something like:


NSLog(@"The return code: %@", returnCode);

Which would cause that exception...

I don't think so. My subclasses don't reference the webView at all, and what does – see for yourself.


- (void)applicationDidFinishLaunching:(NSNotification *)notification {
[[webView mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.w3schools.com/js/js_examples.asp";]]];
//[helpMenuItem setKeyEquivalent:@"?"];
NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
[center addObserver:self selector:@selector(progressChanged:)
name:WebViewProgressEstimateChangedNotification object:webView];
[center addObserver:self selector:@selector(progressChanged:)
name:WebViewProgressStartedNotification object:webView];
[center addObserver:self selector:@selector(progressFinished:)
name:WebViewProgressFinishedNotification object:webView];
[webView setContinuousSpellCheckingEnabled:YES];
}


- (void)progressChanged:(NSNotification *)notification {
	NSRect progRect = [progressIndicator frame];
	float progress = [webView estimatedProgress];
	progRect.size.width  = progress * 192;
	[progressIndicator setFrame:progRect];
}
- (void)progressFinished:(NSNotification *)notification {
	NSRect progRect = [progressIndicator frame];
	progRect.size.width  = 192;
	[progressIndicator setFrame:progRect];

	progRect.size.width  = 0;
	[progressIndicator setFrame:progRect];
}

progressIndicator is an NSImageView.

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >WebView crashes with JavaScript enabled (From: Benjamin Dobson <email@hidden>)
 >Re: WebView crashes with JavaScript enabled (From: "Stephen J. Butler" <email@hidden>)
 >Re: WebView crashes with JavaScript enabled (From: Jason Coco <email@hidden>)

  • Prev by Date: Re: WebView crashes with JavaScript enabled
  • Next by Date: Re: Converting from HTML
  • Previous by thread: Re: WebView crashes with JavaScript enabled
  • Next by thread: Binding across different Nib
  • Index(es):
    • Date
    • Thread