WebKit Bugzilla
Attachment 358471 Details for
Bug 185843
: Web Inspector: extend XHR breakpoints to work with fetch
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-185843-20190106185632.patch (text/plain), 103.82 KB, created by
Devin Rousso
on 2019-01-06 17:56:33 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Devin Rousso
Created:
2019-01-06 17:56:33 PST
Size:
103.82 KB
patch
obsolete
>diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog >index ef46089a850bdc2a4206b553d0b522e5b16d5ed7..37ef2cc1224b14ccf1884bae0923a88480e4c866 100644 >--- a/Source/JavaScriptCore/ChangeLog >+++ b/Source/JavaScriptCore/ChangeLog >@@ -1,3 +1,17 @@ >+2019-01-06 Devin Rousso <drousso@apple.com> >+ >+ Web Inspector: extend XHR breakpoints to work with fetch >+ https://bugs.webkit.org/show_bug.cgi?id=185843 >+ <rdar://problem/40431027> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * inspector/protocol/DOMDebugger.json: >+ Rename `XHR` to `URL`. >+ >+ * inspector/protocol/Debugger.json: >+ Add `Fetch` to `reason` enum for the `Debugger.paused` event. >+ > 2019-01-04 Tadeu Zagallo <tzagallo@apple.com> > > Baseline version of get_by_id may corrupt metadata >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index e0534ad94a566f8d78f72d23c490e11b53aeeea3..5307fa21b1a7696a79549ca88f8520ae870eb309 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,32 @@ >+2019-01-06 Devin Rousso <drousso@apple.com> >+ >+ Web Inspector: extend XHR breakpoints to work with fetch >+ https://bugs.webkit.org/show_bug.cgi?id=185843 >+ <rdar://problem/40431027> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Test: inspector/dom-debugger/fetch-breakpoints.html >+ >+ * Modules/fetch/FetchResponse.cpp: >+ (WebCore::FetchResponse::fetch): >+ >+ * inspector/InspectorInstrumentation.h: >+ (WebCore::InspectorInstrumentation::willFetch): Added. >+ * inspector/InspectorInstrumentation.cpp: >+ (WebCore::InspectorInstrumentation::willFetchImpl): Added. >+ >+ * inspector/agents/InspectorDOMDebuggerAgent.h: >+ * inspector/agents/InspectorDOMDebuggerAgent.cpp: >+ (WebCore::InspectorDOMDebuggerAgent::discardBindings): >+ (WebCore::InspectorDOMDebuggerAgent::setURLBreakpoint): Added. >+ (WebCore::InspectorDOMDebuggerAgent::removeURLBreakpoint): Added. >+ (WebCore::InspectorDOMDebuggerAgent::breakOnURLIfNeeded): Added. >+ (WebCore::InspectorDOMDebuggerAgent::willSendXMLHttpRequest): >+ (WebCore::InspectorDOMDebuggerAgent::willFetch): Added. >+ (WebCore::InspectorDOMDebuggerAgent::setXHRBreakpoint): Deleted. >+ (WebCore::InspectorDOMDebuggerAgent::removeXHRBreakpoint): Deleted. >+ > 2019-01-06 Pablo Saavedra <psaavedra@igalia.com> > > [WPE][GTK] Building with ENABLE_VIDEO=OFF fails trying to use Document MediaPlayback functions. >diff --git a/Source/WebInspectorUI/ChangeLog b/Source/WebInspectorUI/ChangeLog >index f05867e772b1e72f1f71f2d8dd7aa992a18c40c6..227e486a787083ac5c7528438a60d0b513da4d05 100644 >--- a/Source/WebInspectorUI/ChangeLog >+++ b/Source/WebInspectorUI/ChangeLog >@@ -1,3 +1,62 @@ >+2019-01-06 Devin Rousso <drousso@apple.com> >+ >+ Web Inspector: extend XHR breakpoints to work with fetch >+ https://bugs.webkit.org/show_bug.cgi?id=185843 >+ <rdar://problem/40431027> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * UserInterface/Controllers/DOMDebuggerManager.js: >+ (WI.DOMDebuggerManager): >+ (WI.DOMDebuggerManager.supportsURLBreakpoints): Added. >+ (WI.DOMDebuggerManager.prototype.get urlBreakpoints): Added. >+ (WI.DOMDebuggerManager.prototype.urlBreakpointForURL): Added. >+ (WI.DOMDebuggerManager.prototype.addURLBreakpoint): Added. >+ (WI.DOMDebuggerManager.prototype.removeURLBreakpoint): Added. >+ (WI.DOMDebuggerManager.prototype._speculativelyResolveBreakpoints): >+ (WI.DOMDebuggerManager.prototype._updateURLBreakpoint): Added. >+ (WI.DOMDebuggerManager.prototype._resolveURLBreakpoint): Added. >+ (WI.DOMDebuggerManager.prototype._saveURLBreakpoints): Added. >+ (WI.DOMDebuggerManager.prototype._urlBreakpointDisabledStateDidChange): Added. >+ (WI.DOMDebuggerManager.prototype.get xhrBreakpoints): Deleted. >+ (WI.DOMDebuggerManager.prototype.xhrBreakpointForURL): Deleted. >+ (WI.DOMDebuggerManager.prototype.addXHRBreakpoint): Deleted. >+ (WI.DOMDebuggerManager.prototype.removeXHRBreakpoint): Deleted. >+ (WI.DOMDebuggerManager.prototype._updateXHRBreakpoint.breakpointUpdated): Deleted. >+ (WI.DOMDebuggerManager.prototype._updateXHRBreakpoint): Deleted. >+ (WI.DOMDebuggerManager.prototype._resolveXHRBreakpoint): Deleted. >+ (WI.DOMDebuggerManager.prototype._saveXHRBreakpoints): Deleted. >+ (WI.DOMDebuggerManager.prototype._xhrBreakpointDisabledStateDidChange): Deleted. >+ >+ * UserInterface/Controllers/DebuggerManager.js: >+ (WI.DebuggerManager.prototype._pauseReasonFromPayload): >+ >+ * UserInterface/Views/DebuggerSidebarPanel.js: >+ (WI.DebuggerSidebarPanel): >+ (WI.DebuggerSidebarPanel.prototype.willDismissPopover): >+ (WI.DebuggerSidebarPanel.prototype._addBreakpoint): >+ (WI.DebuggerSidebarPanel.prototype._treeSelectionDidChange): >+ (WI.DebuggerSidebarPanel.prototype._addTreeElement): >+ (WI.DebuggerSidebarPanel.prototype._updatePauseReasonSection): >+ (WI.DebuggerSidebarPanel.prototype._handleCreateBreakpointClicked): >+ >+ * UserInterface/Views/NavigationSidebarPanel.js: >+ (WI.NavigationSidebarPanel.prototype._isTreeElementWithoutRepresentedObject): >+ >+ * UserInterface/Models/URLBreakpoint.js: Renamed from Source/WebInspectorUI/UserInterface/Models/XHRBreakpoint.js. >+ * UserInterface/Views/URLBreakpointPopover.css: Renamed from Source/WebInspectorUI/UserInterface/Views/XHRBreakpointPopover.css. >+ * UserInterface/Views/URLBreakpointPopover.js: Renamed from Source/WebInspectorUI/UserInterface/Views/XHRBreakpointPopover.js. >+ * UserInterface/Views/URLBreakpointTreeElement.css: Renamed from Source/WebInspectorUI/UserInterface/Views/XHRBreakpointTreeElement.css. >+ * UserInterface/Views/URLBreakpointTreeElement.js: Renamed from Source/WebInspectorUI/UserInterface/Views/XHRBreakpointTreeElement.js. >+ >+ * UserInterface/Base/Setting.js: >+ (WI.Setting.takeDeprecatedValue): Added. >+ >+ * UserInterface/Main.html: >+ * UserInterface/Test.html: >+ >+ * Localizations/en.lproj/localizedStrings.js: >+ > 2019-01-04 Joseph Pecoraro <pecoraro@apple.com> > > Web Inspector: subclasses of WI.ClusterContentView don't save/restore content views after the initial view >diff --git a/Source/JavaScriptCore/inspector/protocol/DOMDebugger.json b/Source/JavaScriptCore/inspector/protocol/DOMDebugger.json >index b4204d18d057149f3d1bb2460ec9c3711114d801..b44c7f0b5eaba7c09026b5af9b30308602420773 100644 >--- a/Source/JavaScriptCore/inspector/protocol/DOMDebugger.json >+++ b/Source/JavaScriptCore/inspector/protocol/DOMDebugger.json >@@ -50,18 +50,18 @@ > ] > }, > { >- "name": "setXHRBreakpoint", >- "description": "Sets breakpoint on XMLHttpRequest.", >+ "name": "setURLBreakpoint", >+ "description": "Sets breakpoint on network activity for the given URL.", > "parameters": [ >- { "name": "url", "type": "string", "description": "Resource URL substring or regular expression. All XHRs having this substring in the URL will get stopped upon. An empty string will pause on all XHRs." }, >+ { "name": "url", "type": "string", "description": "Resource URL substring or regular expression. All requests having this substring in the URL will get stopped upon. An empty string will pause on all requests." }, > { "name": "isRegex", "type": "boolean", "optional": true, "description": "Whether the URL string is a regular expression." } > ] > }, > { >- "name": "removeXHRBreakpoint", >- "description": "Removes breakpoint from XMLHttpRequest.", >+ "name": "removeURLBreakpoint", >+ "description": "Removes breakpoint from network activity for the given URL.", > "parameters": [ >- { "name": "url", "type": "string", "description": "Resource URL substring. An empty string will stop pausing on all XHRs." } >+ { "name": "url", "type": "string", "description": "Resource URL substring. An empty string will stop pausing on all requests." } > ] > } > ] >diff --git a/Source/JavaScriptCore/inspector/protocol/Debugger.json b/Source/JavaScriptCore/inspector/protocol/Debugger.json >index 418a5be907cee7335231fcd4683bab92a1765c86..2ee444254aae10c3b4af7a11646921ee8574d279 100644 >--- a/Source/JavaScriptCore/inspector/protocol/Debugger.json >+++ b/Source/JavaScriptCore/inspector/protocol/Debugger.json >@@ -340,7 +340,7 @@ > "description": "Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria.", > "parameters": [ > { "name": "callFrames", "type": "array", "items": { "$ref": "CallFrame" }, "description": "Call stack the virtual machine stopped on." }, >- { "name": "reason", "type": "string", "enum": ["XHR", "DOM", "AnimationFrame", "EventListener", "Timer", "exception", "assert", "CSPViolation", "DebuggerStatement", "Breakpoint", "PauseOnNextStatement", "other"], "description": "Pause reason." }, >+ { "name": "reason", "type": "string", "enum": ["XHR", "Fetch", "DOM", "AnimationFrame", "EventListener", "Timer", "exception", "assert", "CSPViolation", "DebuggerStatement", "Breakpoint", "PauseOnNextStatement", "other"], "description": "Pause reason." }, > { "name": "data", "type": "object", "optional": true, "description": "Object containing break-specific auxiliary properties." }, > { "name": "asyncStackTrace", "$ref": "Console.StackTrace", "optional": true, "description": "Linked list of asynchronous StackTraces." } > ] >diff --git a/Source/WebCore/Modules/fetch/FetchResponse.cpp b/Source/WebCore/Modules/fetch/FetchResponse.cpp >index 8dafc645025a02f036254aa31c1bda37ece29aed..3e999d811166547b53c083008c4f92c9adb9e081 100644 >--- a/Source/WebCore/Modules/fetch/FetchResponse.cpp >+++ b/Source/WebCore/Modules/fetch/FetchResponse.cpp >@@ -31,6 +31,7 @@ > > #include "FetchRequest.h" > #include "HTTPParsers.h" >+#include "InspectorInstrumentation.h" > #include "JSBlob.h" > #include "MIMETypeRegistry.h" > #include "ReadableStreamSink.h" >@@ -229,6 +230,9 @@ void FetchResponse::fetch(ScriptExecutionContext& context, FetchRequest& request > responseCallback(Exception { NotSupportedError, "ReadableStream uploading is not supported"_s }); > return; > } >+ >+ InspectorInstrumentation::willFetch(context, request.url()); >+ > auto response = adoptRef(*new FetchResponse(context, FetchBody { }, FetchHeaders::create(FetchHeaders::Guard::Immutable), { })); > > response->body().consumer().setAsLoading(); >diff --git a/Source/WebCore/inspector/InspectorInstrumentation.cpp b/Source/WebCore/inspector/InspectorInstrumentation.cpp >index 62e09cf0747d6527ba9edb179e1c55e57b8f9cc7..cc8f1f033b0c420c056b34a613d96ee607414464 100644 >--- a/Source/WebCore/inspector/InspectorInstrumentation.cpp >+++ b/Source/WebCore/inspector/InspectorInstrumentation.cpp >@@ -298,6 +298,12 @@ void InspectorInstrumentation::willSendXMLHttpRequestImpl(InstrumentingAgents& i > domDebuggerAgent->willSendXMLHttpRequest(url); > } > >+void InspectorInstrumentation::willFetchImpl(InstrumentingAgents& instrumentingAgents, const String& url) >+{ >+ if (InspectorDOMDebuggerAgent* domDebuggerAgent = instrumentingAgents.inspectorDOMDebuggerAgent()) >+ domDebuggerAgent->willFetch(url); >+} >+ > void InspectorInstrumentation::didInstallTimerImpl(InstrumentingAgents& instrumentingAgents, int timerId, Seconds timeout, bool singleShot, ScriptExecutionContext& context) > { > if (InspectorDebuggerAgent* debuggerAgent = instrumentingAgents.inspectorDebuggerAgent()) >diff --git a/Source/WebCore/inspector/InspectorInstrumentation.h b/Source/WebCore/inspector/InspectorInstrumentation.h >index 6b20ccac91dbfded8879481f725f39ac60153f34..fdaea62164ad41a658c1c0338a59d844a4c9e6b0 100644 >--- a/Source/WebCore/inspector/InspectorInstrumentation.h >+++ b/Source/WebCore/inspector/InspectorInstrumentation.h >@@ -137,6 +137,7 @@ public: > static bool forcePseudoState(const Element&, CSSSelector::PseudoClassType); > > static void willSendXMLHttpRequest(ScriptExecutionContext*, const String& url); >+ static void willFetch(ScriptExecutionContext&, const String& url); > static void didInstallTimer(ScriptExecutionContext&, int timerId, Seconds timeout, bool singleShot); > static void didRemoveTimer(ScriptExecutionContext&, int timerId); > >@@ -328,6 +329,7 @@ private: > static bool forcePseudoStateImpl(InstrumentingAgents&, const Element&, CSSSelector::PseudoClassType); > > static void willSendXMLHttpRequestImpl(InstrumentingAgents&, const String& url); >+ static void willFetchImpl(InstrumentingAgents&, const String& url); > static void didInstallTimerImpl(InstrumentingAgents&, int timerId, Seconds timeout, bool singleShot, ScriptExecutionContext&); > static void didRemoveTimerImpl(InstrumentingAgents&, int timerId, ScriptExecutionContext&); > >@@ -695,6 +697,13 @@ inline void InspectorInstrumentation::willSendXMLHttpRequest(ScriptExecutionCont > willSendXMLHttpRequestImpl(*instrumentingAgents, url); > } > >+inline void InspectorInstrumentation::willFetch(ScriptExecutionContext& context, const String& url) >+{ >+ FAST_RETURN_IF_NO_FRONTENDS(void()); >+ if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context)) >+ willFetchImpl(*instrumentingAgents, url); >+} >+ > inline void InspectorInstrumentation::didInstallTimer(ScriptExecutionContext& context, int timerId, Seconds timeout, bool singleShot) > { > FAST_RETURN_IF_NO_FRONTENDS(void()); >diff --git a/Source/WebCore/inspector/agents/InspectorDOMDebuggerAgent.cpp b/Source/WebCore/inspector/agents/InspectorDOMDebuggerAgent.cpp >index dad24f794f0b4180d701c8de26ce167a8db7ef29..752070636acc8407e09086aeb5eb725f3f459749 100644 >--- a/Source/WebCore/inspector/agents/InspectorDOMDebuggerAgent.cpp >+++ b/Source/WebCore/inspector/agents/InspectorDOMDebuggerAgent.cpp >@@ -120,7 +120,6 @@ void InspectorDOMDebuggerAgent::frameDocumentUpdated(Frame& frame) > void InspectorDOMDebuggerAgent::discardBindings() > { > m_domBreakpoints.clear(); >- m_xhrBreakpoints.clear(); > } > > void InspectorDOMDebuggerAgent::setEventBreakpoint(ErrorString& error, const String& breakpointTypeString, const String& eventName) >@@ -408,39 +407,39 @@ void InspectorDOMDebuggerAgent::willFireAnimationFrame() > m_debuggerAgent->schedulePauseOnNextStatement(Inspector::DebuggerFrontendDispatcher::Reason::AnimationFrame, WTFMove(eventData)); > } > >-void InspectorDOMDebuggerAgent::setXHRBreakpoint(ErrorString&, const String& url, const bool* optionalIsRegex) >+void InspectorDOMDebuggerAgent::setURLBreakpoint(ErrorString&, const String& url, const bool* optionalIsRegex) > { > if (url.isEmpty()) { >- m_pauseOnAllXHRsEnabled = true; >+ m_pauseOnAllURLsEnabled = true; > return; > } > > bool isRegex = optionalIsRegex ? *optionalIsRegex : false; >- m_xhrBreakpoints.set(url, isRegex ? XHRBreakpointType::RegularExpression : XHRBreakpointType::Text); >+ m_urlBreakpoints.set(url, isRegex ? URLBreakpointType::RegularExpression : URLBreakpointType::Text); > } > >-void InspectorDOMDebuggerAgent::removeXHRBreakpoint(ErrorString&, const String& url) >+void InspectorDOMDebuggerAgent::removeURLBreakpoint(ErrorString&, const String& url) > { > if (url.isEmpty()) { >- m_pauseOnAllXHRsEnabled = false; >+ m_pauseOnAllURLsEnabled = false; > return; > } > >- m_xhrBreakpoints.remove(url); >+ m_urlBreakpoints.remove(url); > } > >-void InspectorDOMDebuggerAgent::willSendXMLHttpRequest(const String& url) >+void InspectorDOMDebuggerAgent::breakOnURLIfNeeded(const String& url, URLBreakpointSource source) > { > if (!m_debuggerAgent->breakpointsActive()) > return; > > String breakpointURL; >- if (m_pauseOnAllXHRsEnabled) >+ if (m_pauseOnAllURLsEnabled) > breakpointURL = emptyString(); > else { >- for (auto& entry : m_xhrBreakpoints) { >+ for (auto& entry : m_urlBreakpoints) { > const auto& query = entry.key; >- bool isRegex = entry.value == XHRBreakpointType::RegularExpression; >+ bool isRegex = entry.value == URLBreakpointType::RegularExpression; > auto regex = ContentSearchUtilities::createSearchRegex(query, false, isRegex); > if (regex.match(url) != -1) { > breakpointURL = query; >@@ -452,10 +451,36 @@ void InspectorDOMDebuggerAgent::willSendXMLHttpRequest(const String& url) > if (breakpointURL.isNull()) > return; > >+ Inspector::DebuggerFrontendDispatcher::Reason breakReason; >+ switch (source) { >+ case URLBreakpointSource::Fetch: >+ breakReason = Inspector::DebuggerFrontendDispatcher::Reason::Fetch; >+ break; >+ >+ case URLBreakpointSource::XHR: >+ breakReason = Inspector::DebuggerFrontendDispatcher::Reason::XHR; >+ break; >+ >+ default: >+ ASSERT_NOT_REACHED(); >+ breakReason = Inspector::DebuggerFrontendDispatcher::Reason::Other; >+ break; >+ } >+ > Ref<JSON::Object> eventData = JSON::Object::create(); > eventData->setString("breakpointURL", breakpointURL); > eventData->setString("url", url); >- m_debuggerAgent->breakProgram(Inspector::DebuggerFrontendDispatcher::Reason::XHR, WTFMove(eventData)); >+ m_debuggerAgent->breakProgram(breakReason, WTFMove(eventData)); >+} >+ >+void InspectorDOMDebuggerAgent::willSendXMLHttpRequest(const String& url) >+{ >+ breakOnURLIfNeeded(url, URLBreakpointSource::XHR); >+} >+ >+void InspectorDOMDebuggerAgent::willFetch(const String& url) >+{ >+ breakOnURLIfNeeded(url, URLBreakpointSource::Fetch); > } > > } // namespace WebCore >diff --git a/Source/WebCore/inspector/agents/InspectorDOMDebuggerAgent.h b/Source/WebCore/inspector/agents/InspectorDOMDebuggerAgent.h >index e3a4e1b1c34885ab3db0c81bfcd864138a6de8e7..459cb36943c4240b9f7d48ac340c8e471143debb 100644 >--- a/Source/WebCore/inspector/agents/InspectorDOMDebuggerAgent.h >+++ b/Source/WebCore/inspector/agents/InspectorDOMDebuggerAgent.h >@@ -57,8 +57,8 @@ public: > virtual ~InspectorDOMDebuggerAgent(); > > // DOMDebugger API >- void setXHRBreakpoint(ErrorString&, const String& url, const bool* optionalIsRegex) final; >- void removeXHRBreakpoint(ErrorString&, const String& url) final; >+ void setURLBreakpoint(ErrorString&, const String& url, const bool* optionalIsRegex) final; >+ void removeURLBreakpoint(ErrorString&, const String& url) final; > void setEventBreakpoint(ErrorString&, const String& breakpointType, const String& eventName) final; > void removeEventBreakpoint(ErrorString&, const String& breakpointType, const String& eventName) final; > void setDOMBreakpoint(ErrorString&, int nodeId, const String& type) final; >@@ -72,6 +72,7 @@ public: > void didRemoveDOMNode(Node&); > void willModifyDOMAttr(Element&); > void willSendXMLHttpRequest(const String& url); >+ void willFetch(const String& url); > void frameDocumentUpdated(Frame&); > void willHandleEvent(const Event&, const RegisteredEventListener&); > void willFireTimer(bool oneShot); >@@ -88,6 +89,9 @@ private: > void debuggerWasDisabled() final; > void disable(); > >+ enum class URLBreakpointSource { Fetch, XHR }; >+ void breakOnURLIfNeeded(const String& url, URLBreakpointSource); >+ > void descriptionForDOMEvent(Node& target, int breakpointType, bool insertion, JSON::Object& description); > void updateSubtreeBreakpoints(Node*, uint32_t rootMask, bool set); > bool hasBreakpoint(Node*, int type); >@@ -105,10 +109,9 @@ private: > WTF::PairHashTraits<WTF::StrongEnumHashTraits<EventBreakpointType>, WTF::HashTraits<String>> > > m_eventBreakpoints; > >- enum class XHRBreakpointType { Text, RegularExpression }; >- >- HashMap<String, XHRBreakpointType> m_xhrBreakpoints; >- bool m_pauseOnAllXHRsEnabled { false }; >+ enum class URLBreakpointType { RegularExpression, Text }; >+ HashMap<String, URLBreakpointType> m_urlBreakpoints; >+ bool m_pauseOnAllURLsEnabled { false }; > }; > > } // namespace WebCore >diff --git a/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js b/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js >index db4d51858742ebc8321edef91bc3b4855f64c8c0..3e77a6027354b259dc3d371dec8020ca369b399b 100644 >--- a/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js >+++ b/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js >@@ -980,12 +980,14 @@ localizedStrings["Trace: %s"] = "Trace: %s"; > localizedStrings["Transfer Size"] = "Transfer Size"; > localizedStrings["Transferred"] = "Transferred"; > localizedStrings["Triggered Breakpoint"] = "Triggered Breakpoint"; >+localizedStrings["Triggered URL Breakpoint"] = "Triggered URL Breakpoint"; > localizedStrings["Triggered XHR Breakpoint"] = "Triggered XHR Breakpoint"; > localizedStrings["True"] = "True"; > localizedStrings["Type"] = "Type"; > localizedStrings["Type Issue"] = "Type Issue"; > localizedStrings["Type information for variable: %s"] = "Type information for variable: %s"; > localizedStrings["URL"] = "URL"; >+localizedStrings["URL Breakpoint\u2026"] = "URL Breakpoint\u2026"; > localizedStrings["Unable to determine path to property from root"] = "Unable to determine path to property from root"; > localizedStrings["Unable to parse as JSON: %s"] = "Unable to parse as JSON: %s"; > localizedStrings["Unable to show certificate for \u201C%s\u201C"] = "Unable to show certificate for \u201C%s\u201C"; >diff --git a/Source/WebInspectorUI/UserInterface/Base/Setting.js b/Source/WebInspectorUI/UserInterface/Base/Setting.js >index 0f6db171e2b21bdd9c64ee912f93d6f9d339e7a2..a4c4407f52d65c74841963f72b2efc5109f4aca7 100644 >--- a/Source/WebInspectorUI/UserInterface/Base/Setting.js >+++ b/Source/WebInspectorUI/UserInterface/Base/Setting.js >@@ -43,6 +43,21 @@ WI.Setting = class Setting extends WI.Object > this._defaultValue = defaultValue; > } > >+ // Static >+ >+ static takeDeprecatedValue(key) >+ { >+ let value = undefined; >+ if (!window.InspectorTest && window.localStorage && key in window.localStorage) { >+ try { >+ value = JSON.parse(window.localStorage[key]); >+ } catch { } >+ >+ delete window.localStorage[key]; >+ } >+ return value; >+ } >+ > // Public > > get name() >diff --git a/Source/WebInspectorUI/UserInterface/Controllers/DOMDebuggerManager.js b/Source/WebInspectorUI/UserInterface/Controllers/DOMDebuggerManager.js >index 777051b3193527dc0f1f2fc48ce39719f25b6084..ab1cd8c57a089798197a6cb108a9804d6912515e 100644 >--- a/Source/WebInspectorUI/UserInterface/Controllers/DOMDebuggerManager.js >+++ b/Source/WebInspectorUI/UserInterface/Controllers/DOMDebuggerManager.js >@@ -36,15 +36,15 @@ WI.DOMDebuggerManager = class DOMDebuggerManager extends WI.Object > this._eventBreakpointSetting = new WI.Setting("event-breakpoints", []); > this._eventBreakpoints = []; > >- this._xhrBreakpointsSetting = new WI.Setting("xhr-breakpoints", []); >- this._xhrBreakpoints = []; >+ this._urlBreakpointsSetting = new WI.Setting("url-breakpoints", WI.Setting.takeDeprecatedValue("xhr-breakpoints") || []); >+ this._urlBreakpoints = []; > this._allRequestsBreakpointEnabledSetting = new WI.Setting("break-on-all-requests", false); > >- this._allRequestsBreakpoint = new WI.XHRBreakpoint(null, null, !this._allRequestsBreakpointEnabledSetting.value); >+ this._allRequestsBreakpoint = new WI.URLBreakpoint(null, null, !this._allRequestsBreakpointEnabledSetting.value); > > WI.DOMBreakpoint.addEventListener(WI.DOMBreakpoint.Event.DisabledStateDidChange, this._domBreakpointDisabledStateDidChange, this); > WI.EventBreakpoint.addEventListener(WI.EventBreakpoint.Event.DisabledStateDidChange, this._eventBreakpointDisabledStateDidChange, this); >- WI.XHRBreakpoint.addEventListener(WI.XHRBreakpoint.Event.DisabledStateDidChange, this._xhrBreakpointDisabledStateDidChange, this); >+ WI.URLBreakpoint.addEventListener(WI.URLBreakpoint.Event.DisabledStateDidChange, this._urlBreakpointDisabledStateDidChange, this); > > WI.domManager.addEventListener(WI.DOMManager.Event.NodeRemoved, this._nodeRemoved, this); > WI.domManager.addEventListener(WI.DOMManager.Event.NodeInserted, this._nodeInserted, this); >@@ -65,16 +65,16 @@ WI.DOMDebuggerManager = class DOMDebuggerManager extends WI.Object > for (let payload of this._eventBreakpointSetting.value) > this.addEventBreakpoint(WI.EventBreakpoint.fromPayload(payload)); > >- for (let cookie of this._xhrBreakpointsSetting.value) { >- let breakpoint = new WI.XHRBreakpoint(cookie.type, cookie.url, cookie.disabled); >- this.addXHRBreakpoint(breakpoint); >+ for (let cookie of this._urlBreakpointsSetting.value) { >+ let breakpoint = new WI.URLBreakpoint(cookie.type, cookie.url, cookie.disabled); >+ this.addURLBreakpoint(breakpoint); > } > > this._restoringBreakpoints = false; > this._speculativelyResolveBreakpoints(); > > if (!this._allRequestsBreakpoint.disabled) >- this._updateXHRBreakpoint(this._allRequestsBreakpoint); >+ this._updateURLBreakpoint(this._allRequestsBreakpoint); > } > } > >@@ -85,6 +85,11 @@ WI.DOMDebuggerManager = class DOMDebuggerManager extends WI.Object > return DOMDebuggerAgent.setEventBreakpoint && DOMDebuggerAgent.removeEventBreakpoint; > } > >+ static supportsURLBreakpoints() >+ { >+ return InspectorBackend.domains.DOMDebugger.setURLBreakpoint && InspectorBackend.domains.DOMDebugger.removeURLBreakpoint; >+ } >+ > // Public > > get supported() >@@ -118,7 +123,7 @@ WI.DOMDebuggerManager = class DOMDebuggerManager extends WI.Object > > get eventBreakpoints() { return this._eventBreakpoints; } > >- get xhrBreakpoints() { return this._xhrBreakpoints; } >+ get urlBreakpoints() { return this._urlBreakpoints; } > > isBreakpointSpecial(breakpoint) > { >@@ -276,64 +281,72 @@ WI.DOMDebuggerManager = class DOMDebuggerManager extends WI.Object > DOMDebuggerAgent.removeEventBreakpoint(breakpoint.type, breakpoint.eventName, breakpointRemoved); > } > >- xhrBreakpointForURL(url) >+ urlBreakpointForURL(url) > { >- return this._xhrBreakpoints.find((breakpoint) => breakpoint.url === url) || null; >+ return this._urlBreakpoints.find((breakpoint) => breakpoint.url === url) || null; > } > >- addXHRBreakpoint(breakpoint) >+ addURLBreakpoint(breakpoint) > { >- console.assert(breakpoint instanceof WI.XHRBreakpoint); >+ console.assert(breakpoint instanceof WI.URLBreakpoint); > if (!breakpoint) > return; > > if (this.isBreakpointSpecial(breakpoint)) { >- this.dispatchEventToListeners(WI.DOMDebuggerManager.Event.XHRBreakpointAdded, {breakpoint}); >+ this.dispatchEventToListeners(WI.DOMDebuggerManager.Event.URLBreakpointAdded, {breakpoint}); > return; > } > >- console.assert(!this._xhrBreakpoints.includes(breakpoint), "Already added XHR breakpoint.", breakpoint); >- if (this._xhrBreakpoints.includes(breakpoint)) >+ console.assert(!this._urlBreakpoints.includes(breakpoint), "Already added URL breakpoint.", breakpoint); >+ if (this._urlBreakpoints.includes(breakpoint)) > return; > >- if (this._xhrBreakpoints.some((entry) => entry.type === breakpoint.type && entry.url === breakpoint.url)) >+ if (this._urlBreakpoints.some((entry) => entry.type === breakpoint.type && entry.url === breakpoint.url)) > return; > >- this._xhrBreakpoints.push(breakpoint); >+ this._urlBreakpoints.push(breakpoint); > >- this.dispatchEventToListeners(WI.DOMDebuggerManager.Event.XHRBreakpointAdded, {breakpoint}); >+ this.dispatchEventToListeners(WI.DOMDebuggerManager.Event.URLBreakpointAdded, {breakpoint}); > >- this._resolveXHRBreakpoint(breakpoint); >- this._saveXHRBreakpoints(); >+ this._resolveURLBreakpoint(breakpoint); >+ this._saveURLBreakpoints(); > } > >- removeXHRBreakpoint(breakpoint) >+ removeURLBreakpoint(breakpoint) > { >- console.assert(breakpoint instanceof WI.XHRBreakpoint); >+ console.assert(breakpoint instanceof WI.URLBreakpoint); > if (!breakpoint) > return; > > if (this.isBreakpointSpecial(breakpoint)) { > breakpoint.disabled = true; >- this.dispatchEventToListeners(WI.DOMDebuggerManager.Event.XHRBreakpointRemoved, {breakpoint}); >+ this.dispatchEventToListeners(WI.DOMDebuggerManager.Event.URLBreakpointRemoved, {breakpoint}); > return; > } > >- if (!this._xhrBreakpoints.includes(breakpoint)) >+ if (!this._urlBreakpoints.includes(breakpoint)) > return; > >- this._xhrBreakpoints.remove(breakpoint, true); >+ this._urlBreakpoints.remove(breakpoint, true); > >- this._saveXHRBreakpoints(); >- this.dispatchEventToListeners(WI.DOMDebuggerManager.Event.XHRBreakpointRemoved, {breakpoint}); >+ this._saveURLBreakpoints(); >+ this.dispatchEventToListeners(WI.DOMDebuggerManager.Event.URLBreakpointRemoved, {breakpoint}); > > if (breakpoint.disabled) > return; > >- DOMDebuggerAgent.removeXHRBreakpoint(breakpoint.url, (error) => { >- if (error) >- console.error(error); >- }); >+ // Compatibility (iOS 12.1): DOMDebuggerAgent.removeURLBreakpoint did not exist. >+ if (WI.DOMDebuggerManager.supportsURLBreakpoints()) { >+ DOMDebuggerAgent.removeURLBreakpoint(breakpoint.url, (error) => { >+ if (error) >+ console.error(error); >+ }); >+ } else { >+ DOMDebuggerAgent.removeXHRBreakpoint(breakpoint.url, (error) => { >+ if (error) >+ console.error(error); >+ }); >+ } > } > > // Private >@@ -406,8 +419,8 @@ WI.DOMDebuggerManager = class DOMDebuggerManager extends WI.Object > for (let breakpoint of this._eventBreakpoints) > this._resolveEventBreakpoint(breakpoint); > >- for (let breakpoint of this._xhrBreakpoints) >- this._resolveXHRBreakpoint(breakpoint); >+ for (let breakpoint of this._urlBreakpoints) >+ this._resolveURLBreakpoint(breakpoint); > } > > _resolveDOMBreakpoint(breakpoint, nodeIdentifier) >@@ -480,7 +493,7 @@ WI.DOMDebuggerManager = class DOMDebuggerManager extends WI.Object > DOMDebuggerAgent.setEventBreakpoint(breakpoint.type, breakpoint.eventName, breakpointUpdated); > } > >- _updateXHRBreakpoint(breakpoint, callback) >+ _updateURLBreakpoint(breakpoint, callback) > { > function breakpointUpdated(error) > { >@@ -491,11 +504,23 @@ WI.DOMDebuggerManager = class DOMDebuggerManager extends WI.Object > callback(error); > } > >+ // Compatibility (iOS 12.1): DOMDebuggerAgent.removeURLBreakpoint did not exist. >+ if (!WI.DOMDebuggerManager.supportsURLBreakpoints()) { >+ if (breakpoint.disabled) >+ DOMDebuggerAgent.removeXHRBreakpoint(breakpoint.url, breakpointUpdated); >+ else { >+ let isRegex = breakpoint.type === WI.URLBreakpoint.Type.RegularExpression; >+ DebuggerAgent.setXHRBreakpoint(breakpoint.url, isRegex, breakpointUpdated); >+ } >+ return; >+ } >+ >+ > if (breakpoint.disabled) >- DOMDebuggerAgent.removeXHRBreakpoint(breakpoint.url, breakpointUpdated); >+ DOMDebuggerAgent.removeURLBreakpoint(breakpoint.url, breakpointUpdated); > else { >- let isRegex = breakpoint.type === WI.XHRBreakpoint.Type.RegularExpression; >- DOMDebuggerAgent.setXHRBreakpoint(breakpoint.url, isRegex, breakpointUpdated); >+ let isRegex = breakpoint.type === WI.URLBreakpoint.Type.RegularExpression; >+ DOMDebuggerAgent.setURLBreakpoint(breakpoint.url, isRegex, breakpointUpdated); > } > } > >@@ -509,13 +534,13 @@ WI.DOMDebuggerManager = class DOMDebuggerManager extends WI.Object > }); > } > >- _resolveXHRBreakpoint(breakpoint) >+ _resolveURLBreakpoint(breakpoint) > { > if (breakpoint.disabled) > return; > >- this._updateXHRBreakpoint(breakpoint, () => { >- breakpoint.dispatchEventToListeners(WI.XHRBreakpoint.Event.ResolvedStateDidChange); >+ this._updateURLBreakpoint(breakpoint, () => { >+ breakpoint.dispatchEventToListeners(WI.URLBreakpoint.Event.ResolvedStateDidChange); > }); > } > >@@ -539,12 +564,12 @@ WI.DOMDebuggerManager = class DOMDebuggerManager extends WI.Object > this._eventBreakpointSetting.value = this._eventBreakpoints.map((breakpoint) => breakpoint.serializableInfo); > } > >- _saveXHRBreakpoints() >+ _saveURLBreakpoints() > { > if (this._restoringBreakpoints) > return; > >- this._xhrBreakpointsSetting.value = this._xhrBreakpoints.map((breakpoint) => breakpoint.serializableInfo); >+ this._urlBreakpointsSetting.value = this._urlBreakpoints.map((breakpoint) => breakpoint.serializableInfo); > } > > _domBreakpointDisabledStateDidChange(event) >@@ -561,15 +586,15 @@ WI.DOMDebuggerManager = class DOMDebuggerManager extends WI.Object > this._saveEventBreakpoints(); > } > >- _xhrBreakpointDisabledStateDidChange(event) >+ _urlBreakpointDisabledStateDidChange(event) > { > let breakpoint = event.target; > > if (breakpoint === this._allRequestsBreakpoint) > this._allRequestsBreakpointEnabledSetting.value = !breakpoint.disabled; > >- this._updateXHRBreakpoint(breakpoint); >- this._saveXHRBreakpoints(); >+ this._updateURLBreakpoint(breakpoint); >+ this._saveURLBreakpoints(); > } > > _childFrameWasRemoved(event) >@@ -648,6 +673,6 @@ WI.DOMDebuggerManager.Event = { > DOMBreakpointRemoved: "dom-debugger-manager-dom-breakpoint-removed", > EventBreakpointAdded: "dom-debugger-manager-event-breakpoint-added", > EventBreakpointRemoved: "dom-debugger-manager-event-breakpoint-removed", >- XHRBreakpointAdded: "dom-debugger-manager-xhr-breakpoint-added", >- XHRBreakpointRemoved: "dom-debugger-manager-xhr-breakpoint-removed", >+ URLBreakpointAdded: "dom-debugger-manager-url-breakpoint-added", >+ URLBreakpointRemoved: "dom-debugger-manager-url-breakpoint-removed", > }; >diff --git a/Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js b/Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js >index 8562816b1d9718883dac32d85b492132f1c18a68..93ffed7904a0f1044d603ef6cd4937aefd937d9e 100644 >--- a/Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js >+++ b/Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js >@@ -858,6 +858,8 @@ WI.DebuggerManager = class DebuggerManager extends WI.Object > return WI.DebuggerManager.PauseReason.EventListener; > case DebuggerAgent.PausedReason.Exception: > return WI.DebuggerManager.PauseReason.Exception; >+ case DebuggerAgent.PausedReason.Fetch: >+ return WI.DebuggerManager.PauseReason.Fetch; > case DebuggerAgent.PausedReason.PauseOnNextStatement: > return WI.DebuggerManager.PauseReason.PauseOnNextStatement; > case DebuggerAgent.PausedReason.Timer: >@@ -1389,6 +1391,7 @@ WI.DebuggerManager.PauseReason = { > DOM: "DOM", > EventListener: "event-listener", > Exception: "exception", >+ Fetch: "fetch", > PauseOnNextStatement: "pause-on-next-statement", > Timer: "timer", > XHR: "xhr", >diff --git a/Source/WebInspectorUI/UserInterface/Main.html b/Source/WebInspectorUI/UserInterface/Main.html >index b1a2fc7e1358e06236feeed99bf0d1f3f8fb36d5..c55125bc184bec1cb9f3464aaaedbfbbdb3fab84 100644 >--- a/Source/WebInspectorUI/UserInterface/Main.html >+++ b/Source/WebInspectorUI/UserInterface/Main.html >@@ -224,10 +224,10 @@ > <link rel="stylesheet" href="Views/TypeTokenView.css"> > <link rel="stylesheet" href="Views/TypeTreeElement.css"> > <link rel="stylesheet" href="Views/TypeTreeView.css"> >+ <link rel="stylesheet" href="Views/URLBreakpointPopover.css"> >+ <link rel="stylesheet" href="Views/URLBreakpointTreeElement.css"> > <link rel="stylesheet" href="Views/Variables.css"> > <link rel="stylesheet" href="Views/WebSocketContentView.css"> >- <link rel="stylesheet" href="Views/XHRBreakpointPopover.css"> >- <link rel="stylesheet" href="Views/XHRBreakpointTreeElement.css"> > > <link rel="stylesheet" href="Controllers/CodeMirrorCompletionController.css"> > <link rel="stylesheet" href="Controllers/CodeMirrorDragToAdjustNumberController.css"> >@@ -453,9 +453,9 @@ > <script src="Models/TimelineRecording.js"></script> > <script src="Models/TypeDescription.js"></script> > <script src="Models/TypeSet.js"></script> >+ <script src="Models/URLBreakpoint.js"></script> > <script src="Models/WebSocketResource.js"></script> > <script src="Models/WrappedPromise.js"></script> >- <script src="Models/XHRBreakpoint.js"></script> > > <script src="Models/AuditTestBase.js"></script> > <script src="Models/AuditTestCase.js"></script> >@@ -807,12 +807,12 @@ > <script src="Views/TypeTokenView.js"></script> > <script src="Views/TypeTreeElement.js"></script> > <script src="Views/TypeTreeView.js"></script> >+ <script src="Views/URLBreakpointPopover.js"></script> >+ <script src="Views/URLBreakpointTreeElement.js"></script> > <script src="Views/WebSocketContentView.js"></script> > <script src="Views/WebSocketDataGridNode.js"></script> > <script src="Views/WebSocketResourceTreeElement.js"></script> > <script src="Views/WorkerTreeElement.js"></script> >- <script src="Views/XHRBreakpointPopover.js"></script> >- <script src="Views/XHRBreakpointTreeElement.js"></script> > > <script src="Controllers/Annotator.js"></script> > <script src="Controllers/CodeMirrorEditingController.js"></script> >diff --git a/Source/WebInspectorUI/UserInterface/Models/URLBreakpoint.js b/Source/WebInspectorUI/UserInterface/Models/URLBreakpoint.js >new file mode 100644 >index 0000000000000000000000000000000000000000..ed433d48ce496d0fc482d9b543618aaf97b8faf9 >--- /dev/null >+++ b/Source/WebInspectorUI/UserInterface/Models/URLBreakpoint.js >@@ -0,0 +1,80 @@ >+/* >+ * Copyright (C) 2017 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. >+ */ >+ >+WI.URLBreakpoint = class URLBreakpoint extends WI.Object >+{ >+ constructor(type, url, disabled) >+ { >+ super(); >+ >+ this._type = type || WI.URLBreakpoint.Type.Text; >+ this._url = url || ""; >+ this._disabled = disabled || false; >+ } >+ >+ // Public >+ >+ get type() { return this._type; } >+ get url() { return this._url; } >+ >+ get disabled() >+ { >+ return this._disabled; >+ } >+ >+ set disabled(disabled) >+ { >+ if (this._disabled === disabled) >+ return; >+ >+ this._disabled = disabled; >+ >+ this.dispatchEventToListeners(WI.URLBreakpoint.Event.DisabledStateDidChange); >+ } >+ >+ get serializableInfo() >+ { >+ let info = {type: this._type, url: this._url}; >+ if (this._disabled) >+ info.disabled = true; >+ >+ return info; >+ } >+ >+ saveIdentityToCookie(cookie) >+ { >+ cookie["url-breakpoint-url"] = this._url; >+ } >+}; >+ >+WI.URLBreakpoint.Event = { >+ DisabledStateDidChange: "url-breakpoint-disabled-state-did-change", >+ ResolvedStateDidChange: "url-breakpoint-resolved-state-did-change", >+}; >+ >+WI.URLBreakpoint.Type = { >+ Text: "text", >+ RegularExpression: "regex", >+}; >diff --git a/Source/WebInspectorUI/UserInterface/Models/XHRBreakpoint.js b/Source/WebInspectorUI/UserInterface/Models/XHRBreakpoint.js >deleted file mode 100644 >index eb7ac4f02940ea4b2fd7a95d46a3aaca7790fb48..0000000000000000000000000000000000000000 >--- a/Source/WebInspectorUI/UserInterface/Models/XHRBreakpoint.js >+++ /dev/null >@@ -1,82 +0,0 @@ >-/* >- * Copyright (C) 2017 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. >- */ >- >-WI.XHRBreakpoint = class XHRBreakpoint extends WI.Object >-{ >- constructor(type, url, disabled) >- { >- super(); >- >- this._type = type || WI.XHRBreakpoint.Type.Text; >- this._url = url || ""; >- this._disabled = disabled || false; >- } >- >- // Public >- >- get type() { return this._type; } >- get url() { return this._url; } >- >- get disabled() >- { >- return this._disabled; >- } >- >- set disabled(disabled) >- { >- if (this._disabled === disabled) >- return; >- >- this._disabled = disabled; >- >- this.dispatchEventToListeners(WI.XHRBreakpoint.Event.DisabledStateDidChange); >- } >- >- get serializableInfo() >- { >- let info = {type: this._type, url: this._url}; >- if (this._disabled) >- info.disabled = true; >- >- return info; >- } >- >- saveIdentityToCookie(cookie) >- { >- cookie[WI.XHRBreakpoint.URLCookieKey] = this._url; >- } >-}; >- >-WI.XHRBreakpoint.URLCookieKey = "xhr-breakpoint-url"; >- >-WI.XHRBreakpoint.Event = { >- DisabledStateDidChange: "xhr-breakpoint-disabled-state-did-change", >- ResolvedStateDidChange: "xhr-breakpoint-resolved-state-did-change", >-}; >- >-WI.XHRBreakpoint.Type = { >- Text: "text", >- RegularExpression: "regex", >-}; >diff --git a/Source/WebInspectorUI/UserInterface/Test.html b/Source/WebInspectorUI/UserInterface/Test.html >index ef8326aadade0bfa190d1b7d31e4d122a4329824..ee4282b671300a4d6acfabee2439192e8309eba2 100644 >--- a/Source/WebInspectorUI/UserInterface/Test.html >+++ b/Source/WebInspectorUI/UserInterface/Test.html >@@ -204,9 +204,9 @@ > <script src="Models/TextRange.js"></script> > <script src="Models/TimelineMarker.js"></script> > <script src="Models/TimelineRecording.js"></script> >+ <script src="Models/URLBreakpoint.js"></script> > <script src="Models/WebSocketResource.js"></script> > <script src="Models/WrappedPromise.js"></script> >- <script src="Models/XHRBreakpoint.js"></script> > > <script src="Models/AuditTestBase.js"></script> > <script src="Models/AuditTestCase.js"></script> >diff --git a/Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js b/Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js >index e7b3db92dd2b839406c7870a7531580caede3a17..098cff956aa27cc24a571f670e27913982e55a17 100644 >--- a/Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js >+++ b/Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js >@@ -36,12 +36,12 @@ WI.DebuggerSidebarPanel = class DebuggerSidebarPanel extends WI.NavigationSideba > WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.BreakpointAdded, this._breakpointAdded, this); > WI.domDebuggerManager.addEventListener(WI.DOMDebuggerManager.Event.DOMBreakpointAdded, this._breakpointAdded, this); > WI.domDebuggerManager.addEventListener(WI.DOMDebuggerManager.Event.EventBreakpointAdded, this._breakpointAdded, this); >- WI.domDebuggerManager.addEventListener(WI.DOMDebuggerManager.Event.XHRBreakpointAdded, this._breakpointAdded, this); >+ WI.domDebuggerManager.addEventListener(WI.DOMDebuggerManager.Event.URLBreakpointAdded, this._breakpointAdded, this); > > WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.BreakpointRemoved, this._breakpointRemoved, this); > WI.domDebuggerManager.addEventListener(WI.DOMDebuggerManager.Event.DOMBreakpointRemoved, this._breakpointRemoved, this); > WI.domDebuggerManager.addEventListener(WI.DOMDebuggerManager.Event.EventBreakpointRemoved, this._breakpointRemoved, this); >- WI.domDebuggerManager.addEventListener(WI.DOMDebuggerManager.Event.XHRBreakpointRemoved, this._breakpointRemoved, this); >+ WI.domDebuggerManager.addEventListener(WI.DOMDebuggerManager.Event.URLBreakpointRemoved, this._breakpointRemoved, this); > > WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.BreakpointsEnabledDidChange, this._breakpointsEnabledDidChange, this); > WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.ScriptAdded, this._scriptAdded, this); >@@ -233,7 +233,7 @@ WI.DebuggerSidebarPanel = class DebuggerSidebarPanel extends WI.NavigationSideba > > if (WI.domDebuggerManager.supported) { > if (WI.settings.showAllRequestsBreakpoint.value) >- WI.domDebuggerManager.addXHRBreakpoint(WI.domDebuggerManager.allRequestsBreakpoint); >+ WI.domDebuggerManager.addURLBreakpoint(WI.domDebuggerManager.allRequestsBreakpoint); > > for (let eventBreakpoint of WI.domDebuggerManager.eventBreakpoints) > this._addBreakpoint(eventBreakpoint); >@@ -244,8 +244,8 @@ WI.DebuggerSidebarPanel = class DebuggerSidebarPanel extends WI.NavigationSideba > for (let eventListenerBreakpoint of WI.domManager.eventListenerBreakpoints) > this._addBreakpoint(eventListenerBreakpoint); > >- for (let xhrBreakpoints of WI.domDebuggerManager.xhrBreakpoints) >- this._addBreakpoint(xhrBreakpoints); >+ for (let urlBreakpoints of WI.domDebuggerManager.urlBreakpoints) >+ this._addBreakpoint(urlBreakpoints); > } > > if (WI.debuggerManager.paused) >@@ -402,8 +402,8 @@ WI.DebuggerSidebarPanel = class DebuggerSidebarPanel extends WI.NavigationSideba > > if (breakpoint instanceof WI.EventBreakpoint) > WI.domDebuggerManager.addEventBreakpoint(breakpoint); >- else if (breakpoint instanceof WI.XHRBreakpoint) >- WI.domDebuggerManager.addXHRBreakpoint(breakpoint); >+ else if (breakpoint instanceof WI.URLBreakpoint) >+ WI.domDebuggerManager.addURLBreakpoint(breakpoint); > } > > // Private >@@ -492,8 +492,8 @@ WI.DebuggerSidebarPanel = class DebuggerSidebarPanel extends WI.NavigationSideba > > if (breakpoint.eventListener) > parentTreeElement = getDOMNodeTreeElement(breakpoint.eventListener.node); >- } else if (breakpoint instanceof WI.XHRBreakpoint) { >- constructor = WI.XHRBreakpointTreeElement; >+ } else if (breakpoint instanceof WI.URLBreakpoint) { >+ constructor = WI.URLBreakpointTreeElement; > > if (breakpoint === WI.domDebuggerManager.allRequestsBreakpoint) { > options.className = WI.DebuggerSidebarPanel.AssertionIconStyleClassName; >@@ -948,7 +948,7 @@ WI.DebuggerSidebarPanel = class DebuggerSidebarPanel extends WI.NavigationSideba > if (treeElement instanceof WI.DOMNodeTreeElement > || treeElement instanceof WI.DOMBreakpointTreeElement > || treeElement instanceof WI.EventBreakpointTreeElement >- || treeElement instanceof WI.XHRBreakpointTreeElement) >+ || treeElement instanceof WI.URLBreakpointTreeElement) > return; > > const options = { >@@ -1011,7 +1011,7 @@ WI.DebuggerSidebarPanel = class DebuggerSidebarPanel extends WI.NavigationSideba > (treeElement) => treeElement instanceof WI.EventBreakpointTreeElement, > (treeElement) => treeElement instanceof WI.DOMNodeTreeElement, > (treeElement) => treeElement instanceof WI.DOMBreakpointTreeElement, >- (treeElement) => treeElement instanceof WI.XHRBreakpointTreeElement, >+ (treeElement) => treeElement instanceof WI.URLBreakpointTreeElement, > ]; > > let aRank = rankFunctions.findIndex((rankFunction) => rankFunction(a)); >@@ -1279,26 +1279,27 @@ WI.DebuggerSidebarPanel = class DebuggerSidebarPanel extends WI.NavigationSideba > this._pauseReasonGroup.rows = [eventBreakpointRow]; > return true; > >+ case WI.DebuggerManager.PauseReason.Fetch: > case WI.DebuggerManager.PauseReason.XHR: > console.assert(WI.domDebuggerManager.supported); >- console.assert(pauseData, "Expected XHR breakpoint data, but found none."); >+ console.assert(pauseData, "Expected URL breakpoint data, but found none."); > if (pauseData) { > if (pauseData.breakpointURL) { >- let xhrBreakpoint = WI.domDebuggerManager.xhrBreakpointForURL(pauseData.breakpointURL); >- console.assert(xhrBreakpoint, "Expected XHR breakpoint for URL.", pauseData.breakpointURL); >+ let urlBreakpoint = WI.domDebuggerManager.urlBreakpointForURL(pauseData.breakpointURL); >+ console.assert(urlBreakpoint, "Expected URL breakpoint for URL.", pauseData.breakpointURL); > > this._pauseReasonTreeOutline = this.createContentTreeOutline(true); > >- let xhrBreakpointTreeElement = new WI.XHRBreakpointTreeElement(xhrBreakpoint, { >+ let urlBreakpointTreeElement = new WI.URLBreakpointTreeElement(urlBreakpoint, { > className: WI.DebuggerSidebarPanel.PausedBreakpointIconStyleClassName, >- title: WI.UIString("Triggered XHR Breakpoint"), >+ title: WI.DOMDebuggerManager.supportsURLBreakpoints() ? WI.UIString("Triggered URL Breakpoint") : WI.UIString("Triggered XHR Breakpoint"), > }); >- let xhrBreakpointRow = new WI.DetailsSectionRow; >- this._pauseReasonTreeOutline.appendChild(xhrBreakpointTreeElement); >- xhrBreakpointRow.element.appendChild(this._pauseReasonTreeOutline.element); >+ let urlBreakpointRow = new WI.DetailsSectionRow; >+ this._pauseReasonTreeOutline.appendChild(urlBreakpointTreeElement); >+ urlBreakpointRow.element.appendChild(this._pauseReasonTreeOutline.element); > > this._pauseReasonTextRow.text = pauseData.url; >- this._pauseReasonGroup.rows = [xhrBreakpointRow, this._pauseReasonTextRow]; >+ this._pauseReasonGroup.rows = [urlBreakpointRow, this._pauseReasonTextRow]; > } else { > console.assert(pauseData.breakpointURL === "", "Should be the All Requests breakpoint which has an empty URL"); > this._pauseReasonTextRow.text = WI.UIString("Requesting: %s").format(pauseData.url); >@@ -1448,15 +1449,15 @@ WI.DebuggerSidebarPanel = class DebuggerSidebarPanel extends WI.NavigationSideba > > contextMenu.appendCheckboxItem(WI.UIString("All Requests"), () => { > if (allRequestsBreakpointShown) >- WI.domDebuggerManager.removeXHRBreakpoint(WI.domDebuggerManager.allRequestsBreakpoint); >+ WI.domDebuggerManager.removeURLBreakpoint(WI.domDebuggerManager.allRequestsBreakpoint); > else { > WI.domDebuggerManager.allRequestsBreakpoint.disabled = false; >- WI.domDebuggerManager.addXHRBreakpoint(WI.domDebuggerManager.allRequestsBreakpoint); >+ WI.domDebuggerManager.addURLBreakpoint(WI.domDebuggerManager.allRequestsBreakpoint); > } > }, allRequestsBreakpointShown); > >- contextMenu.appendItem(WI.UIString("XHR Breakpoint\u2026"), () => { >- let popover = new WI.XHRBreakpointPopover(this); >+ contextMenu.appendItem(WI.DOMDebuggerManager.supportsURLBreakpoints() ? WI.UIString("URL Breakpoint\u2026") : WI.UIString("XHR Breakpoint\u2026"), () => { >+ let popover = new WI.URLBreakpointPopover(this); > popover.show(event.target.element, [WI.RectEdge.MAX_Y, WI.RectEdge.MIN_Y, WI.RectEdge.MAX_X]); > }); > } >diff --git a/Source/WebInspectorUI/UserInterface/Views/NavigationSidebarPanel.js b/Source/WebInspectorUI/UserInterface/Views/NavigationSidebarPanel.js >index 477480bfc5cc48a97d48879cdf778da571394aae..c53df4ae3a637b445c7ba1c6003094f379f3204c 100644 >--- a/Source/WebInspectorUI/UserInterface/Views/NavigationSidebarPanel.js >+++ b/Source/WebInspectorUI/UserInterface/Views/NavigationSidebarPanel.js >@@ -646,7 +646,7 @@ WI.NavigationSidebarPanel = class NavigationSidebarPanel extends WI.SidebarPanel > || treeElement instanceof WI.IdleTreeElement > || treeElement instanceof WI.DOMBreakpointTreeElement > || treeElement instanceof WI.EventBreakpointTreeElement >- || treeElement instanceof WI.XHRBreakpointTreeElement >+ || treeElement instanceof WI.URLBreakpointTreeElement > || treeElement instanceof WI.CSSStyleSheetTreeElement > || typeof treeElement.representedObject === "string" > || treeElement.representedObject instanceof String; >diff --git a/Source/WebInspectorUI/UserInterface/Views/URLBreakpointPopover.css b/Source/WebInspectorUI/UserInterface/Views/URLBreakpointPopover.css >new file mode 100644 >index 0000000000000000000000000000000000000000..a51220cf08fb74640ecd083d3d7087decd876ff6 >--- /dev/null >+++ b/Source/WebInspectorUI/UserInterface/Views/URLBreakpointPopover.css >@@ -0,0 +1,70 @@ >+/* >+ * Copyright (C) 2017 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. >+ */ >+ >+.popover .url-breakpoint-content { >+ padding: 5px; >+ margin: 2px; >+} >+ >+.popover .url-breakpoint-content > .editor-wrapper { >+ margin-top: 4px; >+ display: flex; >+ flex-direction: row; >+} >+ >+.popover .url-breakpoint-content > .editor-wrapper > .editor { >+ width: 180px; >+ padding: 4px 0 2px 0; >+ -webkit-appearance: textfield; >+ border: 1px solid hsl(0, 0%, 78%); >+ background: var(--background-color-code); >+ >+ --editor-margin-start: 4px; >+} >+ >+body[dir=ltr] .popover .url-breakpoint-content > .editor-wrapper > .editor { >+ margin-left: var(--editor-margin-start); >+} >+ >+body[dir=rtl] .popover .url-breakpoint-content > .editor-wrapper > .editor { >+ margin-right: var(--editor-margin-start); >+} >+ >+.popover .url-breakpoint-content > .editor-wrapper > .editor > .CodeMirror { >+ width: calc(100% - 2px); >+ height: auto; >+} >+ >+.popover .url-breakpoint-content > .editor-wrapper > .editor > .CodeMirror-scroll { >+ width: calc(100% - 2px); >+ overflow: hidden; >+} >+ >+@media (prefers-dark-interface) { >+ .popover .url-breakpoint-content > .editor-wrapper > .editor { >+ -webkit-appearance: unset; >+ border-color: var(--text-color-quaternary); >+ } >+} >diff --git a/Source/WebInspectorUI/UserInterface/Views/URLBreakpointPopover.js b/Source/WebInspectorUI/UserInterface/Views/URLBreakpointPopover.js >new file mode 100644 >index 0000000000000000000000000000000000000000..9a2143ed1824e17ab690a09c8bbda10d03ed9a9b >--- /dev/null >+++ b/Source/WebInspectorUI/UserInterface/Views/URLBreakpointPopover.js >@@ -0,0 +1,154 @@ >+/* >+ * Copyright (C) 2017 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. >+ */ >+ >+WI.URLBreakpointPopover = class URLBreakpointPopover extends WI.Popover >+{ >+ constructor(delegate) >+ { >+ super(delegate); >+ >+ this._breakpoint = null; >+ >+ this._codeMirror = null; >+ this._targetElement = null; >+ this._preferredEdges = null; >+ >+ this.windowResizeHandler = this._presentOverTargetElement.bind(this); >+ } >+ >+ // Public >+ >+ get breakpoint() { return this._breakpoint; } >+ >+ show(targetElement, preferredEdges) >+ { >+ this._targetElement = targetElement; >+ this._preferredEdges = preferredEdges; >+ >+ let contentElement = document.createElement("div"); >+ contentElement.classList.add("url-breakpoint-content"); >+ >+ let label = document.createElement("div"); >+ label.classList.add("label"); >+ label.textContent = WI.UIString("Break on request with URL:"); >+ >+ let editorWrapper = document.createElement("div"); >+ editorWrapper.classList.add("editor-wrapper"); >+ >+ this._typeSelectElement = document.createElement("select"); >+ >+ let createOption = (text, value) => { >+ let optionElement = this._typeSelectElement.appendChild(document.createElement("option")); >+ optionElement.textContent = text; >+ optionElement.value = value; >+ }; >+ >+ createOption(WI.UIString("Containing"), WI.URLBreakpoint.Type.Text); >+ createOption(WI.UIString("Matching"), WI.URLBreakpoint.Type.RegularExpression); >+ >+ this._typeSelectElement.value = WI.URLBreakpoint.Type.Text; >+ this._typeSelectElement.addEventListener("change", (event) => { >+ this._updateEditor(); >+ this._codeMirror.focus(); >+ }); >+ >+ editorWrapper.append(this._typeSelectElement, this._createEditor()); >+ contentElement.append(label, editorWrapper); >+ >+ this.content = contentElement; >+ >+ this._presentOverTargetElement(); >+ } >+ >+ dismiss() >+ { >+ let type = this._typeSelectElement.value; >+ let url = this._codeMirror.getValue(); >+ if (type && url) >+ this._breakpoint = new WI.URLBreakpoint(type, url); >+ >+ super.dismiss(); >+ } >+ >+ // Private >+ >+ _createEditor() >+ { >+ let editorElement = document.createElement("div"); >+ editorElement.classList.add("editor"); >+ >+ this._codeMirror = WI.CodeMirrorEditor.create(editorElement, { >+ lineWrapping: false, >+ matchBrackets: false, >+ scrollbarStyle: null, >+ value: "", >+ }); >+ >+ this._codeMirror.addKeyMap({ >+ "Enter": () => { >+ this.dismiss(); >+ }, >+ "Esc": () => { >+ this.dismiss(); >+ }, >+ }); >+ >+ this._updateEditor(); >+ >+ return editorElement; >+ } >+ >+ _updateEditor() >+ { >+ let placeholder; >+ let mimeType; >+ if (this._typeSelectElement.value === WI.URLBreakpoint.Type.Text) { >+ placeholder = WI.UIString("Text"); >+ mimeType = "text/plain"; >+ } else { >+ placeholder = WI.UIString("Regular Expression"); >+ mimeType = "text/x-regex"; >+ } >+ >+ this._codeMirror.setOption("mode", mimeType); >+ this._codeMirror.setOption("placeholder", placeholder); >+ } >+ >+ _presentOverTargetElement() >+ { >+ if (!this._targetElement) >+ return; >+ >+ let targetFrame = WI.Rect.rectFromClientRect(this._targetElement.getBoundingClientRect()); >+ this.present(targetFrame, this._preferredEdges); >+ >+ // CodeMirror needs a refresh after the popover displays, to layout, otherwise it doesn't appear. >+ setTimeout(() => { >+ this._codeMirror.refresh(); >+ this._codeMirror.focus(); >+ this.update(); >+ }, 0); >+ } >+}; >diff --git a/Source/WebInspectorUI/UserInterface/Views/URLBreakpointTreeElement.css b/Source/WebInspectorUI/UserInterface/Views/URLBreakpointTreeElement.css >new file mode 100644 >index 0000000000000000000000000000000000000000..145d9ae602eaedb7d0cd98f216228772ac60103f >--- /dev/null >+++ b/Source/WebInspectorUI/UserInterface/Views/URLBreakpointTreeElement.css >@@ -0,0 +1,28 @@ >+/* >+ * Copyright (C) 2018 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. >+ */ >+ >+.breakpoint.url .subtitle { >+ font-family: Menlo, monospace; >+} >diff --git a/Source/WebInspectorUI/UserInterface/Views/URLBreakpointTreeElement.js b/Source/WebInspectorUI/UserInterface/Views/URLBreakpointTreeElement.js >new file mode 100644 >index 0000000000000000000000000000000000000000..6fcd43ca9709344fdea12ccec503592c95f8d72b >--- /dev/null >+++ b/Source/WebInspectorUI/UserInterface/Views/URLBreakpointTreeElement.js >@@ -0,0 +1,148 @@ >+/* >+ * Copyright (C) 2017 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. >+ */ >+ >+WI.URLBreakpointTreeElement = class URLBreakpointTreeElement extends WI.GeneralTreeElement >+{ >+ constructor(breakpoint, {className, title} = {}) >+ { >+ console.assert(breakpoint instanceof WI.URLBreakpoint); >+ >+ if (!className) >+ className = WI.BreakpointTreeElement.GenericLineIconStyleClassName; >+ >+ let subtitle; >+ if (!title) { >+ title = WI.UIString("URL"); >+ if (breakpoint.type === WI.URLBreakpoint.Type.Text) >+ subtitle = doubleQuotedString(breakpoint.url); >+ else >+ subtitle = "/" + breakpoint.url + "/"; >+ } >+ >+ super(["breakpoint", "url", className], title, subtitle, breakpoint); >+ >+ this.status = document.createElement("img"); >+ this.status.classList.add("status-image", "resolved"); >+ >+ this.tooltipHandledSeparately = true; >+ >+ breakpoint.addEventListener(WI.URLBreakpoint.Event.DisabledStateDidChange, this._updateStatus, this); >+ >+ this._updateStatus(); >+ } >+ >+ // Protected >+ >+ onattach() >+ { >+ super.onattach(); >+ >+ this._boundStatusImageElementClicked = this._statusImageElementClicked.bind(this); >+ this._boundStatusImageElementFocused = this._statusImageElementFocused.bind(this); >+ this._boundStatusImageElementMouseDown = this._statusImageElementMouseDown.bind(this); >+ >+ this.status.addEventListener("click", this._boundStatusImageElementClicked); >+ this.status.addEventListener("focus", this._boundStatusImageElementFocused); >+ this.status.addEventListener("mousedown", this._boundStatusImageElementMouseDown); >+ } >+ >+ ondetach() >+ { >+ super.ondetach(); >+ >+ this.status.removeEventListener("click", this._boundStatusImageElementClicked); >+ this.status.removeEventListener("focus", this._boundStatusImageElementFocused); >+ this.status.removeEventListener("mousedown", this._boundStatusImageElementMouseDown); >+ >+ this._boundStatusImageElementClicked = null; >+ this._boundStatusImageElementFocused = null; >+ this._boundStatusImageElementMouseDown = null; >+ } >+ >+ ondelete() >+ { >+ // We set this flag so that TreeOutlines that will remove this >+ // BreakpointTreeElement will know whether it was deleted from >+ // within the TreeOutline or from outside it (e.g. TextEditor). >+ this.__deletedViaDeleteKeyboardShortcut = true; >+ >+ WI.domDebuggerManager.removeURLBreakpoint(this.representedObject); >+ return true; >+ } >+ >+ onenter() >+ { >+ this._toggleBreakpoint(); >+ return true; >+ } >+ >+ onspace() >+ { >+ this._toggleBreakpoint(); >+ return true; >+ } >+ >+ populateContextMenu(contextMenu, event) >+ { >+ let breakpoint = this.representedObject; >+ let label = breakpoint.disabled ? WI.UIString("Enable Breakpoint") : WI.UIString("Disable Breakpoint"); >+ contextMenu.appendItem(label, this._toggleBreakpoint.bind(this)); >+ >+ contextMenu.appendSeparator(); >+ >+ contextMenu.appendItem(WI.UIString("Delete Breakpoint"), () => { >+ WI.domDebuggerManager.removeURLBreakpoint(breakpoint); >+ }); >+ } >+ >+ // Private >+ >+ _statusImageElementClicked(event) >+ { >+ this._toggleBreakpoint(); >+ } >+ >+ _statusImageElementFocused(event) >+ { >+ // Prevent tree outline focus. >+ event.stopPropagation(); >+ } >+ >+ _statusImageElementMouseDown(event) >+ { >+ // Prevent tree element selection. >+ event.stopPropagation(); >+ } >+ >+ _toggleBreakpoint() >+ { >+ this.representedObject.disabled = !this.representedObject.disabled; >+ } >+ >+ _updateStatus() >+ { >+ this.status.classList.toggle("disabled", this.representedObject.disabled); >+ } >+}; >diff --git a/Source/WebInspectorUI/UserInterface/Views/XHRBreakpointPopover.css b/Source/WebInspectorUI/UserInterface/Views/XHRBreakpointPopover.css >deleted file mode 100644 >index df0299d0df8f874717f51badac3e67b9f52d35f4..0000000000000000000000000000000000000000 >--- a/Source/WebInspectorUI/UserInterface/Views/XHRBreakpointPopover.css >+++ /dev/null >@@ -1,70 +0,0 @@ >-/* >- * Copyright (C) 2017 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. >- */ >- >-.popover .xhr-breakpoint-content { >- padding: 5px; >- margin: 2px; >-} >- >-.popover .xhr-breakpoint-content > .editor-wrapper { >- margin-top: 4px; >- display: flex; >- flex-direction: row; >-} >- >-.popover .xhr-breakpoint-content > .editor-wrapper > .editor { >- width: 180px; >- padding: 4px 0 2px 0; >- -webkit-appearance: textfield; >- border: 1px solid hsl(0, 0%, 78%); >- background: var(--background-color-code); >- >- --editor-margin-start: 4px; >-} >- >-body[dir=ltr] .popover .xhr-breakpoint-content > .editor-wrapper > .editor { >- margin-left: var(--editor-margin-start); >-} >- >-body[dir=rtl] .popover .xhr-breakpoint-content > .editor-wrapper > .editor { >- margin-right: var(--editor-margin-start); >-} >- >-.popover .xhr-breakpoint-content > .editor-wrapper > .editor > .CodeMirror { >- width: calc(100% - 2px); >- height: auto; >-} >- >-.popover .xhr-breakpoint-content > .editor-wrapper > .editor > .CodeMirror-scroll { >- width: calc(100% - 2px); >- overflow: hidden; >-} >- >-@media (prefers-dark-interface) { >- .popover .xhr-breakpoint-content > .editor-wrapper > .editor { >- -webkit-appearance: unset; >- border-color: var(--text-color-quaternary); >- } >-} >diff --git a/Source/WebInspectorUI/UserInterface/Views/XHRBreakpointPopover.js b/Source/WebInspectorUI/UserInterface/Views/XHRBreakpointPopover.js >deleted file mode 100644 >index bbd0bc9ceac07ec10074a3fe49f1e7ba1353a1b1..0000000000000000000000000000000000000000 >--- a/Source/WebInspectorUI/UserInterface/Views/XHRBreakpointPopover.js >+++ /dev/null >@@ -1,154 +0,0 @@ >-/* >- * Copyright (C) 2017 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. >- */ >- >-WI.XHRBreakpointPopover = class XHRBreakpointPopover extends WI.Popover >-{ >- constructor(delegate) >- { >- super(delegate); >- >- this._breakpoint = null; >- >- this._codeMirror = null; >- this._targetElement = null; >- this._preferredEdges = null; >- >- this.windowResizeHandler = this._presentOverTargetElement.bind(this); >- } >- >- // Public >- >- get breakpoint() { return this._breakpoint; } >- >- show(targetElement, preferredEdges) >- { >- this._targetElement = targetElement; >- this._preferredEdges = preferredEdges; >- >- let contentElement = document.createElement("div"); >- contentElement.classList.add("xhr-breakpoint-content"); >- >- let label = document.createElement("div"); >- label.classList.add("label"); >- label.textContent = WI.UIString("Break on request with URL:"); >- >- let editorWrapper = document.createElement("div"); >- editorWrapper.classList.add("editor-wrapper"); >- >- this._typeSelectElement = document.createElement("select"); >- >- let createOption = (text, value) => { >- let optionElement = this._typeSelectElement.appendChild(document.createElement("option")); >- optionElement.textContent = text; >- optionElement.value = value; >- }; >- >- createOption(WI.UIString("Containing"), WI.XHRBreakpoint.Type.Text); >- createOption(WI.UIString("Matching"), WI.XHRBreakpoint.Type.RegularExpression); >- >- this._typeSelectElement.value = WI.XHRBreakpoint.Type.Text; >- this._typeSelectElement.addEventListener("change", (event) => { >- this._updateEditor(); >- this._codeMirror.focus(); >- }); >- >- editorWrapper.append(this._typeSelectElement, this._createEditor()); >- contentElement.append(label, editorWrapper); >- >- this.content = contentElement; >- >- this._presentOverTargetElement(); >- } >- >- dismiss() >- { >- let type = this._typeSelectElement.value; >- let url = this._codeMirror.getValue(); >- if (type && url) >- this._breakpoint = new WI.XHRBreakpoint(type, url); >- >- super.dismiss(); >- } >- >- // Private >- >- _createEditor() >- { >- let editorElement = document.createElement("div"); >- editorElement.classList.add("editor"); >- >- this._codeMirror = WI.CodeMirrorEditor.create(editorElement, { >- lineWrapping: false, >- matchBrackets: false, >- scrollbarStyle: null, >- value: "", >- }); >- >- this._codeMirror.addKeyMap({ >- "Enter": () => { >- this.dismiss(); >- }, >- "Esc": () => { >- this.dismiss(); >- }, >- }); >- >- this._updateEditor(); >- >- return editorElement; >- } >- >- _updateEditor() >- { >- let placeholder; >- let mimeType; >- if (this._typeSelectElement.value === WI.XHRBreakpoint.Type.Text) { >- placeholder = WI.UIString("Text"); >- mimeType = "text/plain"; >- } else { >- placeholder = WI.UIString("Regular Expression"); >- mimeType = "text/x-regex"; >- } >- >- this._codeMirror.setOption("mode", mimeType); >- this._codeMirror.setOption("placeholder", placeholder); >- } >- >- _presentOverTargetElement() >- { >- if (!this._targetElement) >- return; >- >- let targetFrame = WI.Rect.rectFromClientRect(this._targetElement.getBoundingClientRect()); >- this.present(targetFrame, this._preferredEdges); >- >- // CodeMirror needs a refresh after the popover displays, to layout, otherwise it doesn't appear. >- setTimeout(() => { >- this._codeMirror.refresh(); >- this._codeMirror.focus(); >- this.update(); >- }, 0); >- } >-}; >diff --git a/Source/WebInspectorUI/UserInterface/Views/XHRBreakpointTreeElement.css b/Source/WebInspectorUI/UserInterface/Views/XHRBreakpointTreeElement.css >deleted file mode 100644 >index 6eba5f2f2c0184ba5c07f737df102a0c65c628d9..0000000000000000000000000000000000000000 >--- a/Source/WebInspectorUI/UserInterface/Views/XHRBreakpointTreeElement.css >+++ /dev/null >@@ -1,28 +0,0 @@ >-/* >- * Copyright (C) 2018 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. >- */ >- >-.breakpoint.xhr .subtitle { >- font-family: Menlo, monospace; >-} >diff --git a/Source/WebInspectorUI/UserInterface/Views/XHRBreakpointTreeElement.js b/Source/WebInspectorUI/UserInterface/Views/XHRBreakpointTreeElement.js >deleted file mode 100644 >index 827423d5e337c15f05d44d6d40ba2efc4eff2a7b..0000000000000000000000000000000000000000 >--- a/Source/WebInspectorUI/UserInterface/Views/XHRBreakpointTreeElement.js >+++ /dev/null >@@ -1,148 +0,0 @@ >-/* >- * Copyright (C) 2017 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. >- */ >- >-WI.XHRBreakpointTreeElement = class XHRBreakpointTreeElement extends WI.GeneralTreeElement >-{ >- constructor(breakpoint, {className, title} = {}) >- { >- console.assert(breakpoint instanceof WI.XHRBreakpoint); >- >- if (!className) >- className = WI.BreakpointTreeElement.GenericLineIconStyleClassName; >- >- let subtitle; >- if (!title) { >- title = WI.UIString("URL"); >- if (breakpoint.type === WI.XHRBreakpoint.Type.Text) >- subtitle = doubleQuotedString(breakpoint.url); >- else >- subtitle = "/" + breakpoint.url + "/"; >- } >- >- super(["breakpoint", "xhr", className], title, subtitle, breakpoint); >- >- this.status = document.createElement("img"); >- this.status.classList.add("status-image", "resolved"); >- >- this.tooltipHandledSeparately = true; >- >- breakpoint.addEventListener(WI.XHRBreakpoint.Event.DisabledStateDidChange, this._updateStatus, this); >- >- this._updateStatus(); >- } >- >- // Protected >- >- onattach() >- { >- super.onattach(); >- >- this._boundStatusImageElementClicked = this._statusImageElementClicked.bind(this); >- this._boundStatusImageElementFocused = this._statusImageElementFocused.bind(this); >- this._boundStatusImageElementMouseDown = this._statusImageElementMouseDown.bind(this); >- >- this.status.addEventListener("click", this._boundStatusImageElementClicked); >- this.status.addEventListener("focus", this._boundStatusImageElementFocused); >- this.status.addEventListener("mousedown", this._boundStatusImageElementMouseDown); >- } >- >- ondetach() >- { >- super.ondetach(); >- >- this.status.removeEventListener("click", this._boundStatusImageElementClicked); >- this.status.removeEventListener("focus", this._boundStatusImageElementFocused); >- this.status.removeEventListener("mousedown", this._boundStatusImageElementMouseDown); >- >- this._boundStatusImageElementClicked = null; >- this._boundStatusImageElementFocused = null; >- this._boundStatusImageElementMouseDown = null; >- } >- >- ondelete() >- { >- // We set this flag so that TreeOutlines that will remove this >- // BreakpointTreeElement will know whether it was deleted from >- // within the TreeOutline or from outside it (e.g. TextEditor). >- this.__deletedViaDeleteKeyboardShortcut = true; >- >- WI.domDebuggerManager.removeXHRBreakpoint(this.representedObject); >- return true; >- } >- >- onenter() >- { >- this._toggleBreakpoint(); >- return true; >- } >- >- onspace() >- { >- this._toggleBreakpoint(); >- return true; >- } >- >- populateContextMenu(contextMenu, event) >- { >- let breakpoint = this.representedObject; >- let label = breakpoint.disabled ? WI.UIString("Enable Breakpoint") : WI.UIString("Disable Breakpoint"); >- contextMenu.appendItem(label, this._toggleBreakpoint.bind(this)); >- >- contextMenu.appendSeparator(); >- >- contextMenu.appendItem(WI.UIString("Delete Breakpoint"), () => { >- WI.domDebuggerManager.removeXHRBreakpoint(breakpoint); >- }); >- } >- >- // Private >- >- _statusImageElementClicked(event) >- { >- this._toggleBreakpoint(); >- } >- >- _statusImageElementFocused(event) >- { >- // Prevent tree outline focus. >- event.stopPropagation(); >- } >- >- _statusImageElementMouseDown(event) >- { >- // Prevent tree element selection. >- event.stopPropagation(); >- } >- >- _toggleBreakpoint() >- { >- this.representedObject.disabled = !this.representedObject.disabled; >- } >- >- _updateStatus() >- { >- this.status.classList.toggle("disabled", this.representedObject.disabled); >- } >-}; >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index d6da6ca0dd1b8b762c512fb48eb3432eb6e42f53..6576ce65d98b1eb04ec73ce75b53ee86cce9893c 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,18 @@ >+2019-01-06 Devin Rousso <drousso@apple.com> >+ >+ Web Inspector: extend XHR breakpoints to work with fetch >+ https://bugs.webkit.org/show_bug.cgi?id=185843 >+ <rdar://problem/40431027> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * inspector/dom-debugger/fetch-breakpoints.html: Copied from LayoutTests/inspector/dom-debugger/xhr-breakpoints.html. >+ * inspector/dom-debugger/fetch-breakpoints-expected.txt: Added. >+ >+ * inspector/dom-debugger/xhr-breakpoints.html: >+ >+ * inspector/dom-debugger/resources/dataFetch.json: Added. >+ > 2019-01-05 Zalan Bujtas <zalan@apple.com> > > Incorrect clipping across compositing boundary. >diff --git a/LayoutTests/inspector/dom-debugger/fetch-breakpoints-expected.txt b/LayoutTests/inspector/dom-debugger/fetch-breakpoints-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..e3cde1c45217d3fa21900c4607f15e2ed272c898 >--- /dev/null >+++ b/LayoutTests/inspector/dom-debugger/fetch-breakpoints-expected.txt >@@ -0,0 +1,72 @@ >+Tests for Fetch breakpoints. >+ >+ >+== Running test suite: FetchBreakpoints >+-- Running test case: BreakOnAllFetches >+Set pause on all Fetches. >+Sending Fetch. >+PAUSED: >+PASS: Pause reason should be Fetch. >+PASS: Pause data URL should be empty. >+CALL STACK: >+0: [F] loadResourceFetch >+1: [P] Global Code >+-- Running test teardown. >+ >+-- Running test case: BreakOnFetchContainingText >+PASS: Added breakpoint for URL: data >+PASS: Breakpoint should not be disabled initially. >+Sending Fetch. >+PAUSED: >+PASS: Pause reason should be Fetch. >+PASS: Pause data URL should match breakpoint URL. >+CALL STACK: >+0: [F] loadResourceFetch >+1: [P] Global Code >+-- Running test teardown. >+ >+-- Running test case: BreakOnFetchMatchingRegularExpression >+PASS: Added breakpoint for URL: data[A-Z]*.(json|txt|png) >+PASS: Breakpoint should not be disabled initially. >+Sending Fetch. >+PAUSED: >+PASS: Pause reason should be Fetch. >+PASS: Pause data URL should match breakpoint URL. >+CALL STACK: >+0: [F] loadResourceFetch >+1: [P] Global Code >+-- Running test teardown. >+ >+-- Running test case: ShouldNotPauseOnDisabledBreakpoint >+PASS: Added breakpoint for URL: data >+PASS: Breakpoint should not be disabled initially. >+Breakpoint disabled. >+Sending Fetch. >+Wait for evaluate in page to return. >+PASS: Should not pause for disabled breakpoint. >+-- Running test teardown. >+ >+-- Running test case: ShouldNotPauseOnFetchNotContainingURL >+PASS: Added breakpoint for URL: nonexistant-url >+PASS: Breakpoint should not be disabled initially. >+Sending Fetch. >+Wait for evaluate in page to return. >+PASS: Should not pause for breakpoint with different URL. >+-- Running test teardown. >+ >+-- Running test case: RemoveBreakpoint >+PASS: Added breakpoint for URL: data >+PASS: Breakpoint should not be disabled initially. >+Breakpoint removed. >+Wait for evaluate in page to return. >+PASS: Should not pause for removed breakpoint. >+-- Running test teardown. >+ >+-- Running test case: RemoveDisabledBreakpoint >+PASS: Added breakpoint for URL: data >+PASS: Breakpoint should not be disabled initially. >+Breakpoint disabled. >+Breakpoint removed. >+Wait for evaluate in page to return. >+PASS: Should not pause for removed disabled breakpoint. >+ >diff --git a/LayoutTests/inspector/dom-debugger/fetch-breakpoints.html b/LayoutTests/inspector/dom-debugger/fetch-breakpoints.html >new file mode 100644 >index 0000000000000000000000000000000000000000..8ff99425151b179d50a50446f095775a36b782a8 >--- /dev/null >+++ b/LayoutTests/inspector/dom-debugger/fetch-breakpoints.html >@@ -0,0 +1,233 @@ >+<!doctype html> >+<html> >+<head> >+<script src="../../http/tests/inspector/resources/inspector-test.js"></script> >+<script src="../debugger/resources/log-active-stack-trace.js"></script> >+<script src="../worker/resources/resource-utilities.js"></script> >+<script> >+function test() >+{ >+ let suite = InspectorTest.createAsyncSuite("FetchBreakpoints"); >+ >+ function teardown(resolve) { >+ let breakpoints = WI.domDebuggerManager.urlBreakpoints; >+ for (let breakpoint of breakpoints) >+ WI.domDebuggerManager.removeURLBreakpoint(breakpoint); >+ >+ WI.domDebuggerManager.allRequestsBreakpoint.disabled = true; >+ resolve(); >+ } >+ >+ function awaitEvaluateInPage(expression) { >+ return new Promise((resolve, reject) => { >+ InspectorTest.log("Wait for evaluate in page to return."); >+ InspectorTest.evaluateInPage(expression, (error) => { >+ if (error) >+ reject(error); >+ >+ resolve(); >+ }); >+ }); >+ } >+ >+ function rejectOnPause() { >+ return new Promise((resolve, reject) => { >+ WI.debuggerManager.awaitEvent(WI.DebuggerManager.Event.Paused) >+ .then((event) => { >+ WI.debuggerManager.resume(); >+ InspectorTest.fail("Should not pause."); >+ reject(); >+ }); >+ }); >+ } >+ >+ function addBreakpoint(type, url) { >+ return new Promise((resolve, reject) => { >+ let mainFrame = WI.networkManager.mainFrame; >+ InspectorTest.assert(mainFrame, "Missing main frame."); >+ if (!mainFrame) >+ reject(); >+ >+ let breakpoint = new WI.URLBreakpoint(type, url); >+ WI.domDebuggerManager.awaitEvent(WI.DOMDebuggerManager.Event.URLBreakpointAdded) >+ .then(() => { >+ InspectorTest.pass("Added breakpoint for URL: " + url); >+ InspectorTest.expectFalse(breakpoint.disabled, "Breakpoint should not be disabled initially."); >+ resolve(breakpoint); >+ }); >+ >+ WI.domDebuggerManager.addURLBreakpoint(breakpoint); >+ }); >+ } >+ >+ suite.addTestCase({ >+ name: "BreakOnAllFetches", >+ description: "Check that debugger pauses for all Fetches.", >+ teardown, >+ test(resolve, reject) { >+ InspectorTest.log("Set pause on all Fetches."); >+ WI.domDebuggerManager.allRequestsBreakpoint.disabled = false; >+ >+ InspectorTest.log("Sending Fetch."); >+ InspectorTest.evaluateInPage(`loadResourceFetch("resources/dataFetch.json")`); >+ >+ WI.debuggerManager.awaitEvent(WI.DebuggerManager.Event.Paused) >+ .then(() => { >+ let targetData = WI.debuggerManager.dataForTarget(WI.debuggerManager.activeCallFrame.target); >+ InspectorTest.log("PAUSED:"); >+ InspectorTest.expectEqual(targetData.pauseReason, WI.DebuggerManager.PauseReason.Fetch, "Pause reason should be Fetch."); >+ InspectorTest.expectFalse(targetData.pauseData.breakpointURL, "Pause data URL should be empty."); >+ >+ logActiveStackTrace(); >+ >+ return WI.debuggerManager.resume(); >+ }) >+ .then(resolve, reject); >+ } >+ }); >+ >+ suite.addTestCase({ >+ name: "BreakOnFetchContainingText", >+ description: "Check that debugger pauses on a URL containing text.", >+ teardown, >+ test(resolve, reject) { >+ let expectedBreakpointURL; >+ addBreakpoint(WI.URLBreakpoint.Type.Text, "data") >+ .then((breakpoint) => { >+ expectedBreakpointURL = breakpoint.url; >+ >+ InspectorTest.log("Sending Fetch."); >+ InspectorTest.evaluateInPage(`loadResourceFetch("resources/dataFetch.json")`); >+ return WI.debuggerManager.awaitEvent(WI.DebuggerManager.Event.Paused); >+ }) >+ .then(() => { >+ let targetData = WI.debuggerManager.dataForTarget(WI.debuggerManager.activeCallFrame.target); >+ InspectorTest.log("PAUSED:"); >+ InspectorTest.expectEqual(targetData.pauseReason, WI.DebuggerManager.PauseReason.Fetch, "Pause reason should be Fetch."); >+ InspectorTest.expectEqual(targetData.pauseData.breakpointURL, expectedBreakpointURL, "Pause data URL should match breakpoint URL."); >+ >+ logActiveStackTrace(); >+ >+ return WI.debuggerManager.resume(); >+ }) >+ .then(resolve, reject); >+ } >+ }); >+ >+ suite.addTestCase({ >+ name: "BreakOnFetchMatchingRegularExpression", >+ description: "Check that debugger pauses based on a URL matching a regex pattern.", >+ teardown, >+ test(resolve, reject) { >+ let expectedBreakpointURL; >+ addBreakpoint(WI.URLBreakpoint.Type.RegularExpression, "data[A-Z]*\.(json|txt|png)") >+ .then((breakpoint) => { >+ expectedBreakpointURL = breakpoint.url; >+ >+ InspectorTest.log("Sending Fetch."); >+ InspectorTest.evaluateInPage(`loadResourceFetch("resources/dataFetch.json")`); >+ return WI.debuggerManager.awaitEvent(WI.DebuggerManager.Event.Paused); >+ }) >+ .then(() => { >+ let targetData = WI.debuggerManager.dataForTarget(WI.debuggerManager.activeCallFrame.target); >+ InspectorTest.log("PAUSED:"); >+ InspectorTest.expectEqual(targetData.pauseReason, WI.DebuggerManager.PauseReason.Fetch, "Pause reason should be Fetch."); >+ InspectorTest.expectEqual(targetData.pauseData.breakpointURL, expectedBreakpointURL, "Pause data URL should match breakpoint URL."); >+ >+ logActiveStackTrace(); >+ >+ return WI.debuggerManager.resume(); >+ }) >+ .then(resolve, reject); >+ } >+ }); >+ >+ suite.addTestCase({ >+ name: "ShouldNotPauseOnDisabledBreakpoint", >+ description: "Check that debugger does not pause for disabled breakpoint.", >+ teardown, >+ test(resolve, reject) { >+ addBreakpoint(WI.URLBreakpoint.Type.Text, "data") >+ .then((breakpoint) => { >+ breakpoint.disabled = true; >+ InspectorTest.log("Breakpoint disabled."); >+ >+ InspectorTest.log("Sending Fetch."); >+ return Promise.race([awaitEvaluateInPage(`loadResourceFetch("resources/dataFetch.json")`), rejectOnPause()]); >+ }) >+ .then(() => { >+ InspectorTest.pass("Should not pause for disabled breakpoint."); >+ resolve(); >+ }) >+ .catch(reject); >+ } >+ }); >+ >+ suite.addTestCase({ >+ name: "ShouldNotPauseOnFetchNotContainingURL", >+ description: "Check that debugger does not pause for breakpoint with different URL.", >+ teardown, >+ test(resolve, reject) { >+ addBreakpoint(WI.URLBreakpoint.Type.Text, "nonexistant-url") >+ .then((breakpoint) => { >+ InspectorTest.log("Sending Fetch."); >+ return Promise.race([awaitEvaluateInPage(`loadResourceFetch("resources/dataFetch.json")`), rejectOnPause()]); >+ }) >+ .then(() => { >+ InspectorTest.pass("Should not pause for breakpoint with different URL."); >+ resolve(); >+ }) >+ .catch(reject); >+ } >+ }); >+ >+ suite.addTestCase({ >+ name: "RemoveBreakpoint", >+ description: "Check that debugger does not pause for removed breakpoint.", >+ teardown, >+ test(resolve, reject) { >+ addBreakpoint(WI.URLBreakpoint.Type.Text, "data") >+ .then((breakpoint) => { >+ WI.domDebuggerManager.removeURLBreakpoint(breakpoint); >+ InspectorTest.log("Breakpoint removed."); >+ >+ return Promise.race([awaitEvaluateInPage(`loadResourceFetch("resources/dataFetch.json")`), rejectOnPause()]); >+ }) >+ .then(() => { >+ InspectorTest.pass("Should not pause for removed breakpoint."); >+ resolve(); >+ }) >+ .catch(reject); >+ } >+ }); >+ >+ suite.addTestCase({ >+ name: "RemoveDisabledBreakpoint", >+ description: "Check that a disabled breakpoint can be removed.", >+ test(resolve, reject) { >+ addBreakpoint(WI.URLBreakpoint.Type.Text, "data") >+ .then((breakpoint) => { >+ breakpoint.disabled = true; >+ InspectorTest.log("Breakpoint disabled."); >+ >+ WI.domDebuggerManager.removeURLBreakpoint(breakpoint); >+ InspectorTest.log("Breakpoint removed."); >+ >+ return Promise.race([awaitEvaluateInPage(`loadResourceFetch("resources/dataFetch.json")`), rejectOnPause()]); >+ }) >+ .then(() => { >+ InspectorTest.pass("Should not pause for removed disabled breakpoint."); >+ resolve(); >+ }) >+ .catch(reject); >+ } >+ }); >+ >+ suite.runTestCasesAndFinish(); >+} >+</script> >+</head> >+<body onload="runTest()"> >+<p>Tests for Fetch breakpoints.</p> >+</body> >+</html> >diff --git a/LayoutTests/inspector/dom-debugger/resources/dataFetch.json b/LayoutTests/inspector/dom-debugger/resources/dataFetch.json >new file mode 100644 >index 0000000000000000000000000000000000000000..784c67c64401660562ac42f01bb7df756b0d4be1 >--- /dev/null >+++ b/LayoutTests/inspector/dom-debugger/resources/dataFetch.json >@@ -0,0 +1 @@ >+{"webkit":true, "type":"Fetch"} >diff --git a/LayoutTests/inspector/dom-debugger/xhr-breakpoints.html b/LayoutTests/inspector/dom-debugger/xhr-breakpoints.html >index f0a1350e26de0f67df07d8be22766a8016db2c50..aaf0a751658510d486743feb961b45369bec0218 100644 >--- a/LayoutTests/inspector/dom-debugger/xhr-breakpoints.html >+++ b/LayoutTests/inspector/dom-debugger/xhr-breakpoints.html >@@ -10,9 +10,9 @@ function test() > let suite = InspectorTest.createAsyncSuite("XHRBreakpoints"); > > function teardown(resolve) { >- let breakpoints = WI.domDebuggerManager.xhrBreakpoints; >+ let breakpoints = WI.domDebuggerManager.urlBreakpoints; > for (let breakpoint of breakpoints) >- WI.domDebuggerManager.removeXHRBreakpoint(breakpoint); >+ WI.domDebuggerManager.removeURLBreakpoint(breakpoint); > > WI.domDebuggerManager.allRequestsBreakpoint.disabled = true; > resolve(); >@@ -48,15 +48,15 @@ function test() > if (!mainFrame) > reject(); > >- let breakpoint = new WI.XHRBreakpoint(type, url); >- WI.domDebuggerManager.awaitEvent(WI.DOMDebuggerManager.Event.XHRBreakpointAdded) >+ let breakpoint = new WI.URLBreakpoint(type, url); >+ WI.domDebuggerManager.awaitEvent(WI.DOMDebuggerManager.Event.URLBreakpointAdded) > .then(() => { > InspectorTest.pass("Added breakpoint for URL: " + url); > InspectorTest.expectFalse(breakpoint.disabled, "Breakpoint should not be disabled initially."); > resolve(breakpoint); > }); > >- WI.domDebuggerManager.addXHRBreakpoint(breakpoint); >+ WI.domDebuggerManager.addURLBreakpoint(breakpoint); > }); > } > >@@ -92,7 +92,7 @@ function test() > teardown, > test(resolve, reject) { > let expectedBreakpointURL; >- addBreakpoint(WI.XHRBreakpoint.Type.Text, "data") >+ addBreakpoint(WI.URLBreakpoint.Type.Text, "data") > .then((breakpoint) => { > expectedBreakpointURL = breakpoint.url; > >@@ -120,7 +120,7 @@ function test() > teardown, > test(resolve, reject) { > let expectedBreakpointURL; >- addBreakpoint(WI.XHRBreakpoint.Type.RegularExpression, "data[A-Z]*\.(json|txt|png)") >+ addBreakpoint(WI.URLBreakpoint.Type.RegularExpression, "data[A-Z]*\.(json|txt|png)") > .then((breakpoint) => { > expectedBreakpointURL = breakpoint.url; > >@@ -147,7 +147,7 @@ function test() > description: "Check that debugger does not pause for disabled breakpoint.", > teardown, > test(resolve, reject) { >- addBreakpoint(WI.XHRBreakpoint.Type.Text, "data") >+ addBreakpoint(WI.URLBreakpoint.Type.Text, "data") > .then((breakpoint) => { > breakpoint.disabled = true; > InspectorTest.log("Breakpoint disabled."); >@@ -168,7 +168,7 @@ function test() > description: "Check that debugger does not pause for breakpoint with different URL.", > teardown, > test(resolve, reject) { >- addBreakpoint(WI.XHRBreakpoint.Type.Text, "nonexistant-url") >+ addBreakpoint(WI.URLBreakpoint.Type.Text, "nonexistant-url") > .then((breakpoint) => { > InspectorTest.log("Sending XMLHttpRequest."); > return Promise.race([awaitEvaluateInPage(`loadResourceXHR("resources/dataXHR.json")`), rejectOnPause()]); >@@ -186,9 +186,9 @@ function test() > description: "Check that debugger does not pause for removed breakpoint.", > teardown, > test(resolve, reject) { >- addBreakpoint(WI.XHRBreakpoint.Type.Text, "data") >+ addBreakpoint(WI.URLBreakpoint.Type.Text, "data") > .then((breakpoint) => { >- WI.domDebuggerManager.removeXHRBreakpoint(breakpoint); >+ WI.domDebuggerManager.removeURLBreakpoint(breakpoint); > InspectorTest.log("Breakpoint removed."); > > return Promise.race([awaitEvaluateInPage(`loadResourceXHR("resources/dataXHR.json")`), rejectOnPause()]); >@@ -205,12 +205,12 @@ function test() > name: "RemoveDisabledBreakpoint", > description: "Check that a disabled breakpoint can be removed.", > test(resolve, reject) { >- addBreakpoint(WI.XHRBreakpoint.Type.Text, "data") >+ addBreakpoint(WI.URLBreakpoint.Type.Text, "data") > .then((breakpoint) => { > breakpoint.disabled = true; > InspectorTest.log("Breakpoint disabled."); > >- WI.domDebuggerManager.removeXHRBreakpoint(breakpoint); >+ WI.domDebuggerManager.removeURLBreakpoint(breakpoint); > InspectorTest.log("Breakpoint removed."); > > return Promise.race([awaitEvaluateInPage(`loadResourceXHR("resources/dataXHR.json")`), rejectOnPause()]);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 185843
:
358471
|
358514