Bug 122329 - [Mac] Don't preflight spell checker when calling -setContinuousSpellCheckingEnabled repeatedly
Summary: [Mac] Don't preflight spell checker when calling -setContinuousSpellCheckingE...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Alexey Proskuryakov
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2013-10-04 10:08 PDT by Alexey Proskuryakov
Modified: 2013-10-04 23:39 PDT (History)
3 users (show)

See Also:


Attachments
proposed patch (1.61 KB, patch)
2013-10-04 10:11 PDT, Alexey Proskuryakov
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexey Proskuryakov 2013-10-04 10:08:47 PDT
In <rdar://problem/15145394>, I observed a case where WebKit1 tests would fail to function because of repeated attempts to launch spellchecking service.

DumpRenderTree calls -[WebView setContinuousSpellCheckingEnabled:YES] before each test, and this results in WebKit calling [[NSSpellChecker sharedSpellChecker] _preflightChosenSpellServer], which in turn launches the service if it's not launched yet.

What I observed was that launchservicesd was busy servicing AppleSpell.service registrations, and this was making service launch time out, and this was making us try to re-launch it again and again. I'm not sure what the initial trigger for the misbehavior was, but repeatedly trying to relaunch an app that fails to launch makes little sense.
Comment 1 Alexey Proskuryakov 2013-10-04 10:11:41 PDT
Created attachment 213369 [details]
proposed patch
Comment 2 Darin Adler 2013-10-04 17:00:18 PDT
Comment on attachment 213369 [details]
proposed patch

View in context: https://bugs.webkit.org/attachment.cgi?id=213369&action=review

> Source/WebKit/mac/WebView/WebView.mm:-5547
>      if (continuousSpellCheckingEnabled != flag) {
>          continuousSpellCheckingEnabled = flag;
>          [[NSUserDefaults standardUserDefaults] setBool:continuousSpellCheckingEnabled forKey:WebContinuousSpellCheckingEnabled];
> -    }

I think this would read better as early return than with all the code nested inside and if statement.
Comment 3 Alexey Proskuryakov 2013-10-04 23:39:43 PDT
> I think this would read better as early return than with all the code nested inside and if statement.

Oops. Fixed and landed in <http://trac.webkit.org/r156949>.