Changeset 223836 in webkit


Ignore:
Timestamp:
Oct 23, 2017 9:44:58 AM (6 years ago)
Author:
Matt Lewis
Message:

Unreviewed, rolling out r223820.

This caused a build break on Windows.

Reverted changeset:

"Web Inspector: Remove unused Console.setMonitoringXHREnabled"
https://bugs.webkit.org/show_bug.cgi?id=178617
https://trac.webkit.org/changeset/223820

Location:
trunk/Source
Files:
2 added
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r223834 r223836  
     12017-10-23  Matt Lewis  <jlewis3@apple.com>
     2
     3        Unreviewed, rolling out r223820.
     4
     5        This caused a build break on Windows.
     6
     7        Reverted changeset:
     8
     9        "Web Inspector: Remove unused Console.setMonitoringXHREnabled"
     10        https://bugs.webkit.org/show_bug.cgi?id=178617
     11        https://trac.webkit.org/changeset/223820
     12
    1132017-10-23  Yusuke Suzuki  <utatane.tea@gmail.com>
    214
  • trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

    r223820 r223836  
    13361336                A5FD007E189B0B4C00633231 /* ScriptCallStackFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = A5FD007C189B0B4C00633231 /* ScriptCallStackFactory.h */; settings = {ATTRIBUTES = (Private, ); }; };
    13371337                A5FD0082189B191A00633231 /* InspectorConsoleAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = A5FD0080189B191A00633231 /* InspectorConsoleAgent.h */; settings = {ATTRIBUTES = (Private, ); }; };
     1338                A5FD0086189B1B7E00633231 /* JSGlobalObjectConsoleAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = A5FD0084189B1B7E00633231 /* JSGlobalObjectConsoleAgent.h */; };
    13381339                A700873A17CBE85300C3E643 /* MapConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = A700873817CBE85300C3E643 /* MapConstructor.h */; };
    13391340                A700873E17CBE8D300C3E643 /* MapPrototype.h in Headers */ = {isa = PBXBuildFile; fileRef = A700873C17CBE8D300C3E643 /* MapPrototype.h */; };
     
    39573958                A5FD007F189B191A00633231 /* InspectorConsoleAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorConsoleAgent.cpp; sourceTree = "<group>"; };
    39583959                A5FD0080189B191A00633231 /* InspectorConsoleAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorConsoleAgent.h; sourceTree = "<group>"; };
     3960                A5FD0083189B1B7E00633231 /* JSGlobalObjectConsoleAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSGlobalObjectConsoleAgent.cpp; sourceTree = "<group>"; };
     3961                A5FD0084189B1B7E00633231 /* JSGlobalObjectConsoleAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSGlobalObjectConsoleAgent.h; sourceTree = "<group>"; };
    39593962                A700873717CBE85300C3E643 /* MapConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MapConstructor.cpp; sourceTree = "<group>"; };
    39603963                A700873817CBE85300C3E643 /* MapConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MapConstructor.h; sourceTree = "<group>"; };
     
    75587561                                A55165D01BDEFDBD003B75C1 /* InspectorScriptProfilerAgent.cpp */,
    75597562                                A55165D11BDEFDBD003B75C1 /* InspectorScriptProfilerAgent.h */,
     7563                                A5FD0083189B1B7E00633231 /* JSGlobalObjectConsoleAgent.cpp */,
     7564                                A5FD0084189B1B7E00633231 /* JSGlobalObjectConsoleAgent.h */,
    75607565                                A57D23E71891B0770031C7FA /* JSGlobalObjectDebuggerAgent.cpp */,
    75617566                                A57D23E81891B0770031C7FA /* JSGlobalObjectDebuggerAgent.h */,
     
    87608765                                BC18C4210E16F5CD00B34460 /* JSGlobalObject.h in Headers */,
    87618766                                996B731D1BDA08EF00331B84 /* JSGlobalObject.lut.h in Headers */,
     8767                                A5FD0086189B1B7E00633231 /* JSGlobalObjectConsoleAgent.h in Headers */,
    87628768                                A5C3A1A618C0490200C9593A /* JSGlobalObjectConsoleClient.h in Headers */,
    87638769                                A59455931824744700CC3843 /* JSGlobalObjectDebuggable.h in Headers */,
  • trunk/Source/JavaScriptCore/Sources.txt

    r223820 r223836  
    558558inspector/agents/InspectorRuntimeAgent.cpp
    559559inspector/agents/InspectorScriptProfilerAgent.cpp
     560inspector/agents/JSGlobalObjectConsoleAgent.cpp
    560561inspector/agents/JSGlobalObjectDebuggerAgent.cpp
    561562inspector/agents/JSGlobalObjectRuntimeAgent.cpp
  • trunk/Source/JavaScriptCore/inspector/JSGlobalObjectInspectorController.cpp

    r223820 r223836  
    3636#include "InspectorAgent.h"
    3737#include "InspectorBackendDispatcher.h"
    38 #include "InspectorConsoleAgent.h"
    3938#include "InspectorFrontendChannel.h"
    4039#include "InspectorFrontendRouter.h"
     
    4342#include "JSCInlines.h"
    4443#include "JSGlobalObject.h"
     44#include "JSGlobalObjectConsoleAgent.h"
    4545#include "JSGlobalObjectConsoleClient.h"
    4646#include "JSGlobalObjectDebuggerAgent.h"
     
    8484    auto runtimeAgent = std::make_unique<JSGlobalObjectRuntimeAgent>(context);
    8585    auto heapAgent = std::make_unique<InspectorHeapAgent>(context);
    86     auto consoleAgent = std::make_unique<InspectorConsoleAgent>(context, heapAgent.get());
     86    auto consoleAgent = std::make_unique<JSGlobalObjectConsoleAgent>(context, heapAgent.get());
    8787    auto debuggerAgent = std::make_unique<JSGlobalObjectDebuggerAgent>(context, consoleAgent.get());
    8888    auto scriptProfilerAgent = std::make_unique<InspectorScriptProfilerAgent>(context);
  • trunk/Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.h

    r223820 r223836  
    6262    void disable(ErrorString&) override;
    6363    void clearMessages(ErrorString&) override;
     64    void setMonitoringXHREnabled(ErrorString&, bool enabled) override = 0;
    6465
    6566    bool enabled() const { return m_enabled; }
  • trunk/Source/JavaScriptCore/inspector/protocol/Console.json

    r223820 r223836  
    5858            "name": "clearMessages",
    5959            "description": "Clears console messages collected in the browser."
     60        },
     61        {
     62            "name": "setMonitoringXHREnabled",
     63            "description": "Toggles monitoring of XMLHttpRequest. If <code>true</code>, console will receive messages upon each XHR issued.",
     64            "parameters": [
     65                { "name": "enabled", "type": "boolean", "description": "Monitoring enabled state." }
     66            ]
    6067        }
    6168    ],
  • trunk/Source/WebCore/ChangeLog

    r223835 r223836  
     12017-10-23  Matt Lewis  <jlewis3@apple.com>
     2
     3        Unreviewed, rolling out r223820.
     4
     5        This caused a build break on Windows.
     6
     7        Reverted changeset:
     8
     9        "Web Inspector: Remove unused Console.setMonitoringXHREnabled"
     10        https://bugs.webkit.org/show_bug.cgi?id=178617
     11        https://trac.webkit.org/changeset/223820
     12
    1132017-10-23  Zalan Bujtas  <zalan@apple.com>
    214
  • trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp

    r223820 r223836  
    626626}
    627627
    628 void InspectorInstrumentation::didFinishXHRLoadingImpl(InstrumentingAgents& instrumentingAgents, unsigned long identifier, std::optional<String> decodedText)
    629 {
     628void InspectorInstrumentation::didFinishXHRLoadingImpl(InstrumentingAgents& instrumentingAgents, unsigned long identifier, std::optional<String> decodedText, const String& url, const String& sendURL, unsigned sendLineNumber, unsigned sendColumnNumber)
     629{
     630    if (WebConsoleAgent* consoleAgent = instrumentingAgents.webConsoleAgent())
     631        consoleAgent->didFinishXHRLoading(identifier, url, sendURL, sendLineNumber, sendColumnNumber);
    630632    if (InspectorNetworkAgent* networkAgent = instrumentingAgents.inspectorNetworkAgent()) {
    631633        if (decodedText)
  • trunk/Source/WebCore/inspector/InspectorInstrumentation.h

    r223820 r223836  
    187187    static void willSendRequestOfType(Frame*, unsigned long identifier, DocumentLoader*, ResourceRequest&, LoadType);
    188188
    189     static void didFinishXHRLoading(ScriptExecutionContext*, unsigned long identifier, std::optional<String> decodedText);
     189    static void didFinishXHRLoading(ScriptExecutionContext*, unsigned long identifier, std::optional<String> decodedText, const String& url, const String& sendURL, unsigned sendLineNumber, unsigned sendColumnNumber);
    190190    static void willLoadXHRSynchronously(ScriptExecutionContext*);
    191191    static void didLoadXHRSynchronously(ScriptExecutionContext*);
     
    356356    static void didFinishLoadingImpl(InstrumentingAgents&, unsigned long identifier, DocumentLoader*, const NetworkLoadMetrics&, ResourceLoader*);
    357357    static void didFailLoadingImpl(InstrumentingAgents&, unsigned long identifier, DocumentLoader*, const ResourceError&);
    358     static void didFinishXHRLoadingImpl(InstrumentingAgents&, unsigned long identifier, std::optional<String> decodedText);
     358    static void didFinishXHRLoadingImpl(InstrumentingAgents&, unsigned long identifier, std::optional<String> decodedText, const String& url, const String& sendURL, unsigned sendLineNumber, unsigned sendColumnNumber);
    359359    static void willLoadXHRSynchronouslyImpl(InstrumentingAgents&);
    360360    static void didLoadXHRSynchronouslyImpl(InstrumentingAgents&);
     
    958958}
    959959
    960 inline void InspectorInstrumentation::didFinishXHRLoading(ScriptExecutionContext* context, unsigned long identifier, std::optional<String> decodedText)
    961 {
    962     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
    963         didFinishXHRLoadingImpl(*instrumentingAgents, identifier, decodedText);
     960inline void InspectorInstrumentation::didFinishXHRLoading(ScriptExecutionContext* context, unsigned long identifier, std::optional<String> decodedText, const String& url, const String& sendURL, unsigned sendLineNumber, unsigned sendColumnNumber)
     961{
     962    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
     963        didFinishXHRLoadingImpl(*instrumentingAgents, identifier, decodedText, url, sendURL, sendLineNumber, sendColumnNumber);
    964964}
    965965
  • trunk/Source/WebCore/inspector/WebConsoleAgent.cpp

    r223820 r223836  
    4747}
    4848
     49void WebConsoleAgent::setMonitoringXHREnabled(ErrorString&, bool enabled)
     50{
     51    m_monitoringXHREnabled = enabled;
     52}
     53
    4954void WebConsoleAgent::frameWindowDiscarded(DOMWindow* window)
    5055{
     
    5964
    6065    static_cast<WebInjectedScriptManager&>(m_injectedScriptManager).discardInjectedScriptsFor(window);
     66}
     67
     68void WebConsoleAgent::didFinishXHRLoading(unsigned long requestIdentifier, const String& url, const String& sendURL, unsigned sendLineNumber, unsigned sendColumnNumber)
     69{
     70    if (!m_injectedScriptManager.inspectorEnvironment().developerExtrasEnabled())
     71        return;
     72
     73    if (m_monitoringXHREnabled) {
     74        String message = "XHR finished loading: \"" + url + "\".";
     75        addMessageToConsole(std::make_unique<ConsoleMessage>(MessageSource::Network, MessageType::Log, MessageLevel::Debug, message, sendURL, sendLineNumber, sendColumnNumber, nullptr, requestIdentifier));
     76    }
    6177}
    6278
  • trunk/Source/WebCore/inspector/WebConsoleAgent.h

    r223820 r223836  
    4242    virtual ~WebConsoleAgent() = default;
    4343
     44    void setMonitoringXHREnabled(ErrorString&, bool enabled) final;
     45
    4446    void frameWindowDiscarded(DOMWindow*);
    4547
     48    void didFinishXHRLoading(unsigned long requestIdentifier, const String& url, const String& sendURL, unsigned sendLineNumber, unsigned sendColumnNumber);
    4649    void didReceiveResponse(unsigned long requestIdentifier, const ResourceResponse&);
    4750    void didFailLoading(unsigned long requestIdentifier, const ResourceError&);
     51
     52protected:
     53    bool m_monitoringXHREnabled { false };
    4854};
    4955
  • trunk/Source/WebCore/xml/XMLHttpRequest.cpp

    r223820 r223836  
    4444#include "ResourceError.h"
    4545#include "ResourceRequest.h"
     46#include "ScriptController.h"
    4647#include "SecurityOriginPolicy.h"
    4748#include "Settings.h"
     
    5455#include "XMLHttpRequestUpload.h"
    5556#include "markup.h"
     57#include <interpreter/StackVisitor.h>
    5658#include <mutex>
    5759#include <runtime/ArrayBuffer.h>
     
    279281}
    280282
     283void XMLHttpRequest::setLastSendLineAndColumnNumber(unsigned lineNumber, unsigned columnNumber)
     284{
     285    m_lastSendLineNumber = lineNumber;
     286    m_lastSendColumnNumber = columnNumber;
     287}
     288
    281289XMLHttpRequestUpload* XMLHttpRequest::upload()
    282290{
     
    426434}
    427435
    428 ExceptionOr<void> XMLHttpRequest::send(std::optional<SendTypes>&& sendType)
     436namespace {
     437
     438// FIXME: This should be abstracted out, so that any IDL function can be passed the line/column/url tuple.
     439
     440// FIXME: This should probably use ShadowChicken so that we get the right frame even when it did a tail call.
     441// https://bugs.webkit.org/show_bug.cgi?id=155688
     442
     443class SendFunctor {
     444public:
     445    SendFunctor() = default;
     446
     447    unsigned line() const { return m_line; }
     448    unsigned column() const { return m_column; }
     449    String url() const { return m_url; }
     450
     451    JSC::StackVisitor::Status operator()(JSC::StackVisitor& visitor) const
     452    {
     453        if (!m_hasSkippedFirstFrame) {
     454            m_hasSkippedFirstFrame = true;
     455            return JSC::StackVisitor::Continue;
     456        }
     457
     458        unsigned line = 0;
     459        unsigned column = 0;
     460        visitor->computeLineAndColumn(line, column);
     461        m_line = line;
     462        m_column = column;
     463        m_url = visitor->sourceURL();
     464        return JSC::StackVisitor::Done;
     465    }
     466
     467private:
     468    mutable bool m_hasSkippedFirstFrame { false };
     469    mutable unsigned m_line { 0 };
     470    mutable unsigned m_column { 0 };
     471    mutable String m_url;
     472};
     473
     474}
     475
     476ExceptionOr<void> XMLHttpRequest::send(JSC::ExecState& state, std::optional<SendTypes>&& sendType)
    429477{
    430478    InspectorInstrumentation::willSendXMLHttpRequest(scriptExecutionContext(), url());
     
    444492    }
    445493
     494    SendFunctor functor;
     495    state.iterate(functor);
     496    setLastSendLineAndColumnNumber(functor.line(), functor.column());
     497    setLastSendURL(functor.url());
     498
    446499    return result;
    447500}
     
    940993    if (!m_binaryResponseBuilder)
    941994        decodedText = m_responseBuilder.toStringPreserveCapacity();
    942     InspectorInstrumentation::didFinishXHRLoading(scriptExecutionContext(), identifier, decodedText);
     995    InspectorInstrumentation::didFinishXHRLoading(scriptExecutionContext(), identifier, decodedText, m_url, m_lastSendURL, m_lastSendLineNumber, m_lastSendColumnNumber);
    943996
    944997    bool hadLoader = m_loader;
  • trunk/Source/WebCore/xml/XMLHttpRequest.h

    r223820 r223836  
    3636class ArrayBuffer;
    3737class ArrayBufferView;
     38class ExecState;
    3839}
    3940
     
    8081    ExceptionOr<void> open(const String& method, const URL&, bool async);
    8182    ExceptionOr<void> open(const String& method, const String&, bool async, const String& user, const String& password);
    82     ExceptionOr<void> send(std::optional<SendTypes>&&);
     83    ExceptionOr<void> send(JSC::ExecState&, std::optional<SendTypes>&&);
    8384    void abort();
    8485    ExceptionOr<void> setRequestHeader(const String& name, const String& value);
     
    109110    String responseURL() const;
    110111
     112    void setLastSendLineAndColumnNumber(unsigned lineNumber, unsigned columnNumber);
     113    void setLastSendURL(const String& url) { m_lastSendURL = url; }
     114
    111115    XMLHttpRequestUpload* upload();
    112116    XMLHttpRequestUpload* optionalUpload() const { return m_upload.get(); }
     
    215219    long long m_receivedLength { 0 };
    216220
     221    unsigned m_lastSendLineNumber { 0 };
     222    unsigned m_lastSendColumnNumber { 0 };
     223    String m_lastSendURL;
    217224    std::optional<ExceptionCode> m_exceptionCode;
    218225
  • trunk/Source/WebCore/xml/XMLHttpRequest.idl

    r223820 r223836  
    6767    attribute boolean withCredentials;
    6868    readonly attribute XMLHttpRequestUpload upload;
    69     [MayThrowException] void send(optional (Document or BodyInit)? body = null);
     69    [CallWith=ScriptState, MayThrowException] void send(optional (Document or BodyInit)? body = null);
    7070    void abort();
    7171
Note: See TracChangeset for help on using the changeset viewer.