OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-2017 eyeo GmbH | 3 * Copyright (C) 2006-2017 eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 resultObject->SetProperty("responseText", result.responseText); | 77 resultObject->SetProperty("responseText", result.responseText); |
78 | 78 |
79 AdblockPlus::JsValuePtr headersObject = jsEngine->NewObject(); | 79 AdblockPlus::JsValuePtr headersObject = jsEngine->NewObject(); |
80 for (AdblockPlus::HeaderList::iterator it = result.responseHeaders.begin()
; | 80 for (AdblockPlus::HeaderList::iterator it = result.responseHeaders.begin()
; |
81 it != result.responseHeaders.end(); ++it) | 81 it != result.responseHeaders.end(); ++it) |
82 { | 82 { |
83 headersObject->SetProperty(it->first, it->second); | 83 headersObject->SetProperty(it->first, it->second); |
84 } | 84 } |
85 resultObject->SetProperty("responseHeaders", headersObject); | 85 resultObject->SetProperty("responseHeaders", headersObject); |
86 | 86 |
87 AdblockPlus::JsValueList params; | 87 AdblockPlus::JsConstValueList params; |
88 params.push_back(resultObject); | 88 params.push_back(resultObject); |
89 callback->Call(params); | 89 callback->Call(params); |
90 } | 90 } |
91 | 91 |
92 private: | 92 private: |
93 AdblockPlus::JsEnginePtr jsEngine; | 93 AdblockPlus::JsEnginePtr jsEngine; |
94 std::string url; | 94 std::string url; |
95 AdblockPlus::HeaderList headers; | 95 AdblockPlus::HeaderList headers; |
96 AdblockPlus::JsValuePtr callback; | 96 AdblockPlus::JsValuePtr callback; |
97 }; | 97 }; |
(...skipping 19 matching lines...) Expand all Loading... |
117 return v8::Undefined(); | 117 return v8::Undefined(); |
118 } | 118 } |
119 } | 119 } |
120 | 120 |
121 AdblockPlus::JsValuePtr AdblockPlus::WebRequestJsObject::Setup( | 121 AdblockPlus::JsValuePtr AdblockPlus::WebRequestJsObject::Setup( |
122 AdblockPlus::JsEnginePtr jsEngine, AdblockPlus::JsValuePtr obj) | 122 AdblockPlus::JsEnginePtr jsEngine, AdblockPlus::JsValuePtr obj) |
123 { | 123 { |
124 obj->SetProperty("GET", jsEngine->NewCallback(::GETCallback)); | 124 obj->SetProperty("GET", jsEngine->NewCallback(::GETCallback)); |
125 return obj; | 125 return obj; |
126 } | 126 } |
OLD | NEW |