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

Changeset 244566 in webkit


Ignore:
Timestamp:
Apr 23, 2019, 2:06:43 PM (7 years ago)
Author:
Devin Rousso
Message:

Web Inspector: Uncaught Exception: null is not an object (evaluating 'this.ownerDocument.frameIdentifier')
https://bugs.webkit.org/show_bug.cgi?id=196420
<rdar://problem/49444205>

Reviewed by Timothy Hatcher.

Source/JavaScriptCore:

  • inspector/protocol/DOM.json:

Modify the existing frameId to represent the owner frame of the node, rather than the
frame it holds (in the case of an <iframe>).

Source/WebCore:

Modify the existing frameId to represent the owner frame of the node, rather than the
frame it holds (in the case of an <iframe>).

  • inspector/agents/InspectorDOMAgent.cpp:

(WebCore::InspectorDOMAgent::buildObjectForNode):

Source/WebInspectorUI:

  • UserInterface/Models/DOMNode.js:

(WI.DOMNode):
(WI.DOMNode.prototype.get frame): Added.
(WI.DOMNode.prototype.get frameIdentifier): Deleted.
Modify the existing frameId to represent the owner frame of the node, rather than the
frame it holds (in the case of an <iframe>).

  • UserInterface/Controllers/DOMDebuggerManager.js:

(WI.DOMDebuggerManager.prototype.domBreakpointsForNode):
(WI.DOMDebuggerManager.prototype._detachDOMBreakpoint):
(WI.DOMDebuggerManager.prototype._resolveDOMBreakpoint):
(WI.DOMDebuggerManager.prototype._nodeInserted):
(WI.DOMDebuggerManager.prototype._nodeRemoved):

  • UserInterface/Views/DOMTreeElement.js:

(WI.DOMTreeElement.prototype._populateTagContextMenu):
(WI.DOMTreeElement.prototype._buildAttributeDOM):

  • UserInterface/Views/QuickConsole.js:

(WI.QuickConsole.prototype._selectExecutionContext):

  • UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js:

(WI.SpreadsheetCSSStyleDeclarationSection.prototype._highlightNodesWithSelector):

