From 658accab94f3c9682ae381b3b56ab99e9d67660a Mon Sep 17 00:00:00 2001 From: Robo Date: Thu, 10 Dec 2015 00:46:03 +0530 Subject: [PATCH] fix pointer usage --- atom/browser/api/atom_api_web_request.cc | 8 +- atom/browser/api/atom_api_web_request.h | 3 +- atom/browser/net/atom_network_delegate.cc | 236 ++++++++++-------- atom/browser/net/atom_network_delegate.h | 23 +- .../native_mate_converters/net_converter.cc | 8 +- .../native_mate_converters/value_converter.cc | 7 - .../native_mate_converters/value_converter.h | 6 - chromium_src/extensions/common/url_pattern.cc | 2 +- docs/api/session.md | 8 +- 9 files changed, 150 insertions(+), 151 deletions(-) diff --git a/atom/browser/api/atom_api_web_request.cc b/atom/browser/api/atom_api_web_request.cc index c45cd900ab7a..07c0576977dc 100644 --- a/atom/browser/api/atom_api_web_request.cc +++ b/atom/browser/api/atom_api_web_request.cc @@ -30,8 +30,8 @@ template void WebRequest::SetListener(mate::Arguments* args) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - base::DictionaryValue* filter = new base::DictionaryValue(); - args->GetNext(filter); + scoped_ptr filter(new base::DictionaryValue()); + args->GetNext(filter.get()); AtomNetworkDelegate::Listener callback; if (!args->GetNext(&callback)) { args->ThrowError("Must pass null or a function"); @@ -42,7 +42,7 @@ void WebRequest::SetListener(mate::Arguments* args) { BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::Bind(&AtomNetworkDelegate::SetListenerInIO, base::Unretained(delegate), - type, filter, callback)); + type, base::Passed(&filter), callback)); } // static @@ -54,7 +54,7 @@ mate::Handle WebRequest::Create( // static void WebRequest::BuildPrototype(v8::Isolate* isolate, - v8::Local prototype) { + v8::Local prototype) { mate::ObjectTemplateBuilder(isolate, prototype) .SetMethod("onBeforeRequest", &WebRequest::SetListener< diff --git a/atom/browser/api/atom_api_web_request.h b/atom/browser/api/atom_api_web_request.h index 053bc1bec97d..597bb80f7c65 100644 --- a/atom/browser/api/atom_api_web_request.h +++ b/atom/browser/api/atom_api_web_request.h @@ -9,7 +9,6 @@ #include "atom/browser/api/trackable_object.h" #include "atom/browser/net/atom_network_delegate.h" -#include "base/callback.h" #include "native_mate/arguments.h" #include "native_mate/handle.h" @@ -22,7 +21,7 @@ namespace api { class WebRequest : public mate::TrackableObject { public: static mate::Handle Create(v8::Isolate* isolate, - AtomBrowserContext* browser_context); + AtomBrowserContext* browser_context); // mate::TrackableObject: static void BuildPrototype(v8::Isolate* isolate, diff --git a/atom/browser/net/atom_network_delegate.cc b/atom/browser/net/atom_network_delegate.cc index d4c83996b9cc..c7a54ee66492 100644 --- a/atom/browser/net/atom_network_delegate.cc +++ b/atom/browser/net/atom_network_delegate.cc @@ -18,9 +18,9 @@ namespace { std::string ResourceTypeToString(content::ResourceType type) { switch (type) { case content::RESOURCE_TYPE_MAIN_FRAME: - return "main_frame"; + return "mainFrame"; case content::RESOURCE_TYPE_SUB_FRAME: - return "sub_frame"; + return "subFrame"; case content::RESOURCE_TYPE_STYLESHEET: return "stylesheet"; case content::RESOURCE_TYPE_SCRIPT: @@ -30,12 +30,18 @@ std::string ResourceTypeToString(content::ResourceType type) { case content::RESOURCE_TYPE_OBJECT: return "object"; case content::RESOURCE_TYPE_XHR: - return "xmlhttprequest"; + return "xhr"; default: return "other"; } } +AtomNetworkDelegate::BlockingResponse RunListener( + const AtomNetworkDelegate::Listener& callback, + scoped_ptr details) { + return callback.Run(*(details.get())); +} + bool MatchesFilterCondition( net::URLRequest* request, const AtomNetworkDelegate::ListenerInfo& info) { @@ -50,8 +56,8 @@ bool MatchesFilterCondition( return true; } -base::DictionaryValue* ExtractRequestInfo(net::URLRequest* request) { - base::DictionaryValue* dict = new base::DictionaryValue(); +scoped_ptr ExtractRequestInfo(net::URLRequest* request) { + scoped_ptr dict(new base::DictionaryValue()); dict->SetInteger("id", request->identifier()); dict->SetString("url", request->url().spec()); dict->SetString("method", request->method()); @@ -62,21 +68,21 @@ base::DictionaryValue* ExtractRequestInfo(net::URLRequest* request) { dict->SetString("resourceType", ResourceTypeToString(resourceType)); dict->SetDouble("timestamp", base::Time::Now().ToDoubleT() * 1000); - return dict; + return dict.Pass(); } -base::DictionaryValue* GetRequestHeadersDict( +scoped_ptr GetRequestHeadersDict( const net::HttpRequestHeaders& headers) { - base::DictionaryValue* header_dict = new base::DictionaryValue(); + scoped_ptr header_dict(new base::DictionaryValue()); net::HttpRequestHeaders::Iterator it(headers); while (it.GetNext()) header_dict->SetString(it.name(), it.value()); - return header_dict; + return header_dict.Pass(); } -base::DictionaryValue* GetResponseHeadersDict( +scoped_ptr GetResponseHeadersDict( const net::HttpResponseHeaders* headers) { - base::DictionaryValue* header_dict = new base::DictionaryValue(); + scoped_ptr header_dict(new base::DictionaryValue()); if (headers) { void* iter = nullptr; std::string key; @@ -84,25 +90,25 @@ base::DictionaryValue* GetResponseHeadersDict( while (headers->EnumerateHeaderLines(&iter, &key, &value)) header_dict->SetString(key, value); } - return header_dict; + return header_dict.Pass(); } void OnBeforeURLRequestResponse( const net::CompletionCallback& callback, GURL* new_url, const AtomNetworkDelegate::BlockingResponse& result) { - if (!result.redirectURL.is_empty()) - *new_url = result.redirectURL; - callback.Run(result.Cancel()); + if (!result.redirect_url.is_empty()) + *new_url = result.redirect_url; + callback.Run(result.Code()); } void OnBeforeSendHeadersResponse( const net::CompletionCallback& callback, net::HttpRequestHeaders* headers, const AtomNetworkDelegate::BlockingResponse& result) { - if (!result.requestHeaders.IsEmpty()) - *headers = result.requestHeaders; - callback.Run(result.Cancel()); + if (!result.request_headers.IsEmpty()) + *headers = result.request_headers; + callback.Run(result.Code()); } void OnHeadersReceivedResponse( @@ -110,26 +116,22 @@ void OnHeadersReceivedResponse( const net::HttpResponseHeaders* original_response_headers, scoped_refptr* override_response_headers, const AtomNetworkDelegate::BlockingResponse& result) { - if (result.responseHeaders.get()) { + if (result.response_headers.get()) { *override_response_headers = new net::HttpResponseHeaders( original_response_headers->raw_headers()); void* iter = nullptr; std::string key; std::string value; - while (result.responseHeaders->EnumerateHeaderLines(&iter, &key, &value)) { + while (result.response_headers->EnumerateHeaderLines(&iter, &key, &value)) { (*override_response_headers)->RemoveHeader(key); (*override_response_headers)->AddHeader(key + ": " + value); } } - callback.Run(result.Cancel()); + callback.Run(result.Code()); } } // namespace -// static -std::map -AtomNetworkDelegate::event_listener_map_; - AtomNetworkDelegate::AtomNetworkDelegate() { } @@ -138,8 +140,13 @@ AtomNetworkDelegate::~AtomNetworkDelegate() { void AtomNetworkDelegate::SetListenerInIO( EventTypes type, - const base::DictionaryValue* filter, + scoped_ptr filter, const Listener& callback) { + if (callback.is_null()) { + event_listener_map_.erase(type); + return; + } + ListenerInfo info; info.callback = callback; @@ -162,69 +169,71 @@ int AtomNetworkDelegate::OnBeforeURLRequest( net::URLRequest* request, const net::CompletionCallback& callback, GURL* new_url) { - brightray::NetworkDelegate::OnBeforeURLRequest(request, callback, new_url); + auto listener_info = event_listener_map_.find(kOnBeforeRequest); + if (listener_info != event_listener_map_.end()) { + if (!MatchesFilterCondition(request, listener_info->second)) + return net::OK; - auto listener_info = event_listener_map_[kOnBeforeRequest]; - - if (!MatchesFilterCondition(request, listener_info)) - return net::OK; - - if (!listener_info.callback.is_null()) { - auto wrapped_callback = listener_info.callback; + auto wrapped_callback = listener_info->second.callback; auto details = ExtractRequestInfo(request); BrowserThread::PostTaskAndReplyWithResult(BrowserThread::UI, FROM_HERE, - base::Bind(wrapped_callback, details), + base::Bind(&RunListener, wrapped_callback, base::Passed(&details)), base::Bind(&OnBeforeURLRequestResponse, callback, new_url)); return net::ERR_IO_PENDING; } - return net::OK; + return brightray::NetworkDelegate::OnBeforeURLRequest(request, + callback, + new_url); } int AtomNetworkDelegate::OnBeforeSendHeaders( net::URLRequest* request, const net::CompletionCallback& callback, net::HttpRequestHeaders* headers) { - auto listener_info = event_listener_map_[kOnBeforeSendHeaders]; + auto listener_info = event_listener_map_.find(kOnBeforeSendHeaders); + if (listener_info != event_listener_map_.end()) { + if (!MatchesFilterCondition(request, listener_info->second)) + return net::OK; - if (!MatchesFilterCondition(request, listener_info)) - return net::OK; - - if (!listener_info.callback.is_null()) { - auto wrapped_callback = listener_info.callback; + auto wrapped_callback = listener_info->second.callback; auto details = ExtractRequestInfo(request); - details->Set("requestHeaders", GetRequestHeadersDict(*headers)); + details->Set("requestHeaders", GetRequestHeadersDict(*headers).release()); BrowserThread::PostTaskAndReplyWithResult(BrowserThread::UI, FROM_HERE, - base::Bind(wrapped_callback, details), + base::Bind(&RunListener, wrapped_callback, base::Passed(&details)), base::Bind(&OnBeforeSendHeadersResponse, callback, headers)); return net::ERR_IO_PENDING; } - return net::OK; + return brightray::NetworkDelegate::OnBeforeSendHeaders(request, + callback, + headers); } void AtomNetworkDelegate::OnSendHeaders( net::URLRequest* request, const net::HttpRequestHeaders& headers) { - auto listener_info = event_listener_map_[kOnSendHeaders]; + auto listener_info = event_listener_map_.find(kOnSendHeaders); + if (listener_info != event_listener_map_.end()) { + if (!MatchesFilterCondition(request, listener_info->second)) + return; - if (!MatchesFilterCondition(request, listener_info)) - return; - - if (!listener_info.callback.is_null()) { - auto wrapped_callback = listener_info.callback; + auto wrapped_callback = listener_info->second.callback; auto details = ExtractRequestInfo(request); - details->Set("requestHeaders", GetRequestHeadersDict(headers)); + details->Set("requestHeaders", GetRequestHeadersDict(headers).release()); BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, - base::Bind(base::IgnoreResult(wrapped_callback), - details)); + base::Bind(base::IgnoreResult(&RunListener), + wrapped_callback, + base::Passed(&details))); + } else { + brightray::NetworkDelegate::OnSendHeaders(request, headers); } } @@ -234,23 +243,22 @@ int AtomNetworkDelegate::OnHeadersReceived( const net::HttpResponseHeaders* original_response_headers, scoped_refptr* override_response_headers, GURL* allowed_unsafe_redirect_url) { - auto listener_info = event_listener_map_[kOnHeadersReceived]; + auto listener_info = event_listener_map_.find(kOnHeadersReceived); + if (listener_info != event_listener_map_.end()) { + if (!MatchesFilterCondition(request, listener_info->second)) + return net::OK; - if (!MatchesFilterCondition(request, listener_info)) - return net::OK; - - if (!listener_info.callback.is_null()) { - auto wrapped_callback = listener_info.callback; + auto wrapped_callback = listener_info->second.callback; auto details = ExtractRequestInfo(request); details->SetString("statusLine", original_response_headers->GetStatusLine()); details->SetInteger("statusCode", original_response_headers->response_code()); details->Set("responseHeaders", - GetResponseHeadersDict(original_response_headers)); + GetResponseHeadersDict(original_response_headers).release()); BrowserThread::PostTaskAndReplyWithResult(BrowserThread::UI, FROM_HERE, - base::Bind(wrapped_callback, details), + base::Bind(&RunListener, wrapped_callback, base::Passed(&details)), base::Bind(&OnHeadersReceivedResponse, callback, original_response_headers, @@ -259,18 +267,19 @@ int AtomNetworkDelegate::OnHeadersReceived( return net::ERR_IO_PENDING; } - return net::OK; + return brightray::NetworkDelegate::OnHeadersReceived( + request, callback, original_response_headers, override_response_headers, + allowed_unsafe_redirect_url); } void AtomNetworkDelegate::OnBeforeRedirect(net::URLRequest* request, const GURL& new_location) { - auto listener_info = event_listener_map_[kOnBeforeRedirect]; + auto listener_info = event_listener_map_.find(kOnBeforeRedirect); + if (listener_info != event_listener_map_.end()) { + if (!MatchesFilterCondition(request, listener_info->second)) + return; - if (!MatchesFilterCondition(request, listener_info)) - return; - - if (!listener_info.callback.is_null()) { - auto wrapped_callback = listener_info.callback; + auto wrapped_callback = listener_info->second.callback; auto details = ExtractRequestInfo(request); details->SetString("redirectURL", new_location.spec()); details->SetInteger("statusCode", request->GetResponseCode()); @@ -279,28 +288,30 @@ void AtomNetworkDelegate::OnBeforeRedirect(net::URLRequest* request, details->SetString("ip", ip); details->SetBoolean("fromCache", request->was_cached()); details->Set("responseHeaders", - GetResponseHeadersDict(request->response_headers())); + GetResponseHeadersDict(request->response_headers()).release()); BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, - base::Bind(base::IgnoreResult(wrapped_callback), - details)); + base::Bind(base::IgnoreResult(&RunListener), + wrapped_callback, + base::Passed(&details))); + } else { + brightray::NetworkDelegate::OnBeforeRedirect(request, new_location); } } void AtomNetworkDelegate::OnResponseStarted(net::URLRequest* request) { - if (request->status().status() != net::URLRequestStatus::SUCCESS) - return; + auto listener_info = event_listener_map_.find(kOnResponseStarted); + if (listener_info != event_listener_map_.end()) { + if (request->status().status() != net::URLRequestStatus::SUCCESS) + return; - auto listener_info = event_listener_map_[kOnResponseStarted]; + if (!MatchesFilterCondition(request, listener_info->second)) + return; - if (!MatchesFilterCondition(request, listener_info)) - return; - - if (!listener_info.callback.is_null()) { - auto wrapped_callback = listener_info.callback; + auto wrapped_callback = listener_info->second.callback; auto details = ExtractRequestInfo(request); details->Set("responseHeaders", - GetResponseHeadersDict(request->response_headers())); + GetResponseHeadersDict(request->response_headers()).release()); details->SetBoolean("fromCache", request->was_cached()); auto response_headers = request->response_headers(); @@ -312,34 +323,36 @@ void AtomNetworkDelegate::OnResponseStarted(net::URLRequest* request) { response_headers->GetStatusLine() : std::string()); BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, - base::Bind(base::IgnoreResult(wrapped_callback), - details)); + base::Bind(base::IgnoreResult(&RunListener), + wrapped_callback, + base::Passed(&details))); + } else { + brightray::NetworkDelegate::OnResponseStarted(request); } } void AtomNetworkDelegate::OnCompleted(net::URLRequest* request, bool started) { - if (request->status().status() == net::URLRequestStatus::FAILED || - request->status().status() == net::URLRequestStatus::CANCELED) { - OnErrorOccurred(request); - return; - } else { - bool is_redirect = request->response_headers() && - net::HttpResponseHeaders::IsRedirectResponseCode( - request->response_headers()->response_code()); - if (is_redirect) + auto listener_info = event_listener_map_.find(kOnCompleted); + if (listener_info != event_listener_map_.end()) { + if (request->status().status() == net::URLRequestStatus::FAILED || + request->status().status() == net::URLRequestStatus::CANCELED) { + OnErrorOccurred(request); return; - } + } else { + bool is_redirect = request->response_headers() && + net::HttpResponseHeaders::IsRedirectResponseCode( + request->response_headers()->response_code()); + if (is_redirect) + return; + } - auto listener_info = event_listener_map_[kOnCompleted]; + if (!MatchesFilterCondition(request, listener_info->second)) + return; - if (!MatchesFilterCondition(request, listener_info)) - return; - - if (!listener_info.callback.is_null()) { - auto wrapped_callback = listener_info.callback; + auto wrapped_callback = listener_info->second.callback; auto details = ExtractRequestInfo(request); details->Set("responseHeaders", - GetResponseHeadersDict(request->response_headers())); + GetResponseHeadersDict(request->response_headers()).release()); details->SetBoolean("fromCache", request->was_cached()); auto response_headers = request->response_headers(); @@ -351,26 +364,29 @@ void AtomNetworkDelegate::OnCompleted(net::URLRequest* request, bool started) { response_headers->GetStatusLine() : std::string()); BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, - base::Bind(base::IgnoreResult(wrapped_callback), - details)); + base::Bind(base::IgnoreResult(&RunListener), + wrapped_callback, + base::Passed(&details))); + } else { + brightray::NetworkDelegate::OnCompleted(request, started); } } void AtomNetworkDelegate::OnErrorOccurred(net::URLRequest* request) { - auto listener_info = event_listener_map_[kOnErrorOccurred]; + auto listener_info = event_listener_map_.find(kOnErrorOccurred); + if (listener_info != event_listener_map_.end()) { + if (!MatchesFilterCondition(request, listener_info->second)) + return; - if (!MatchesFilterCondition(request, listener_info)) - return; - - if (!listener_info.callback.is_null()) { - auto wrapped_callback = listener_info.callback; + auto wrapped_callback = listener_info->second.callback; auto details = ExtractRequestInfo(request); details->SetBoolean("fromCache", request->was_cached()); details->SetString("error", net::ErrorToString(request->status().error())); BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, - base::Bind(base::IgnoreResult(wrapped_callback), - details)); + base::Bind(base::IgnoreResult(&RunListener), + wrapped_callback, + base::Passed(&details))); } } diff --git a/atom/browser/net/atom_network_delegate.h b/atom/browser/net/atom_network_delegate.h index c48d252b2b0a..9f78cc8d92da 100644 --- a/atom/browser/net/atom_network_delegate.h +++ b/atom/browser/net/atom_network_delegate.h @@ -27,7 +27,7 @@ class AtomNetworkDelegate : public brightray::NetworkDelegate { public: struct BlockingResponse; using Listener = - base::Callback; + base::Callback; enum EventTypes { kInvalidEvent = 0, @@ -42,35 +42,34 @@ class AtomNetworkDelegate : public brightray::NetworkDelegate { }; struct ListenerInfo { - ListenerInfo() {} - ~ListenerInfo() {} - std::set url_patterns; AtomNetworkDelegate::Listener callback; }; struct BlockingResponse { - BlockingResponse() {} + BlockingResponse() : cancel(false) {} ~BlockingResponse() {} - int Cancel() const { + int Code() const { return cancel ? net::ERR_BLOCKED_BY_CLIENT : net::OK; } bool cancel; - GURL redirectURL; - net::HttpRequestHeaders requestHeaders; - scoped_refptr responseHeaders; + GURL redirect_url; + net::HttpRequestHeaders request_headers; + scoped_refptr response_headers; }; AtomNetworkDelegate(); ~AtomNetworkDelegate() override; void SetListenerInIO(EventTypes type, - const base::DictionaryValue* filter, + scoped_ptr filter, const Listener& callback); protected: + void OnErrorOccurred(net::URLRequest* request); + // net::NetworkDelegate: int OnBeforeURLRequest(net::URLRequest* request, const net::CompletionCallback& callback, @@ -91,10 +90,8 @@ class AtomNetworkDelegate : public brightray::NetworkDelegate { void OnResponseStarted(net::URLRequest* request) override; void OnCompleted(net::URLRequest* request, bool started) override; - void OnErrorOccurred(net::URLRequest* request); - private: - static std::map event_listener_map_; + std::map event_listener_map_; DISALLOW_COPY_AND_ASSIGN(AtomNetworkDelegate); }; diff --git a/atom/common/native_mate_converters/net_converter.cc b/atom/common/native_mate_converters/net_converter.cc index 2086e84d5891..876b22536ac4 100644 --- a/atom/common/native_mate_converters/net_converter.cc +++ b/atom/common/native_mate_converters/net_converter.cc @@ -62,7 +62,7 @@ bool Converter::FromV8( return false; if (!dict.Get("cancel", &(out->cancel))) return false; - dict.Get("redirectURL", &(out->redirectURL)); + dict.Get("redirectURL", &(out->redirect_url)); base::DictionaryValue request_headers; if (dict.Get("requestHeaders", &request_headers)) { for (base::DictionaryValue::Iterator it(request_headers); @@ -70,18 +70,18 @@ bool Converter::FromV8( it.Advance()) { std::string value; CHECK(it.value().GetAsString(&value)); - out->requestHeaders.SetHeader(it.key(), value); + out->request_headers.SetHeader(it.key(), value); } } base::DictionaryValue response_headers; if (dict.Get("responseHeaders", &response_headers)) { - out->responseHeaders = new net::HttpResponseHeaders(""); + out->response_headers = new net::HttpResponseHeaders(""); for (base::DictionaryValue::Iterator it(response_headers); !it.IsAtEnd(); it.Advance()) { std::string value; CHECK(it.value().GetAsString(&value)); - out->responseHeaders->AddHeader(it.key() + " : " + value); + out->response_headers->AddHeader(it.key() + " : " + value); } } return true; diff --git a/atom/common/native_mate_converters/value_converter.cc b/atom/common/native_mate_converters/value_converter.cc index 431f11fbbdb3..c9c1a861ba26 100644 --- a/atom/common/native_mate_converters/value_converter.cc +++ b/atom/common/native_mate_converters/value_converter.cc @@ -30,13 +30,6 @@ v8::Local Converter::ToV8( return converter->ToV8Value(&val, isolate->GetCurrentContext()); } -v8::Local Converter::ToV8( - v8::Isolate* isolate, - const base::DictionaryValue* val) { - scoped_ptr converter(new atom::V8ValueConverter); - return converter->ToV8Value(val, isolate->GetCurrentContext()); -} - bool Converter::FromV8(v8::Isolate* isolate, v8::Local val, base::ListValue* out) { diff --git a/atom/common/native_mate_converters/value_converter.h b/atom/common/native_mate_converters/value_converter.h index f660fd3f1897..013dd99cc798 100644 --- a/atom/common/native_mate_converters/value_converter.h +++ b/atom/common/native_mate_converters/value_converter.h @@ -23,12 +23,6 @@ struct Converter { const base::DictionaryValue& val); }; -template<> -struct Converter { - static v8::Local ToV8(v8::Isolate* isolate, - const base::DictionaryValue* val); -}; - template<> struct Converter { static bool FromV8(v8::Isolate* isolate, diff --git a/chromium_src/extensions/common/url_pattern.cc b/chromium_src/extensions/common/url_pattern.cc index a6e51aa675b7..4303689fe81c 100644 --- a/chromium_src/extensions/common/url_pattern.cc +++ b/chromium_src/extensions/common/url_pattern.cc @@ -250,7 +250,7 @@ URLPattern::ParseResult URLPattern::Parse(const std::string& pattern) { host_components.erase(host_components.begin(), host_components.begin() + 1); } - host_ = JoinString(host_components, "."); + host_ = base::JoinString(host_components, "."); path_start_pos = host_end_pos; } diff --git a/docs/api/session.md b/docs/api/session.md index b16a9b1f0f83..9429bc3c2df7 100644 --- a/docs/api/session.md +++ b/docs/api/session.md @@ -367,7 +367,7 @@ Fired just before a request is going to be sent to the server, modifications of * `filter` Object * `urls` Array - A list of URLs or URL patterns. Request that cannot match any of the URLs - will be filtered out. + will be filtered out. * `listener` Function * `details` Object * `id` String - Request id. @@ -390,7 +390,7 @@ Fired when HTTP response headers of a request have been received. Should return * `filter` Object * `urls` Array - A list of URLs or URL patterns. Request that cannot match any of the URLs - will be filtered out. + will be filtered out. * `listener` Function * `details` Object * `id` String - Request id. @@ -410,7 +410,7 @@ status line and response headers are available. * `filter` Object * `urls` Array - A list of URLs or URL patterns. Request that cannot match any of the URLs - will be filtered out. + will be filtered out. * `listener` Function * `details` Object * `id` String - Request id. @@ -420,7 +420,7 @@ status line and response headers are available. * `timestamp` Double * `redirectURL` String * `statusCode` Integer - * `ip` String - The server IP address that the request was actually sent to. + * `ip` String **optional** - The server IP address that the request was actually sent to. * `fromCache` Boolean * `responseHeaders` Object