⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 249156 in webkit


Ignore:
Timestamp:
Aug 27, 2019, 11:38:41 AM (7 years ago)
Author:
Chris Dumez
Message:

Crash under WebCore::jsNotificationConstructorPermission
https://bugs.webkit.org/show_bug.cgi?id=201186
<rdar://problem/53962833>

Reviewed by Youenn Fablet.

Source/WebCore:

Update the Notification API implementation to null-check the page before using. The page becomes null
when using the API in a frame that gets detached from its parent while in the middle of running
script.

Test: http/tests/notifications/request-in-detached-frame.html

  • Modules/notifications/Notification.cpp:

(WebCore::Notification::permission):
(WebCore::Notification::requestPermission):

LayoutTests:

Add layout test coverage.

  • http/tests/notifications/request-in-detached-frame-expected.txt: Added.
  • http/tests/notifications/request-in-detached-frame.html: Added.
  • http/tests/notifications/resources/request-in-detached-frame-subframe.html: Added.
Location:
trunk
Files:
3 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r249153 r249156  
     12019-08-27  Chris Dumez  <cdumez@apple.com>
     2
     3        Crash under WebCore::jsNotificationConstructorPermission
     4        https://bugs.webkit.org/show_bug.cgi?id=201186
     5        <rdar://problem/53962833>
     6
     7        Reviewed by Youenn Fablet.
     8
     9        Add layout test coverage.
     10
     11        * http/tests/notifications/request-in-detached-frame-expected.txt: Added.
     12        * http/tests/notifications/request-in-detached-frame.html: Added.
     13        * http/tests/notifications/resources/request-in-detached-frame-subframe.html: Added.
     14
    1152019-08-27  Ryan Haddad  <ryanhaddad@apple.com>
    216
  • trunk/Source/WebCore/ChangeLog

    r249154 r249156  
     12019-08-27  Chris Dumez  <cdumez@apple.com>
     2
     3        Crash under WebCore::jsNotificationConstructorPermission
     4        https://bugs.webkit.org/show_bug.cgi?id=201186
     5        <rdar://problem/53962833>
     6
     7        Reviewed by Youenn Fablet.
     8
     9        Update the Notification API implementation to null-check the page before using. The page becomes null
     10        when using the API in a frame that gets detached from its parent while in the middle of running
     11        script.
     12
     13        Test: http/tests/notifications/request-in-detached-frame.html
     14
     15        * Modules/notifications/Notification.cpp:
     16        (WebCore::Notification::permission):
     17        (WebCore::Notification::requestPermission):
     18
    1192019-08-27  Youenn Fablet  <youenn@apple.com>
    220
  • trunk/Source/WebCore/Modules/notifications/Notification.cpp

    r248846 r249156  
    167167auto Notification::permission(Document& document) -> Permission
    168168{
     169    auto* page = document.page();
     170    if (!page)
     171        return Permission::Default;
     172
    169173    return NotificationController::from(document.page())->client().checkPermission(&document);
    170174}
     
    172176void Notification::requestPermission(Document& document, RefPtr<NotificationPermissionCallback>&& callback)
    173177{
    174     NotificationController::from(document.page())->client().requestPermission(&document, WTFMove(callback));
     178    auto* page = document.page();
     179    if (!page)
     180        return;
     181
     182    NotificationController::from(page)->client().requestPermission(&document, WTFMove(callback));
    175183}
    176184
Note: See TracChangeset for help on using the changeset viewer.