Commit c129e3fd authored by timothy@apple.com's avatar timothy@apple.com
Browse files

Change how threading exceptions are checked so they are reported by what round they were added.

WebCore:

2009-03-20  Timothy Hatcher  <timothy@apple.com>

        Change how threading exceptions are checked so they are reported
        by what round they were added. That way WebKit can decided the
        behavior per-round based on linked-on-or-after checks.

        <rdar://problem/6626741&6648478&6635474&6674079>

        Reviewed by Darin Adler.

        * WebCore.base.exp: Export the new symbols.
        * bindings/objc/DOMAbstractView.mm: Use the new WebCoreThreadViolationCheckRoundOne macro.
        * bindings/scripts/CodeGeneratorObjC.pm: Ditto.
        * platform/ThreadCheck.h:
        * platform/mac/ThreadCheck.mm:
        (WebCore::readThreadViolationBehaviorFromUserDefaults): Refactor how the default is read.
        (WebCore::setDefaultThreadViolationBehavior): Take a round argument.
        (WebCore::reportThreadViolation): Ditto.
        (WebCoreReportThreadViolation): Ditto.

WebKit:

2009-03-20  Timothy Hatcher  <timothy@apple.com>

        Change how threading exceptions are checked so they are reported
        by what round they were added. That way WebKit can decided the
        behavior per-round based on linked-on-or-after checks.

        <rdar://problem/6626741&6648478&6635474&6674079>

        Reviewed by Darin Adler.

        * History/WebBackForwardList.mm: Use the new WebCoreThreadViolationCheckRoundOne macro.
        * History/WebHistoryItem.mm: Ditto.
        * Misc/WebIconDatabase.mm: Ditto.

        * WebView/WebArchive.mm: Use the new WebCoreThreadViolationCheckRoundTwo macro.
        * WebView/WebResource.mm: Ditto.
        (+[WebResource _needMailThreadWorkaroundIfCalledOffMainThread]): Check Mail's bundle version
        to truly decide if it is an old Mail client.
        * WebView/WebView.mm: Ditto.

        * Misc/WebKitVersionChecks.h: Add a new linked-on-or-after version define.
        * WebView/WebFrameView.mm:
        (-[WebFrameView initWithFrame:]): Set the default thread violation behavior per-round
        based on difference version checks and the Mail workaround check.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@41870 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 62ac49ad
2009-03-20 Timothy Hatcher <timothy@apple.com>
Change how threading exceptions are checked so they are reported
by what round they were added. That way WebKit can decided the
behavior per-round based on linked-on-or-after checks.
<rdar://problem/6626741&6648478&6635474&6674079>
Reviewed by Darin Adler.
* WebCore.base.exp: Export the new symbols.
* bindings/objc/DOMAbstractView.mm: Use the new WebCoreThreadViolationCheckRoundOne macro.
* bindings/scripts/CodeGeneratorObjC.pm: Ditto.
* platform/ThreadCheck.h:
* platform/mac/ThreadCheck.mm:
(WebCore::readThreadViolationBehaviorFromUserDefaults): Refactor how the default is read.
(WebCore::setDefaultThreadViolationBehavior): Take a round argument.
(WebCore::reportThreadViolation): Ditto.
(WebCoreReportThreadViolation): Ditto.
2009-03-20 Geoffrey Garen <ggaren@apple.com>
 
