Changeset 248175 in webkit


Ignore:
Timestamp:
Aug 2, 2019 1:22:18 PM (5 years ago)
Author:
commit-queue@webkit.org
Message:

Web Inspector: Crash when interacting with Template Content in Console
https://bugs.webkit.org/show_bug.cgi?id=196280

Patch by Yury Semikhatsky <yurys@chromium.org> on 2019-08-02
Reviewed by Joseph Pecoraro.

Source/WebCore:

Test: inspector/dom/inspect-template-node.html

  • bindings/js/JSDOMBindingSecurity.cpp:

(WebCore::canAccessDocument): if target element is from a
<template> use its host document to check the access. Elements
from the host document always have access to its template elements content.

  • inspector/agents/InspectorDOMAgent.cpp:

(WebCore::InspectorDOMAgent::resolveNode): templates are created in
special template document which doesn't have a frame, in such case get
the frame from the host document.

LayoutTests:

  • inspector/dom/inspect-template-node-expected.txt: Added.
  • inspector/dom/inspect-template-node.html: Added.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r248172 r248175  
     12019-08-02  Yury Semikhatsky  <yurys@chromium.org>
     2
     3        Web Inspector: Crash when interacting with Template Content in Console
     4        https://bugs.webkit.org/show_bug.cgi?id=196280
     5
     6        Reviewed by Joseph Pecoraro.
     7
     8        * inspector/dom/inspect-template-node-expected.txt: Added.
     9        * inspector/dom/inspect-template-node.html: Added.
     10
    1112019-08-02  Ryosuke Niwa  <rniwa@webkit.org>
    212
  • trunk/Source/WebCore/ChangeLog

    r248173 r248175  
     12019-08-02  Yury Semikhatsky  <yurys@chromium.org>
     2
     3        Web Inspector: Crash when interacting with Template Content in Console
     4        https://bugs.webkit.org/show_bug.cgi?id=196280
     5
     6        Reviewed by Joseph Pecoraro.
     7
     8        Test: inspector/dom/inspect-template-node.html
     9
     10        * bindings/js/JSDOMBindingSecurity.cpp:
     11        (WebCore::canAccessDocument): if target element is from a
     12        <template> use its host document to check the access. Elements
     13        from the host document always have access to its template elements content.
     14        * inspector/agents/InspectorDOMAgent.cpp:
     15        (WebCore::InspectorDOMAgent::resolveNode): templates are created in
     16        special template document which doesn't have a frame, in such case get
     17        the frame from the host document.
     18
    1192019-08-02  Ryosuke Niwa  <rniwa@webkit.org>
    220
  • trunk/Source/WebCore/bindings/js/JSDOMBindingSecurity.cpp

    r237105 r248175  
    5050    if (!targetDocument)
    5151        return false;
     52
     53    if (auto* templateHost = targetDocument->templateDocumentHost())
     54        targetDocument = templateHost;
    5255
    5356    DOMWindow& active = activeDOMWindow(*state);
  • trunk/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp

    r246490 r248175  
    25952595RefPtr<Inspector::Protocol::Runtime::RemoteObject> InspectorDOMAgent::resolveNode(Node* node, const String& objectGroup)
    25962596{
    2597     auto* frame = node->document().frame();
     2597    Document* document = &node->document();
     2598    if (auto* templateHost = document->templateDocumentHost())
     2599        document = templateHost;
     2600    auto* frame =  document->frame();
    25982601    if (!frame)
    25992602        return nullptr;
Note: See TracChangeset for help on using the changeset viewer.