- Revision
- 256942
- Author
- alanc...@apple.com
- Date
- 2020-02-19 13:31:20 -0800 (Wed, 19 Feb 2020)
Log Message
Cherry-pick r256225. rdar://problem/59446983
[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):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256225 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Modified Paths
Added Paths
Diff
Modified: branches/safari-609.1.20.2-branch/Source/WebKit/ChangeLog (256941 => 256942)
--- branches/safari-609.1.20.2-branch/Source/WebKit/ChangeLog 2020-02-19 21:23:23 UTC (rev 256941)
+++ branches/safari-609.1.20.2-branch/Source/WebKit/ChangeLog 2020-02-19 21:31:20 UTC (rev 256942)
@@ -1,3 +1,51 @@
+2020-02-19 Alan Coon <alanc...@apple.com>
+
+ Cherry-pick r256225. rdar://problem/59446983
+
+ [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):
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256225 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 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-14 Russell Epstein <repst...@apple.com>
Cherry-pick r252849. rdar://problem/59446998
Modified: branches/safari-609.1.20.2-branch/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm (256941 => 256942)
--- branches/safari-609.1.20.2-branch/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm 2020-02-19 21:23:23 UTC (rev 256941)
+++ branches/safari-609.1.20.2-branch/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm 2020-02-19 21:31:20 UTC (rev 256942)
@@ -553,9 +553,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: branches/safari-609.1.20.2-branch/Tools/ChangeLog (256941 => 256942)
--- branches/safari-609.1.20.2-branch/Tools/ChangeLog 2020-02-19 21:23:23 UTC (rev 256941)
+++ branches/safari-609.1.20.2-branch/Tools/ChangeLog 2020-02-19 21:31:20 UTC (rev 256942)
@@ -1,3 +1,48 @@
+2020-02-19 Alan Coon <alanc...@apple.com>
+
+ Cherry-pick r256225. rdar://problem/59446983
+
+ [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):
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256225 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 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-17 Ryan Haddad <ryanhad...@apple.com>
Cherry-pick r255566. rdar://problem/59524417
Modified: branches/safari-609.1.20.2-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (256941 => 256942)
--- branches/safari-609.1.20.2-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2020-02-19 21:23:23 UTC (rev 256941)
+++ branches/safari-609.1.20.2-branch/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2020-02-19 21:31:20 UTC (rev 256942)
@@ -855,6 +855,7 @@
C0ADBE9612FCA79B00D2C129 /* simple-form.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = C0ADBE8412FCA6B600D2C129 /* simple-form.html */; };
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 */; };
+ C15CBB3023F1FF1A00300CC7 /* BacklightLevelNotification.mm in Sources */ = {isa = PBXBuildFile; fileRef = C15CBB2F23F1FF1A00300CC7 /* BacklightLevelNotification.mm */; };
C20F88A72295B96700D610FA /* CoreText.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C20F88A62295B96700D610FA /* CoreText.framework */; };
C22FA32B228F8708009D7988 /* TextWidth.mm in Sources */ = {isa = PBXBuildFile; fileRef = C22FA32A228F8708009D7988 /* TextWidth.mm */; };
C22FA32D228F8AEB009D7988 /* TextWidth.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = C22FA32C228F877A009D7988 /* TextWidth.html */; };
@@ -2365,6 +2366,7 @@
C0BD669E131D3CFF00E18F2A /* ResponsivenessTimerDoesntFireEarly_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResponsivenessTimerDoesntFireEarly_Bundle.cpp; sourceTree = "<group>"; };
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>"; };
+ C15CBB2F23F1FF1A00300CC7 /* BacklightLevelNotification.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = BacklightLevelNotification.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; };
C22FA32A228F8708009D7988 /* TextWidth.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = TextWidth.mm; sourceTree = "<group>"; };
@@ -2804,6 +2806,7 @@
0F139E741A423A4600F590F5 /* cocoa */ = {
isa = PBXGroup;
children = (
+ C15CBB2F23F1FF1A00300CC7 /* BacklightLevelNotification.mm */,
0F139E751A423A5300F590F5 /* WeakObjCPtr.mm */,
);
name = cocoa;
@@ -4561,6 +4564,7 @@
0711DF52226A95FC003DD2F7 /* AVFoundationSoftLinkTest.mm in Sources */,
7CCE7EB51A411A7E00447C4C /* BackForwardList.mm in Sources */,
1C7FEB20207C0F2E00D23278 /* BackgroundColor.mm in Sources */,
+ C15CBB3023F1FF1A00300CC7 /* BacklightLevelNotification.mm in Sources */,
374B7A601DF36EEE00ACCB6C /* BundleEditingDelegate.mm in Sources */,
7A89BB67233164320042CB1E /* BundleFormDelegate.mm in Sources */,
A13EBBB11B87438000097110 /* BundleParameters.mm in Sources */,
Added: branches/safari-609.1.20.2-branch/Tools/TestWebKitAPI/Tests/WebKit/BacklightLevelNotification.mm (0 => 256942)
--- branches/safari-609.1.20.2-branch/Tools/TestWebKitAPI/Tests/WebKit/BacklightLevelNotification.mm (rev 0)
+++ branches/safari-609.1.20.2-branch/Tools/TestWebKitAPI/Tests/WebKit/BacklightLevelNotification.mm 2020-02-19 21:31:20 UTC (rev 256942)
@@ -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)