Reviewed by Sam Weinig.
......@@ -420,7 +420,7 @@ __ZN7WebCore21PlatformKeyboardEventC1EP7NSEvent
__ZN7WebCore21WindowsLatin1EncodingEv
__ZN7WebCore21findEventWithKeyStateEPNS_5EventE
__ZN7WebCore21isBackForwardLoadTypeENS_13FrameLoadTypeE
__ZN7WebCore21reportThreadViolationEPKc
__ZN7WebCore21reportThreadViolationEPKcNS_20ThreadViolationRoundE
__ZN7WebCore22createFragmentFromTextEPNS_5RangeERKNS_6StringE
__ZN7WebCore22externalRepresentationEPNS_12RenderObjectE
__ZN7WebCore23ApplicationCacheStorage16storeCopyOfCacheERKNS_6StringEPNS_16ApplicationCacheE
......@@ -442,7 +442,7 @@ __ZN7WebCore26usesTestModeFocusRingColorEv
__ZN7WebCore29isCharacterSmartReplaceExemptEib
__ZN7WebCore29setUsesTestModeFocusRingColorEb
__ZN7WebCore32plainTextToMallocAllocatedBufferEPKNS_5RangeERjb
__ZN7WebCore33setDefaultThreadViolationBehaviorENS_23ThreadViolationBehaviorE
__ZN7WebCore33setDefaultThreadViolationBehaviorENS_23ThreadViolationBehaviorENS_20ThreadViolationRoundE
__ZN7WebCore36InitializeLoggingChannelsIfNecessaryEv
__ZN7WebCore3macERKNS_23AuthenticationChallengeE
__ZN7WebCore4FontC1ERKNS_16FontPlatformDataEb
......
......@@ -44,7 +44,7 @@
- (void)dealloc
{
{ DOM_ASSERT_MAIN_THREAD(); WebCoreThreadViolationCheck(); }
{ DOM_ASSERT_MAIN_THREAD(); WebCoreThreadViolationCheckRoundOne(); }
[super dealloc];
}
......@@ -79,7 +79,7 @@
- (id)_initWithFrame:(WebCore::Frame *)impl
{
{ DOM_ASSERT_MAIN_THREAD(); WebCoreThreadViolationCheck(); };
{ DOM_ASSERT_MAIN_THREAD(); WebCoreThreadViolationCheckRoundOne(); };
[super _init];
_internal = reinterpret_cast<DOMObjectInternal*>(impl);
WebCore::addDOMWrapper(self, impl);
......@@ -88,7 +88,7 @@
+ (DOMAbstractView *)_wrapAbstractView:(WebCore::DOMWindow *)impl
{
{ DOM_ASSERT_MAIN_THREAD(); WebCoreThreadViolationCheck(); };
{ DOM_ASSERT_MAIN_THREAD(); WebCoreThreadViolationCheckRoundOne(); };
if (!impl)
return nil;
......
......@@ -79,7 +79,7 @@ my $buildingForTigerOrEarlier = 1 if $ENV{"MACOSX_DEPLOYMENT_TARGET"} and $ENV{"
my $buildingForLeopardOrLater = 1 if $ENV{"MACOSX_DEPLOYMENT_TARGET"} and $ENV{"MACOSX_DEPLOYMENT_TARGET"} >= 10.5;
my $exceptionInit = "WebCore::ExceptionCode ec = 0;";
my $exceptionRaiseOnError = "WebCore::raiseOnDOMError(ec);";
my $assertMainThread = "{ DOM_ASSERT_MAIN_THREAD(); WebCoreThreadViolationCheck(); }";
my $assertMainThread = "{ DOM_ASSERT_MAIN_THREAD(); WebCoreThreadViolationCheckRoundOne(); }";
my %conflictMethod = (
# FIXME: Add C language keywords?
......
......@@ -33,12 +33,18 @@ namespace WebCore {
LogOnThreadViolation,
RaiseExceptionOnThreadViolation
};
void setDefaultThreadViolationBehavior(ThreadViolationBehavior);
void reportThreadViolation(const char* function);
enum ThreadViolationRound {
ThreadViolationRoundOne = 0,
ThreadViolationRoundTwo,
MaximumThreadViolationRound
};
void setDefaultThreadViolationBehavior(ThreadViolationBehavior, ThreadViolationRound);
void reportThreadViolation(const char* function, ThreadViolationRound);
}
extern "C" void WebCoreReportThreadViolation(const char* function);
extern "C" void WebCoreReportThreadViolation(const char* function, WebCore::ThreadViolationRound);
#define WebCoreThreadViolationCheck() ::WebCore::reportThreadViolation(WTF_PRETTY_FUNCTION)
#define WebCoreThreadViolationCheckRoundOne() ::WebCore::reportThreadViolation(WTF_PRETTY_FUNCTION, WebCore::ThreadViolationRoundOne)
#define WebCoreThreadViolationCheckRoundTwo() ::WebCore::reportThreadViolation(WTF_PRETTY_FUNCTION, WebCore::ThreadViolationRoundTwo)
#endif
......@@ -32,56 +32,74 @@
namespace WebCore {
static ThreadViolationBehavior defaultThreadViolationBehavior = RaiseExceptionOnThreadViolation;
static bool didReadThreadViolationBehaviorFromUserDefaults = false;
static bool threadViolationBehaviorIsDefault;
static ThreadViolationBehavior threadViolationBehavior;
static bool threadViolationBehaviorIsDefault = true;
static ThreadViolationBehavior threadViolationBehavior[MaximumThreadViolationRound] = { RaiseExceptionOnThreadViolation, RaiseExceptionOnThreadViolation };
static void readThreadViolationBehaviorFromUserDefaults()
{
didReadThreadViolationBehaviorFromUserDefaults = true;
ThreadViolationBehavior newBehavior = LogOnFirstThreadViolation;
NSString *threadCheckLevel = [[NSUserDefaults standardUserDefaults] stringForKey:@"WebCoreThreadCheck"];
if (!threadCheckLevel)
return;
if ([threadCheckLevel isEqualToString:@"None"])
threadViolationBehavior = NoThreadCheck;
newBehavior = NoThreadCheck;
else if ([threadCheckLevel isEqualToString:@"Exception"])
threadViolationBehavior = RaiseExceptionOnThreadViolation;
newBehavior = RaiseExceptionOnThreadViolation;
else if ([threadCheckLevel isEqualToString:@"Log"])
threadViolationBehavior = LogOnThreadViolation;
newBehavior = LogOnThreadViolation;
else if ([threadCheckLevel isEqualToString:@"LogOnce"])
threadViolationBehavior = LogOnFirstThreadViolation;
else {
threadViolationBehavior = defaultThreadViolationBehavior;
threadViolationBehaviorIsDefault = true;
}
didReadThreadViolationBehaviorFromUserDefaults = true;
newBehavior = LogOnFirstThreadViolation;
else
ASSERT_NOT_REACHED();
threadViolationBehaviorIsDefault = false;
for (unsigned i = 0; i < MaximumThreadViolationRound; ++i)
threadViolationBehavior[i] = newBehavior;
}
void setDefaultThreadViolationBehavior(ThreadViolationBehavior behavior)
void setDefaultThreadViolationBehavior(ThreadViolationBehavior behavior, ThreadViolationRound round)
{
defaultThreadViolationBehavior = behavior;
ASSERT(round < MaximumThreadViolationRound);
if (round >= MaximumThreadViolationRound)
return;
if (!didReadThreadViolationBehaviorFromUserDefaults)
readThreadViolationBehaviorFromUserDefaults();
if (threadViolationBehaviorIsDefault)
threadViolationBehavior = behavior;
threadViolationBehavior[round] = behavior;
}
void reportThreadViolation(const char* function)
void reportThreadViolation(const char* function, ThreadViolationRound round)
{
ASSERT(round < MaximumThreadViolationRound);
if (round >= MaximumThreadViolationRound)
return;
if (!didReadThreadViolationBehaviorFromUserDefaults)
readThreadViolationBehaviorFromUserDefaults();
if (threadViolationBehavior == NoThreadCheck)
readThreadViolationBehaviorFromUserDefaults();
if (threadViolationBehavior[round] == NoThreadCheck)
return;
if (pthread_main_np())
return;
WebCoreReportThreadViolation(function);
WebCoreReportThreadViolation(function, round);
}
} // namespace WebCore
// Split out the actual reporting of the thread violation to make it easier to set a breakpoint
void WebCoreReportThreadViolation(const char* function)
void WebCoreReportThreadViolation(const char* function, WebCore::ThreadViolationRound round)
{
using namespace WebCore;
ASSERT(round < MaximumThreadViolationRound);
if (round >= MaximumThreadViolationRound)
return;
DEFINE_STATIC_LOCAL(HashSet<String>, loggedFunctions, ());
switch (threadViolationBehavior) {
switch (threadViolationBehavior[round]) {
case NoThreadCheck:
break;
case LogOnFirstThreadViolation:
......
2009-03-20 Timothy Hatcher <timothy@apple.com>
Change how threading exceptions are checked so they are reported
by what round they were added. That way WebKit can decided the
behavior per-round based on linked-on-or-after checks.
<rdar://problem/6626741&6648478&6635474&6674079>
Reviewed by Darin Adler.
* History/WebBackForwardList.mm: Use the new WebCoreThreadViolationCheckRoundOne macro.
* History/WebHistoryItem.mm: Ditto.
* Misc/WebIconDatabase.mm: Ditto.
* WebView/WebArchive.mm: Use the new WebCoreThreadViolationCheckRoundTwo macro.
* WebView/WebResource.mm: Ditto.
(+[WebResource _needMailThreadWorkaroundIfCalledOffMainThread]): Check Mail's bundle version
to truly decide if it is an old Mail client.
* WebView/WebView.mm: Ditto.
* Misc/WebKitVersionChecks.h: Add a new linked-on-or-after version define.
* WebView/WebFrameView.mm:
(-[WebFrameView initWithFrame:]): Set the default thread violation behavior per-round
based on difference version checks and the Mail workaround check.
2009-03-20 Darin Adler <darin@apple.com>
 
Reviewed by Timothy Hatcher.
......
......@@ -82,7 +82,7 @@ WebBackForwardList *kit(BackForwardList* backForwardList)
- (id)initWithBackForwardList:(PassRefPtr<BackForwardList>)backForwardList
{
WebCoreThreadViolationCheck();
WebCoreThreadViolationCheckRoundOne();
self = [super init];
if (!self)
return nil;
......@@ -127,7 +127,7 @@ WebBackForwardList *kit(BackForwardList* backForwardList)
- (void)finalize
{
WebCoreThreadViolationCheck();
WebCoreThreadViolationCheckRoundOne();
BackForwardList* backForwardList = core(self);
ASSERT(backForwardList);
if (backForwardList) {
......
......@@ -107,7 +107,7 @@ void WKNotifyHistoryItemChanged()
- (id)initWithURLString:(NSString *)URLString title:(NSString *)title lastVisitedTimeInterval:(NSTimeInterval)time
{
WebCoreThreadViolationCheck();
WebCoreThreadViolationCheckRoundOne();
return [self initWithWebCoreHistoryItem:HistoryItem::create(URLString, title, time)];
}
......@@ -126,7 +126,7 @@ void WKNotifyHistoryItemChanged()
- (void)finalize
{
WebCoreThreadViolationCheck();
WebCoreThreadViolationCheckRoundOne();
// FIXME: ~HistoryItem is what releases the history item's icon from the icon database
// It's probably not good to release icons from the database only when the object is garbage-collected.
// Need to change design so this happens at a predictable time.
......@@ -140,7 +140,7 @@ void WKNotifyHistoryItemChanged()
- (id)copyWithZone:(NSZone *)zone
{
WebCoreThreadViolationCheck();
WebCoreThreadViolationCheckRoundOne();
WebHistoryItem *copy = (WebHistoryItem *)NSCopyObject(self, 0, zone);
RefPtr<HistoryItem> item = core(_private)->copy();
copy->_private = kitPrivate(item.get());
......@@ -299,7 +299,7 @@ static WebWindowWatcher *_windowWatcher = nil;
- (id)initWithWebCoreHistoryItem:(PassRefPtr<HistoryItem>)item
{
WebCoreThreadViolationCheck();
WebCoreThreadViolationCheckRoundOne();
// Need to tell WebCore what function to call for the
// "History Item has Changed" notification - no harm in doing this
// everytime a WebHistoryItem is created
......
......@@ -94,7 +94,7 @@ static WebIconDatabaseClient* defaultClient()
- init
{
[super init];
WebCoreThreadViolationCheck();
WebCoreThreadViolationCheckRoundOne();
_private = [[WebIconDatabasePrivate alloc] init];
......
......@@ -49,8 +49,8 @@
#define WEBKIT_FIRST_VERSION_WITH_LOADING_DURING_COMMON_RUNLOOP_MODES 0x020E0000 // 526.0.0
#define WEBKIT_FIRST_VERSION_WITH_MORE_STRICT_LOCAL_RESOURCE_SECURITY_RESTRICTION 0x02100200 // 528.2.0
#define WEBKIT_FIRST_VERSION_WITH_RELOAD_FROM_ORIGIN 0x02100700 // 528.7.0
#define WEBKIT_FIRST_VERSION_WITHOUT_MAIL_THREAD_WORKAROUND 0x02100700 // 528.7.0
#define WEBKIT_FIRST_VERSION_WITHOUT_WEBVIEW_INIT_THREAD_WORKAROUND 0x02100700 // 528.7.0
#define WEBKIT_FIRST_VERSION_WITH_ROUND_TWO_MAIN_THREAD_EXCEPTIONS 0x02120400 // 530.4.0
#ifdef __cplusplus
extern "C" {
......
......@@ -121,7 +121,7 @@ static NSString * const WebSubframeArchivesKey = @"WebSubframeArchives";
- (id)init
{
WebCoreThreadViolationCheck();
WebCoreThreadViolationCheckRoundTwo();
self = [super init];
if (!self)
......@@ -149,7 +149,7 @@ static BOOL isArrayOfClass(id object, Class elementClass)
return [[self _webkit_invokeOnMainThread] initWithMainResource:mainResource subresources:subresources subframeArchives:subframeArchives];
#endif
WebCoreThreadViolationCheck();
WebCoreThreadViolationCheckRoundTwo();
self = [super init];
if (!self)
......@@ -202,7 +202,7 @@ static BOOL isArrayOfClass(id object, Class elementClass)
- (id)initWithData:(NSData *)data
{
WebCoreThreadViolationCheck();
WebCoreThreadViolationCheckRoundTwo();
self = [super init];
if (!self)
......@@ -279,7 +279,7 @@ static BOOL isArrayOfClass(id object, Class elementClass)
return [[self _webkit_invokeOnMainThread] mainResource];
#endif
WebCoreThreadViolationCheck();
WebCoreThreadViolationCheckRoundTwo();
// Currently from WebKit API perspective, WebArchives are entirely immutable once created
// If they ever become mutable, we'll need to rethink this.
......@@ -299,7 +299,7 @@ static BOOL isArrayOfClass(id object, Class elementClass)
return [[self _webkit_invokeOnMainThread] subresources];
#endif
WebCoreThreadViolationCheck();
WebCoreThreadViolationCheckRoundTwo();
// Currently from WebKit API perspective, WebArchives are entirely immutable once created
// If they ever become mutable, we'll need to rethink this.
......@@ -331,7 +331,7 @@ static BOOL isArrayOfClass(id object, Class elementClass)
return [[self _webkit_invokeOnMainThread] subframeArchives];
#endif
WebCoreThreadViolationCheck();
WebCoreThreadViolationCheckRoundTwo();
// Currently from WebKit API perspective, WebArchives are entirely immutable once created
// If they ever become mutable, we'll need to rethink this.
......@@ -356,7 +356,7 @@ static BOOL isArrayOfClass(id object, Class elementClass)
- (NSData *)data
{
WebCoreThreadViolationCheck();
WebCoreThreadViolationCheckRoundTwo();
#if !LOG_DISABLED
CFAbsoluteTime start = CFAbsoluteTimeGetCurrent();
......@@ -379,7 +379,7 @@ static BOOL isArrayOfClass(id object, Class elementClass)
- (id)_initWithCoreLegacyWebArchive:(PassRefPtr<WebCore::LegacyWebArchive>)coreLegacyWebArchive
{
WebCoreThreadViolationCheck();
WebCoreThreadViolationCheckRoundTwo();
self = [super init];
if (!self)
......@@ -396,7 +396,7 @@ static BOOL isArrayOfClass(id object, Class elementClass)
- (WebCore::LegacyWebArchive *)_coreLegacyWebArchive
{
WebCoreThreadViolationCheck();
WebCoreThreadViolationCheckRoundTwo();
return [_private coreArchive];
}
......
......@@ -49,6 +49,7 @@
#import "WebNSWindowExtras.h"
#import "WebPDFView.h"
#import "WebPreferenceKeysPrivate.h"
#import "WebResourceInternal.h"
#import "WebSystemInterface.h"
#import "WebViewFactory.h"
#import "WebViewInternal.h"
......@@ -314,9 +315,12 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl
WKDisableCGDeferredUpdates();
if (!WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITH_MAIN_THREAD_EXCEPTIONS))
setDefaultThreadViolationBehavior(LogOnFirstThreadViolation);
setDefaultThreadViolationBehavior(LogOnFirstThreadViolation, ThreadViolationRoundOne);
if (!WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITH_ROUND_TWO_MAIN_THREAD_EXCEPTIONS) || needMailThreadWorkaround())
setDefaultThreadViolationBehavior(LogOnFirstThreadViolation, ThreadViolationRoundTwo);
}
_private = [[WebFrameViewPrivate alloc] init];
WebDynamicScrollBarsView *scrollView = [[WebDynamicScrollBarsView alloc] initWithFrame:NSMakeRect(0.0f, 0.0f, frame.size.width, frame.size.height)];
......
......@@ -121,7 +121,7 @@ static NSString * const WebResourceResponseKey = @"WebResourceResponse"
- (id)initWithCoder:(NSCoder *)decoder
{
WebCoreThreadViolationCheck();
WebCoreThreadViolationCheckRoundTwo();
self = [super init];
if (!self)
......@@ -205,7 +205,7 @@ static NSString * const WebResourceResponseKey = @"WebResourceResponse"
return [[self _webkit_invokeOnMainThread] data];
#endif
WebCoreThreadViolationCheck();
WebCoreThreadViolationCheckRoundTwo();
if (!_private->coreResource)
return nil;
......@@ -221,7 +221,7 @@ static NSString * const WebResourceResponseKey = @"WebResourceResponse"
return [[self _webkit_invokeOnMainThread] URL];
#endif
WebCoreThreadViolationCheck();
WebCoreThreadViolationCheckRoundTwo();
if (!_private->coreResource)
return nil;
......@@ -236,7 +236,7 @@ static NSString * const WebResourceResponseKey = @"WebResourceResponse"
return [[self _webkit_invokeOnMainThread] MIMEType];
#endif
WebCoreThreadViolationCheck();
WebCoreThreadViolationCheckRoundTwo();
if (!_private->coreResource)
return nil;
......@@ -251,7 +251,7 @@ static NSString * const WebResourceResponseKey = @"WebResourceResponse"
return [[self _webkit_invokeOnMainThread] textEncodingName];
#endif
WebCoreThreadViolationCheck();
WebCoreThreadViolationCheckRoundTwo();
if (!_private->coreResource)
return nil;
......@@ -266,7 +266,7 @@ static NSString * const WebResourceResponseKey = @"WebResourceResponse"
return [[self _webkit_invokeOnMainThread] frameName];
#endif
WebCoreThreadViolationCheck();
WebCoreThreadViolationCheckRoundTwo();
if (!_private->coreResource)
return nil;
......@@ -323,7 +323,7 @@ static NSString * const WebResourceResponseKey = @"WebResourceResponse"
}
#endif
WebCoreThreadViolationCheck();
WebCoreThreadViolationCheckRoundTwo();
if (!_private->coreResource)
return;
......@@ -343,7 +343,7 @@ static NSString * const WebResourceResponseKey = @"WebResourceResponse"
return [[self _webkit_invokeOnMainThread] _initWithData:data URL:URL MIMEType:MIMEType textEncodingName:textEncodingName frameName:frameName response:response copyData:copyData];
#endif
WebCoreThreadViolationCheck();
WebCoreThreadViolationCheckRoundTwo();
self = [super init];
if (!self)
......@@ -379,7 +379,7 @@ static NSString * const WebResourceResponseKey = @"WebResourceResponse"
return [[self _webkit_invokeOnMainThread] _suggestedFilename];
#endif
WebCoreThreadViolationCheck();
WebCoreThreadViolationCheckRoundTwo();
if (!_private->coreResource)
return nil;
......@@ -404,7 +404,7 @@ static NSString * const WebResourceResponseKey = @"WebResourceResponse"
return [[self _webkit_invokeOnMainThread] _response];
#endif
WebCoreThreadViolationCheck();
WebCoreThreadViolationCheckRoundTwo();
NSURLResponse *response = nil;
if (_private->coreResource)
......@@ -419,7 +419,7 @@ static NSString * const WebResourceResponseKey = @"WebResourceResponse"
return [[self _webkit_invokeOnMainThread] _stringValue];
#endif
WebCoreThreadViolationCheck();
WebCoreThreadViolationCheckRoundTwo();
WebCore::TextEncoding encoding;
if (_private->coreResource)
......@@ -435,12 +435,14 @@ static NSString * const WebResourceResponseKey = @"WebResourceResponse"
#ifdef MAIL_THREAD_WORKAROUND
static const double newMailBundleVersion = 1050.0;
@implementation WebResource (WebMailThreadWorkaround)
+ (BOOL)_needMailThreadWorkaroundIfCalledOffMainThread
{
static BOOL isOldMail = !WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITHOUT_MAIL_THREAD_WORKAROUND)
&& [[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@"com.apple.mail"];
static BOOL isOldMail = [[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@"com.apple.mail"]
&& [[[NSBundle mainBundle] objectForInfoDictionaryKey:(NSString *)kCFBundleVersionKey] doubleValue] < newMailBundleVersion;
return isOldMail;
}
......
......@@ -694,7 +694,7 @@ static void WebKitInitializeApplicationCachePathIfNecessary()
- (void)_commonInitializationWithFrameName:(NSString *)frameName groupName:(NSString *)groupName usesDocumentViews:(BOOL)usesDocumentViews
{
WebCoreThreadViolationCheck();
WebCoreThreadViolationCheckRoundTwo();
#ifndef NDEBUG
WTF::RefCountedLeakCounter::suppressMessages(webViewIsOpen);
......@@ -2386,7 +2386,7 @@ static bool needsWebViewInitThreadWorkaround()
if (needsWebViewInitThreadWorkaround())
return [[self _webkit_invokeOnMainThread] initWithFrame:f frameName:frameName groupName:groupName];
WebCoreThreadViolationCheck();
WebCoreThreadViolationCheckRoundTwo();
return [self _initWithFrame:f frameName:frameName groupName:groupName usesDocumentViews:YES];
}
......@@ -2395,7 +2395,7 @@ static bool needsWebViewInitThreadWorkaround()
if (needsWebViewInitThreadWorkaround())
return [[self _webkit_invokeOnMainThread] initWithCoder:decoder];
WebCoreThreadViolationCheck();
WebCoreThreadViolationCheckRoundTwo();
WebView *result = nil;
@try {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment