Title: [89718] trunk/Source/WebCore
Revision
89718
Author
[email protected]
Date
2011-06-24 17:16:36 -0700 (Fri, 24 Jun 2011)

Log Message

2011-06-24  Jer Noble  <[email protected]>

        Reviewed by Eric Carlson.

        Safari will quit unexpectedly when launching Safari in the first time (crash in initQTSecurityPolicyNoLocalToRemoteSiteAttribute)
        https://bugs.webkit.org/show_bug.cgi?id=63332
        <rdar://problem/9661650>

        No new tests; Only affects machines with QTKit < 7.6.3 installed.

        Check to see if QTSecurityPolicyNoRemoteToLocalSiteAttribute is non-NULL before passing it into -[QTMovie initWithAttributes:],
        as it is only defined in QTKit >= 7.6.3.  If it is NULL, pass QTSecurityPolicyNoCrossSiteAttribute=YES instead, which has
        the same effect in earlier versions of QTKit as the NoLocalToRemote and NoRemoteToLocal keys.  To avoid ASSERTs when running
        debug builds with earlier versions of QTKit, add a SOFT_LINK_POINTER_OPTIONAL macro to SoftLinking.h and make these keys optional.

        * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
        (WebCore::MediaPlayerPrivateQTKit::commonMovieAttributes):
        * platform/mac/SoftLinking.h: Add SOFT_LINK_POINTER_OPTIONAL macro.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (89717 => 89718)


--- trunk/Source/WebCore/ChangeLog	2011-06-25 00:13:22 UTC (rev 89717)
+++ trunk/Source/WebCore/ChangeLog	2011-06-25 00:16:36 UTC (rev 89718)
@@ -1,3 +1,22 @@
+2011-06-24  Jer Noble  <[email protected]>
+
+        Reviewed by Eric Carlson.
+
+        Safari will quit unexpectedly when launching Safari in the first time (crash in initQTSecurityPolicyNoLocalToRemoteSiteAttribute)
+        https://bugs.webkit.org/show_bug.cgi?id=63332
+        <rdar://problem/9661650>
+
+        No new tests; Only affects machines with QTKit < 7.6.3 installed.
+
+        Check to see if QTSecurityPolicyNoRemoteToLocalSiteAttribute is non-NULL before passing it into -[QTMovie initWithAttributes:],
+        as it is only defined in QTKit >= 7.6.3.  If it is NULL, pass QTSecurityPolicyNoCrossSiteAttribute=YES instead, which has
+        the same effect in earlier versions of QTKit as the NoLocalToRemote and NoRemoteToLocal keys.  To avoid ASSERTs when running
+        debug builds with earlier versions of QTKit, add a SOFT_LINK_POINTER_OPTIONAL macro to SoftLinking.h and make these keys optional.
+
+        * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
+        (WebCore::MediaPlayerPrivateQTKit::commonMovieAttributes):
+        * platform/mac/SoftLinking.h: Add SOFT_LINK_POINTER_OPTIONAL macro.
+
 2011-06-24  Darin Adler  <[email protected]>
 
         Try to fix Windows build failure.

Modified: trunk/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm (89717 => 89718)


--- trunk/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm	2011-06-25 00:13:22 UTC (rev 89717)
+++ trunk/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm	2011-06-25 00:16:36 UTC (rev 89718)
@@ -92,12 +92,13 @@
 SOFT_LINK_POINTER(QTKit, QTMovieURLAttribute, NSString *)
 SOFT_LINK_POINTER(QTKit, QTMovieVolumeDidChangeNotification, NSString *)
 SOFT_LINK_POINTER(QTKit, QTSecurityPolicyNoCrossSiteAttribute, NSString *)
-SOFT_LINK_POINTER(QTKit, QTSecurityPolicyNoLocalToRemoteSiteAttribute, NSString *)
-SOFT_LINK_POINTER(QTKit, QTSecurityPolicyNoRemoteToLocalSiteAttribute, NSString *)
 SOFT_LINK_POINTER(QTKit, QTVideoRendererWebKitOnlyNewImageAvailableNotification, NSString *)
 SOFT_LINK_POINTER(QTKit, QTMovieApertureModeClean, NSString *)
 SOFT_LINK_POINTER(QTKit, QTMovieApertureModeAttribute, NSString *)
 
