- Revision
- 256225
- Author
- pvol...@apple.com
- Date
- 2020-02-10 15:49:15 -0800 (Mon, 10 Feb 2020)
Log Message
[watchOS] Notification listener is never unregistered
https://bugs.webkit.org/show_bug.cgi?id=207459
Source/WebKit:
<rdar://problem/58923393>
Reviewed by Maciej Stachowiak.
On watchOS, the backlight changed notification is registered in WebProcessPool::registerNotificationObservers(),
but not unregistered in WebProcessPool::unregisterNotificationObservers().
API test: WebKit.BacklightLevelNotificationCrash
* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::unregisterNotificationObservers):
Tools:
Reviewed by Maciej Stachowiak.
Add a test which tests that posting a backlight level change notification will not cause a crash.
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit/BacklightLevelNotification.mm: Added.
(TEST):
Modified Paths
Added Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (256224 => 256225)
--- trunk/Source/WebKit/ChangeLog 2020-02-10 23:46:36 UTC (rev 256224)
+++ trunk/Source/WebKit/ChangeLog 2020-02-10 23:49:15 UTC (rev 256225)
@@ -1,3 +1,19 @@
+2020-02-10 Per Arne Vollan <pvol...@apple.com>
+
+ [watchOS] Notification listener is never unregistered
+ https://bugs.webkit.org/show_bug.cgi?id=207459
+ <rdar://problem/58923393>
+
+ Reviewed by Maciej Stachowiak.
+
+ On watchOS, the backlight changed notification is registered in WebProcessPool::registerNotificationObservers(),
+ but not unregistered in WebProcessPool::unregisterNotificationObservers().
+
+ API test: WebKit.BacklightLevelNotificationCrash
+
+ * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
+ (WebKit::WebProcessPool::unregisterNotificationObservers):
+
2020-02-10 James Howard <jameshow...@mac.com>
Standard gamepad mapping for GameControllerGamepads
Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm (256224 => 256225)
--- trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm 2020-02-10 23:46:36 UTC (rev 256224)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm 2020-02-10 23:49:15 UTC (rev 256225)
@@ -572,9 +572,11 @@
#endif
[[NSNotificationCenter defaultCenter] removeObserver:m_activationObserver.get()];
[[NSNotificationCenter defaultCenter] removeObserver:m_deactivationObserver.get()];
-#elif PLATFORM(IOS)
+#elif !PLATFORM(MACCATALYST)
CFNotificationCenterRemoveObserver(CFNotificationCenterGetDarwinNotifyCenter(), this, static_cast<CFStringRef>(UIBacklightLevelChangedNotification) , nullptr);
+#if PLATFORM(IOS)
[[NSNotificationCenter defaultCenter] removeObserver:m_accessibilityEnabledObserver.get()];
+#endif // PLATFORM(IOS)
#endif // !PLATFORM(IOS_FAMILY)
}
Modified: trunk/Tools/ChangeLog (256224 => 256225)
--- trunk/Tools/ChangeLog 2020-02-10 23:46:36 UTC (rev 256224)
+++ trunk/Tools/ChangeLog 2020-02-10 23:49:15 UTC (rev 256225)
@@ -1,3 +1,16 @@
+2020-02-10 Per Arne Vollan <pvol...@apple.com>
+
+ [watchOS] Notification listener is never unregistered
+ https://bugs.webkit.org/show_bug.cgi?id=207459
+
+ Reviewed by Maciej Stachowiak.
+
+ Add a test which tests that posting a backlight level change notification will not cause a crash.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WebKit/BacklightLevelNotification.mm: Added.
+ (TEST):
+
2020-02-10 James Howard <jameshow...@mac.com>
Standard gamepad mapping for GameControllerGamepads
Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (256224 => 256225)
--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2020-02-10 23:46:36 UTC (rev 256224)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2020-02-10 23:49:15 UTC (rev 256225)
@@ -875,6 +875,7 @@
C0BD669F131D3CFF00E18F2A /* ResponsivenessTimerDoesntFireEarly_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C0BD669E131D3CFF00E18F2A /* ResponsivenessTimerDoesntFireEarly_Bundle.cpp */; };
C0C5D3C61459912900A802A6 /* GetBackingScaleFactor_Bundle.mm in Sources */ = {isa = PBXBuildFile; fileRef = C0C5D3BD14598B6F00A802A6 /* GetBackingScaleFactor_Bundle.mm */; };
C145CC0C23DA5A1F003A5EEB /* MimeTypes.mm in Sources */ = {isa = PBXBuildFile; fileRef = C145CC0B23DA5A0F003A5EEB /* MimeTypes.mm */; };
+ C15CBB3023F1FF1A00300CC7 /* BacklightLevelNotification.mm in Sources */ = {isa = PBXBuildFile; fileRef = C15CBB2F23F1FF1A00300CC7 /* BacklightLevelNotification.mm */; };
C1692DCA23D10DAE006E88F7 /* Battery.mm in Sources */ = {isa = PBXBuildFile; fileRef = C1692DC923D10DAE006E88F7 /* Battery.mm */; };
C20F88A72295B96700D610FA /* CoreText.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C20F88A62295B96700D610FA /* CoreText.framework */; };
C22FA32B228F8708009D7988 /* TextWidth.mm in Sources */ = {isa = PBXBuildFile; fileRef = C22FA32A228F8708009D7988 /* TextWidth.mm */; };
@@ -2422,6 +2423,7 @@
C0C5D3BC14598B6F00A802A6 /* GetBackingScaleFactor.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GetBackingScaleFactor.mm; sourceTree = "<group>"; };
C0C5D3BD14598B6F00A802A6 /* GetBackingScaleFactor_Bundle.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GetBackingScaleFactor_Bundle.mm; sourceTree = "<group>"; };
C145CC0B23DA5A0F003A5EEB /* MimeTypes.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MimeTypes.mm; sourceTree = "<group>"; };
+ C15CBB2F23F1FF1A00300CC7 /* BacklightLevelNotification.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = BacklightLevelNotification.mm; sourceTree = "<group>"; };
C1692DC923D10DAE006E88F7 /* Battery.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = Battery.mm; sourceTree = "<group>"; };
C1D8EE212028E8E3008EB141 /* WebProcessTerminate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebProcessTerminate.mm; sourceTree = "<group>"; };
C20F88A62295B96700D610FA /* CoreText.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreText.framework; path = System/Library/Frameworks/CoreText.framework; sourceTree = SDKROOT; };
@@ -2863,6 +2865,7 @@
0F139E741A423A4600F590F5 /* cocoa */ = {
isa = PBXGroup;
children = (
+ C15CBB2F23F1FF1A00300CC7 /* BacklightLevelNotification.mm */,
C1692DC923D10DAE006E88F7 /* Battery.mm */,
C145CC0B23DA5A0F003A5EEB /* MimeTypes.mm */,
0F139E751A423A5300F590F5 /* WeakObjCPtr.mm */,
@@ -4643,6 +4646,7 @@
0711DF52226A95FC003DD2F7 /* AVFoundationSoftLinkTest.mm in Sources */,
7CCE7EB51A411A7E00447C4C /* BackForwardList.mm in Sources */,
1C7FEB20207C0F2E00D23278 /* BackgroundColor.mm in Sources */,
+ C15CBB3023F1FF1A00300CC7 /* BacklightLevelNotification.mm in Sources */,
C1692DCA23D10DAE006E88F7 /* Battery.mm in Sources */,
374B7A601DF36EEE00ACCB6C /* BundleEditingDelegate.mm in Sources */,
7A89BB67233164320042CB1E /* BundleFormDelegate.mm in Sources */,
Added: trunk/Tools/TestWebKitAPI/Tests/WebKit/BacklightLevelNotification.mm (0 => 256225)
--- trunk/Tools/TestWebKitAPI/Tests/WebKit/BacklightLevelNotification.mm (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit/BacklightLevelNotification.mm 2020-02-10 23:49:15 UTC (rev 256225)
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if PLATFORM(IOS_FAMILY)
+
+#import "PlatformUtilities.h"
+#import "TestWKWebView.h"
+#import <WebKit/WKProcessPoolPrivate.h>
+#import <WebKit/_WKProcessPoolConfiguration.h>
+
+TEST(WebKit, BacklightLevelNotificationCrash)
+{
+ {
+ auto poolConfiguration = adoptNS([[_WKProcessPoolConfiguration alloc] init]);
+ auto pool = adoptNS([[WKProcessPool alloc] _initWithConfiguration:poolConfiguration.get()]);
+ auto viewConfiguration = adoptNS([[WKWebViewConfiguration alloc] init]);
+ [viewConfiguration setProcessPool:pool.get()];
+ }
+
+ CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter(), CFSTR("UIBacklightLevelChangedNotification"), NULL, NULL, false);
+}
+
+#endif // PLATFORM(IOS_FAMILY)