Loading Lookup causes http/tests/cache/post-redirect-get.php to fail
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 2 Dec 2014 23:41:23 +0000 (23:41 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 2 Dec 2014 23:41:23 +0000 (23:41 +0000)
https://bugs.webkit.org/show_bug.cgi?id=139204
<rdar://problem/19120929>

Reviewed by Anders Carlsson.

* WebView/WebView.mm:
(-[WebView _commonInitializationWithFrameName:groupName:]):
(-[WebView _showDictionaryLookupPopup:]):
* WebView/WebViewData.h:
Work around this by delaying the softlinking (and setting up the notification
observer) until we actually need it. There's still an underlying bug, but
this will fix the test.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@176695 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebView.mm
Source/WebKit/mac/WebView/WebViewData.h

index fc78c85..e250788 100644 (file)
@@ -1,3 +1,18 @@
+2014-12-02  Tim Horton  <timothy_horton@apple.com>
+
+        Loading Lookup causes http/tests/cache/post-redirect-get.php to fail
+        https://bugs.webkit.org/show_bug.cgi?id=139204
+
+        Reviewed by Anders Carlsson.
+
+        * WebView/WebView.mm:
+        (-[WebView _commonInitializationWithFrameName:groupName:]):
+        (-[WebView _showDictionaryLookupPopup:]):
+        * WebView/WebViewData.h:
+        Work around this by delaying the softlinking (and setting up the notification
+        observer) until we actually need it. There's still an underlying bug, but
+        this will fix the test.
+
 2014-12-02  Beth Dakin  <bdakin@apple.com>
 
         Yet another build fix.
index 2e5887e..70c5e58 100644 (file)
@@ -1029,9 +1029,6 @@ static void WebKitInitializeGamepadProviderIfNecessary()
 
 #if !PLATFORM(IOS)
     [self _registerDraggedTypes];
-
-    if (canLoadLUNotificationPopoverWillClose())
-        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_dictionaryLookupPopoverWillClose:) name:getLUNotificationPopoverWillClose() object:nil];
 #endif
 
     [self _setIsVisible:[self _isViewVisible]];
@@ -8621,7 +8618,12 @@ static void glibContextIterationCallback(CFRunLoopObserverRef, CFRunLoopActivity
     // Convert to screen coordinates.
     textBaselineOrigin = [self.window convertRectToScreen:NSMakeRect(textBaselineOrigin.x, textBaselineOrigin.y, 0, 0)].origin;
 
-    if (canLoadLUTermOptionDisableSearchTermIndicator()) {
+    if (canLoadLUTermOptionDisableSearchTermIndicator() && canLoadLUNotificationPopoverWillClose()) {
+        if (!_private->hasInitializedLookupObserver) {
+            [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_dictionaryLookupPopoverWillClose:) name:getLUNotificationPopoverWillClose() object:nil];
+            _private->hasInitializedLookupObserver = YES;
+        }
+
         RetainPtr<NSMutableDictionary> mutableOptions = adoptNS([dictionaryPopupInfo.options mutableCopy]);
         if (!mutableOptions)
             mutableOptions = adoptNS([[NSMutableDictionary alloc] init]);
index 2761ec5..b695e97 100644 (file)
@@ -152,6 +152,7 @@ private:
     WebActionMenuController *actionMenuController;
 #endif // __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
     std::unique_ptr<WebCore::TextIndicatorWindow> textIndicatorWindow;
+    BOOL hasInitializedLookupObserver;
 #endif // PLATFORM(MAC)
 
     BOOL allowsUndo;