+SOFT_LINK_POINTER_OPTIONAL(QTKit, QTSecurityPolicyNoLocalToRemoteSiteAttribute, NSString *)
+SOFT_LINK_POINTER_OPTIONAL(QTKit, QTSecurityPolicyNoRemoteToLocalSiteAttribute, NSString *)
+
 #define QTMovie getQTMovieClass()
 #define QTMovieView getQTMovieViewClass()
 #define QTMovieLayer getQTMovieLayerClass()
@@ -234,15 +235,22 @@
     NSMutableDictionary *movieAttributes = [NSMutableDictionary dictionaryWithObjectsAndKeys:
             [NSNumber numberWithBool:m_player->preservesPitch()], QTMovieRateChangesPreservePitchAttribute,
             [NSNumber numberWithBool:YES], QTMoviePreventExternalURLLinksAttribute,
-            [NSNumber numberWithBool:NO], QTSecurityPolicyNoCrossSiteAttribute,
-            [NSNumber numberWithBool:YES], QTSecurityPolicyNoRemoteToLocalSiteAttribute,
-            [NSNumber numberWithBool:YES], QTSecurityPolicyNoLocalToRemoteSiteAttribute,
             [NSNumber numberWithBool:NO], QTMovieAskUnresolvedDataRefsAttribute,
             [NSNumber numberWithBool:NO], QTMovieLoopsAttribute,
             [NSNumber numberWithBool:!m_privateBrowsing], @"QTMovieAllowPersistentCacheAttribute",
             QTMovieApertureModeClean, QTMovieApertureModeAttribute,
             nil];
 
+    // Check to see if QTSecurityPolicyNoRemoteToLocalSiteAttribute is defined, which was added in QTKit 7.6.3.
+    // If not, just set NoCrossSite = YES, which does the same thing as NoRemoteToLocal = YES and 
+    // NoLocalToRemote = YES in QTKit < 7.6.3.
+    if (QTSecurityPolicyNoRemoteToLocalSiteAttribute) {
+        [movieAttributes setValue:[NSNumber numberWithBool:NO] forKey:QTSecurityPolicyNoCrossSiteAttribute];
+        [movieAttributes setValue:[NSNumber numberWithBool:YES] forKey:QTSecurityPolicyNoRemoteToLocalSiteAttribute];
+        [movieAttributes setValue:[NSNumber numberWithBool:YES] forKey:QTSecurityPolicyNoLocalToRemoteSiteAttribute];
+    } else
+        [movieAttributes setValue:[NSNumber numberWithBool:YES] forKey:QTSecurityPolicyNoCrossSiteAttribute];
+
     if (m_preload < MediaPlayer::Auto)
         [movieAttributes setValue:[NSNumber numberWithBool:YES] forKey:@"QTMovieLimitReadAheadAttribute"];
 

Modified: trunk/Source/WebCore/platform/mac/SoftLinking.h (89717 => 89718)


--- trunk/Source/WebCore/platform/mac/SoftLinking.h	2011-06-25 00:13:22 UTC (rev 89717)
+++ trunk/Source/WebCore/platform/mac/SoftLinking.h	2011-06-25 00:16:36 UTC (rev 89718)
@@ -124,6 +124,24 @@
         return pointer##name; \
     }
 
+#define SOFT_LINK_POINTER_OPTIONAL(framework, name, type) \
+    static type init##name(); \
+    static type (*get##name)() = init##name; \
+    static type pointer##name; \
+    \
+    static type name##Function() \
+    { \
+        return pointer##name; \
+    }\
+    \
+    static type init##name() \
+    { \
+        void** pointer = static_cast<void**>(dlsym(framework##Library(), #name)); \
+        pointer##name = static_cast<type>(*pointer); \
+        get##name = name##Function; \
+        return pointer##name; \
+    }
+
 #define SOFT_LINK_CONSTANT(framework, name, type) \
     static type init##name(); \
     static type (*get##name)() = init##name; \
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to