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

Changeset 249239 in webkit


Ignore:
Timestamp:
Aug 28, 2019, 10:57:12 PM (7 years ago)
Author:
Kocsen Chung
Message:

Cherry-pick r249156. rdar://problem/54775048

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.

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

Location:
branches/safari-608-branch
Files:
3 added
3 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-608-branch/LayoutTests/ChangeLog

    r249169 r249239  
     12019-08-28  Kocsen Chung  <kocsen_chung@apple.com>
     2
     3        Cherry-pick r249156. rdar://problem/54775048
     4
     5    Crash under WebCore::jsNotificationConstructorPermission
     6    https://bugs.webkit.org/show_bug.cgi?id=201186
     7    <rdar://problem/53962833>
     8   
     9    Reviewed by Youenn Fablet.
     10   
     11    Source/WebCore:
     12   
     13    Update the Notification API implementation to null-check the page before using. The page becomes null
     14    when using the API in a frame that gets detached from its parent while in the middle of running
     15    script.
     16   
     17    Test: http/tests/notifications/request-in-detached-frame.html
     18   
     19    * Modules/notifications/Notification.cpp:
     20    (WebCore::Notification::permission):
     21    (WebCore::Notification::requestPermission):
     22   
     23    LayoutTests:
     24   
     25    Add layout test coverage.
     26   
     27    * http/tests/notifications/request-in-detached-frame-expected.txt: Added.
     28    * http/tests/notifications/request-in-detached-frame.html: Added.
     29    * http/tests/notifications/resources/request-in-detached-frame-subframe.html: Added.
     30   
     31    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@249156 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     32
     33    2019-08-27  Chris Dumez  <cdumez@apple.com>
     34
     35            Crash under WebCore::jsNotificationConstructorPermission
     36            https://bugs.webkit.org/show_bug.cgi?id=201186
     37            <rdar://problem/53962833>
     38
     39            Reviewed by Youenn Fablet.
     40
     41            Add layout test coverage.
     42
     43            * http/tests/notifications/request-in-detached-frame-expected.txt: Added.
     44            * http/tests/notifications/request-in-detached-frame.html: Added.
     45            * http/tests/notifications/resources/request-in-detached-frame-subframe.html: Added.
     46
    1472019-08-27  Ryan Haddad  <ryanhaddad@apple.com>
    248
  • branches/safari-608-branch/Source/WebCore/ChangeLog

    r249238 r249239  
     12019-08-28  Kocsen Chung  <kocsen_chung@apple.com>
     2
     3        Cherry-pick r249156. rdar://problem/54775048
     4
     5    Crash under WebCore::jsNotificationConstructorPermission
     6    https://bugs.webkit.org/show_bug.cgi?id=201186
     7    <rdar://problem/53962833>
     8   
     9    Reviewed by Youenn Fablet.
     10   
     11    Source/WebCore:
     12   
     13    Update the Notification API implementation to null-check the page before using. The page becomes null
     14    when using the API in a frame that gets detached from its parent while in the middle of running
     15    script.
     16   
     17    Test: http/tests/notifications/request-in-detached-frame.html
     18   
     19    * Modules/notifications/Notification.cpp:
     20    (WebCore::Notification::permission):
     21    (WebCore::Notification::requestPermission):
     22   
     23    LayoutTests:
     24   
     25    Add layout test coverage.
     26   
     27    * http/tests/notifications/request-in-detached-frame-expected.txt: Added.
     28    * http/tests/notifications/request-in-detached-frame.html: Added.
     29    * http/tests/notifications/resources/request-in-detached-frame-subframe.html: Added.
     30   
     31    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@249156 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     32
     33    2019-08-27  Chris Dumez  <cdumez@apple.com>
     34
     35            Crash under WebCore::jsNotificationConstructorPermission
     36            https://bugs.webkit.org/show_bug.cgi?id=201186
     37            <rdar://problem/53962833>
     38
     39            Reviewed by Youenn Fablet.
     40
     41            Update the Notification API implementation to null-check the page before using. The page becomes null
     42            when using the API in a frame that gets detached from its parent while in the middle of running
     43            script.
     44
     45            Test: http/tests/notifications/request-in-detached-frame.html
     46
     47            * Modules/notifications/Notification.cpp:
     48            (WebCore::Notification::permission):
     49            (WebCore::Notification::requestPermission):
     50
    1512019-08-28  Kocsen Chung  <kocsen_chung@apple.com>
    252
  • branches/safari-608-branch/Source/WebCore/Modules/notifications/Notification.cpp

    r243887 r249239  
    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.