Location:
trunk/Source
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r244558 r244566  
     12019-04-23  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: Uncaught Exception: null is not an object (evaluating 'this.ownerDocument.frameIdentifier')
     4        https://bugs.webkit.org/show_bug.cgi?id=196420
     5        <rdar://problem/49444205>
     6
     7        Reviewed by Timothy Hatcher.
     8
     9        * inspector/protocol/DOM.json:
     10        Modify the existing `frameId` to represent the owner frame of the node, rather than the
     11        frame it holds (in the case of an `<iframe>`).
     12
    1132019-04-23  Alex Christensen  <achristensen@webkit.org>
    214
  • trunk/Source/JavaScriptCore/inspector/protocol/DOM.json

    r243244 r244566  
    4848                { "name": "localName", "type": "string", "description": "<code>Node</code>'s localName." },
    4949                { "name": "nodeValue", "type": "string", "description": "<code>Node</code>'s nodeValue." },
     50                { "name": "frameId", "$ref": "Network.FrameId", "optional": true, "description": "Identifier of the containing frame." },
    5051                { "name": "childNodeCount", "type": "integer", "optional": true, "description": "Child count for <code>Container</code> nodes." },
    5152                { "name": "children", "type": "array", "optional": true, "items": { "$ref": "Node" }, "description": "Child nodes of this node when requested with children." },
     
    6162                { "name": "shadowRootType", "$ref": "ShadowRootType", "optional": true, "description": "Shadow root type." },
    6263                { "name": "customElementState", "$ref": "CustomElementState", "optional": true, "description": "Custom element state." },
    63                 { "name": "frameId", "$ref": "Network.FrameId", "optional": true, "description": "Frame ID for frame owner elements." },
    6464                { "name": "contentDocument", "$ref": "Node", "optional": true, "description": "Content document for frame owner elements." },
    6565                { "name": "shadowRoots", "type": "array", "optional": true, "items": { "$ref": "Node" }, "description": "Shadow root list for given element host." },
  • trunk/Source/WebCore/ChangeLog

    r244563 r244566  
     12019-04-23  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: Uncaught Exception: null is not an object (evaluating 'this.ownerDocument.frameIdentifier')
     4        https://bugs.webkit.org/show_bug.cgi?id=196420
     5        <rdar://problem/49444205>
     6
     7        Reviewed by Timothy Hatcher.
     8
     9        Modify the existing `frameId` to represent the owner frame of the node, rather than the
     10        frame it holds (in the case of an `<iframe>`).
     11
     12        * inspector/agents/InspectorDOMAgent.cpp:
     13        (WebCore::InspectorDOMAgent::buildObjectForNode):
     14
    1152019-04-23  Devin Rousso  <drousso@apple.com>
    216
  • trunk/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp

    r244476 r244566  
    6060#include "Frame.h"
    6161#include "FrameTree.h"
     62#include "FrameView.h"
    6263#include "FullscreenManager.h"
    6364#include "HTMLElement.h"
     
    15621563
    15631564    auto* pageAgent = m_instrumentingAgents.inspectorPageAgent();
     1565    if (pageAgent) {
     1566        if (auto* frameView = node->document().view())
     1567            value->setFrameId(pageAgent->frameId(&frameView->frame()));
     1568    }
    15641569
    15651570    if (is<Element>(*node)) {
     
    15671572        value->setAttributes(buildArrayForElementAttributes(&element));
    15681573        if (is<HTMLFrameOwnerElement>(element)) {
    1569             HTMLFrameOwnerElement& frameOwner = downcast<HTMLFrameOwnerElement>(element);
    1570             if (pageAgent) {
    1571                 Frame* frame = frameOwner.contentFrame();
    1572                 if (frame)
    1573                     value->setFrameId(pageAgent->frameId(frame));
    1574             }
    1575             Document* document = frameOwner.contentDocument();
    1576             if (document)
     1574            if (auto* document = downcast<HTMLFrameOwnerElement>(element).contentDocument())
    15771575                value->setContentDocument(buildObjectForNode(document, 0, nodesMap));
    15781576        }
  • trunk/Source/WebInspectorUI/ChangeLog

    r244560 r244566  
     12019-04-23  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: Uncaught Exception: null is not an object (evaluating 'this.ownerDocument.frameIdentifier')
     4        https://bugs.webkit.org/show_bug.cgi?id=196420
     5        <rdar://problem/49444205>
     6
     7        Reviewed by Timothy Hatcher.
     8
     9        * UserInterface/Models/DOMNode.js:
     10        (WI.DOMNode):
     11        (WI.DOMNode.prototype.get frame): Added.
     12        (WI.DOMNode.prototype.get frameIdentifier): Deleted.
     13        Modify the existing `frameId` to represent the owner frame of the node, rather than the
     14        frame it holds (in the case of an `<iframe>`).
     15
     16        * UserInterface/Controllers/DOMDebuggerManager.js:
     17        (WI.DOMDebuggerManager.prototype.domBreakpointsForNode):
     18        (WI.DOMDebuggerManager.prototype._detachDOMBreakpoint):
     19        (WI.DOMDebuggerManager.prototype._resolveDOMBreakpoint):
     20        (WI.DOMDebuggerManager.prototype._nodeInserted):
     21        (WI.DOMDebuggerManager.prototype._nodeRemoved):
     22        * UserInterface/Views/DOMTreeElement.js:
     23        (WI.DOMTreeElement.prototype._populateTagContextMenu):
     24        (WI.DOMTreeElement.prototype._buildAttributeDOM):
     25        * UserInterface/Views/QuickConsole.js:
     26        (WI.QuickConsole.prototype._selectExecutionContext):
     27        * UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js:
     28        (WI.SpreadsheetCSSStyleDeclarationSection.prototype._highlightNodesWithSelector):
     29
    1302019-04-23  Devin Rousso  <drousso@apple.com>
    231
  • trunk/Source/WebInspectorUI/UserInterface/Controllers/DOMDebuggerManager.js

    r244279 r244566  
    171171        console.assert(node instanceof WI.DOMNode);
    172172
    173         if (!node)
     173        if (!node || !node.frame)
    174174            return [];
    175175
    176         let domBreakpointNodeIdentifierMap = this._domBreakpointFrameIdentifierMap.get(node.frameIdentifier);
     176        let domBreakpointNodeIdentifierMap = this._domBreakpointFrameIdentifierMap.get(node.frame.id);
    177177        if (!domBreakpointNodeIdentifierMap)
    178178            return [];
     
    398398        let node = WI.domManager.nodeForId(nodeIdentifier);
    399399        console.assert(node, "Missing DOM node for breakpoint.", breakpoint);
    400         if (!node)
    401             return;
    402 
    403         let frameIdentifier = node.frameIdentifier;
     400        if (!node || !node.frame)
     401            return;
     402
     403        let frameIdentifier = node.frame.id;
    404404        let domBreakpointNodeIdentifierMap = this._domBreakpointFrameIdentifierMap.get(frameIdentifier);
    405405        console.assert(domBreakpointNodeIdentifierMap, "Missing DOM breakpoints for node parent frame.", node);
     
    458458        let node = WI.domManager.nodeForId(nodeIdentifier);
    459459        console.assert(node, "Missing DOM node for nodeIdentifier.", nodeIdentifier);
    460         if (!node)
    461             return;
    462 
    463         let frameIdentifier = node.frameIdentifier;
     460        if (!node || !node.frame)
     461            return;
     462
     463        let frameIdentifier = node.frame.id;
    464464        let domBreakpointNodeIdentifierMap = this._domBreakpointFrameIdentifierMap.get(frameIdentifier);
    465465        if (!domBreakpointNodeIdentifierMap) {
     
    612612    {
    613613        let node = event.data.node;
    614         if (node.nodeType() !== Node.ELEMENT_NODE || !node.ownerDocument)
    615             return;
    616 
    617         let url = node.ownerDocument.documentURL;
     614        if (node.nodeType() !== Node.ELEMENT_NODE || !node.frame)
     615            return;
     616
     617        let url = node.frame.url;
    618618        let breakpoints = this._domBreakpointURLMap.get(url);
    619619        if (!breakpoints)
     
    634634    {
    635635        let node = event.data.node;
    636         if (node.nodeType() !== Node.ELEMENT_NODE || !node.ownerDocument)
    637             return;
    638 
    639         let domBreakpointNodeIdentifierMap = this._domBreakpointFrameIdentifierMap.get(node.frameIdentifier);
     636        if (node.nodeType() !== Node.ELEMENT_NODE || !node.frame)
     637            return;
     638
     639        let domBreakpointNodeIdentifierMap = this._domBreakpointFrameIdentifierMap.get(node.frame.id);
    640640        if (!domBreakpointNodeIdentifierMap)
    641641            return;
     
    648648
    649649        if (!domBreakpointNodeIdentifierMap.size)
    650             this._domBreakpointFrameIdentifierMap.delete(node.frameIdentifier);
     650            this._domBreakpointFrameIdentifierMap.delete(node.frame.id);
    651651
    652652        for (let breakpoint of breakpoints)
  • trunk/Source/WebInspectorUI/UserInterface/Models/DOMNode.js

    r244267 r244566  
    5757            this.ownerDocument = doc;
    5858
     59        this._frame = null;
     60
     61        // COMPATIBILITY (iOS 12.2): DOM.Node.frameId was changed to represent the owner frame, not the content frame.
     62        if (InspectorBackend.domains.Timeline && !InspectorBackend.domains.Timeline.hasEvent("programmaticCaptureStarted")) {
     63            if (payload.frameId)
     64                this._frame = WI.networkManager.frameForIdentifier(payload.frameId);
     65        }
     66
     67        if (!this._frame && this.ownerDocument)
     68            this._frame = WI.networkManager.frameForIdentifier(this.ownerDocument.frameIdentifier);
     69
    5970        this._attributes = [];
    6071        this._attributesMap = new Map;
     
    116127            this._renumber();
    117128        }
    118 
    119         if (payload.frameId)
    120             this._frameIdentifier = payload.frameId;
    121129
    122130        if (this._nodeType === Node.ELEMENT_NODE) {
     
    179187    // Public
    180188
     189    get frame() { return this._frame; }
    181190    get domEvents() { return this._domEvents; }
    182191    get lowPowerRanges() { return this._lowPowerRanges; }
    183 
    184     get frameIdentifier()
    185     {
    186         return this._frameIdentifier || this.ownerDocument.frameIdentifier;
    187     }
    188 
    189     get frame()
    190     {
    191         if (!this._frame)
    192             this._frame = WI.networkManager.frameForIdentifier(this.frameIdentifier);
    193         return this._frame;
    194     }
    195192
    196193    get attached()
  • trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js

    r244155 r244566  
    737737        let attached = node.attached;
    738738
    739         if (event.target && event.target.tagName === "A") {
    740             let url = event.target.href;
    741             let frame = WI.networkManager.frameForIdentifier(node.frameIdentifier);
    742             WI.appendContextMenuItemsForURL(contextMenu, url, {frame});
    743         }
     739        if (event.target && event.target.tagName === "A")
     740            WI.appendContextMenuItemsForURL(contextMenu, event.target.href, {frame: node.frame});
    744741
    745742        contextMenu.appendSeparator();
     
    12771274
    12781275        if (name === "src" || /\bhref\b/.test(name)) {
    1279             let baseURL = node.ownerDocument ? node.ownerDocument.documentURL : null;
     1276            let baseURL = node.frame ? node.frame.url : null;
    12801277            let rewrittenURL = absoluteURL(value, baseURL);
    12811278            value = value.insertWordBreakCharacters();
     
    12931290            }
    12941291        } else if (name === "srcset") {
    1295             let baseURL = node.ownerDocument ? node.ownerDocument.documentURL : null;
     1292            let baseURL = node.frame ? node.frame.url : null;
    12961293            attrValueElement = attrSpanElement.createChild("span", "html-attribute-value");
    12971294
  • trunk/Source/WebInspectorUI/UserInterface/Views/QuickConsole.js

    r243214 r244566  
    146146        let inspectedNode = WI.domManager.inspectedNode;
    147147        if (inspectedNode) {
    148             let frame = inspectedNode.ownerDocument.frame;
     148            let frame = inspectedNode.frame;
    149149            if (frame) {
    150150                if (this._shouldAutomaticallySelectExecutionContext)
    151151                    executionContext = frame.pageExecutionContext;
    152 
    153152                preferredName = this._preferredNameForFrame(frame);
    154153            }
  • trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js

    r243264 r244566  
    494494    _highlightNodesWithSelector()
    495495    {
     496        let node = this._style.node;
     497
    496498        if (!this._style.ownerRule) {
    497             WI.domManager.highlightDOMNode(this._style.node.id);
     499            WI.domManager.highlightDOMNode(node.id);
    498500            return;
    499501        }
    500502
    501503        let selectorText = this._selectorElement.textContent.trim();
    502         WI.domManager.highlightSelector(selectorText, this._style.node.ownerDocument.frameIdentifier);
     504        if (node.frame)
     505            WI.domManager.highlightSelector(selectorText, node.frame.id);
     506        else
     507            WI.domManager.highlightSelector(selectorText);
    503508    }
    504509
Note: See TracChangeset for help on using the changeset viewer.