| Index: Source/core/inspector/InspectorResourceAgent.cpp
|
| diff --git a/Source/core/inspector/InspectorResourceAgent.cpp b/Source/core/inspector/InspectorResourceAgent.cpp
|
| index 1abfe5b54ab4cc72f619e7984b4a85ad11c79634..da00709a67fb7c85620e7a26b85b737f455ecc28 100644
|
| --- a/Source/core/inspector/InspectorResourceAgent.cpp
|
| +++ b/Source/core/inspector/InspectorResourceAgent.cpp
|
| @@ -85,6 +85,7 @@ static const char extraRequestHeaders[] = "extraRequestHeaders";
|
| static const char cacheDisabled[] = "cacheDisabled";
|
| static const char userAgentOverride[] = "userAgentOverride";
|
| static const char monitoringXHR[] = "monitoringXHR";
|
| +static const char blockedURLs[] = "blockedURLs";
|
| }
|
|
|
| namespace {
|
| @@ -349,6 +350,17 @@ DEFINE_TRACE(InspectorResourceAgent)
|
| InspectorBaseAgent::trace(visitor);
|
| }
|
|
|
| +bool InspectorResourceAgent::shouldBlockRequest(const ResourceRequest& request)
|
| +{
|
| + String url = request.url().string();
|
| + RefPtr<JSONObject> blockedURLs = m_state->getObject(ResourceAgentState::blockedURLs);
|
| + for (const auto& blocked : *blockedURLs) {
|
| + if (url.contains(blocked.key))
|
| + return true;
|
| + }
|
| + return false;
|
| +}
|
| +
|
| void InspectorResourceAgent::willSendRequest(unsigned long identifier, DocumentLoader* loader, ResourceRequest& request, const ResourceResponse& redirectResponse, const FetchInitiatorInfo& initiatorInfo)
|
| {
|
| // Ignore the request initiated internally.
|
| @@ -864,6 +876,20 @@ void InspectorResourceAgent::getResponseBody(ErrorString* errorString, const Str
|
| callback->sendFailure("No data found for resource with given identifier");
|
| }
|
|
|
| +void InspectorResourceAgent::addBlockedURL(ErrorString*, const String& url)
|
| +{
|
| + RefPtr<JSONObject> blockedURLs = m_state->getObject(ResourceAgentState::blockedURLs);
|
| + blockedURLs->setBoolean(url, true);
|
| + m_state->setObject(ResourceAgentState::blockedURLs, blockedURLs.release());
|
| +}
|
| +
|
| +void InspectorResourceAgent::removeBlockedURL(ErrorString*, const String& url)
|
| +{
|
| + RefPtr<JSONObject> blockedURLs = m_state->getObject(ResourceAgentState::blockedURLs);
|
| + blockedURLs->remove(url);
|
| + m_state->setObject(ResourceAgentState::blockedURLs, blockedURLs.release());
|
| +}
|
| +
|
| void InspectorResourceAgent::replayXHR(ErrorString*, const String& requestId)
|
| {
|
| String actualRequestId = requestId;
|
|
|