| 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-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 CriticalSection::Lock lock(m_csInject); | 151 CriticalSection::Lock lock(m_csInject); |
| 152 auto url = GetDocumentUrl(); | 152 auto url = GetDocumentUrl(); |
| 153 if (!IsOurHtmlFile(url)) | 153 if (!IsOurHtmlFile(url)) |
| 154 { | 154 { |
| 155 DEBUG_GENERAL(L"InjectABP. Not injecting"); | 155 DEBUG_GENERAL(L"InjectABP. Not injecting"); |
| 156 return; | 156 return; |
| 157 } | 157 } |
| 158 DEBUG_GENERAL(L"InjectABP. Injecting"); | 158 DEBUG_GENERAL(L"InjectABP. Injecting"); |
| 159 CComPtr<IDispatch> pDocDispatch; | 159 CComPtr<IDispatch> pDocDispatch; |
| 160 browser->get_Document(&pDocDispatch); | 160 browser->get_Document(&pDocDispatch); |
| 161 CComQIPtr<IHTMLDocument2> pDoc2 = pDocDispatch; | 161 CComQIPtr<IHTMLDocument2> pDoc2(pDocDispatch); |
| 162 if (!pDoc2) | 162 if (!pDoc2) |
| 163 { | 163 { |
| 164 DEBUG_ERROR_LOG(0, PLUGIN_ERROR_CREATE_SETTINGS_JAVASCRIPT, PLUGIN_ERROR_CRE
ATE_SETTINGS_JAVASCRIPT_INVOKE, "CPluginTabBase::InjectABP - Failed to QI docume
nt"); | 164 DEBUG_ERROR_LOG(0, PLUGIN_ERROR_CREATE_SETTINGS_JAVASCRIPT, PLUGIN_ERROR_CRE
ATE_SETTINGS_JAVASCRIPT_INVOKE, "CPluginTabBase::InjectABP - Failed to QI docume
nt"); |
| 165 return; | 165 return; |
| 166 } | 166 } |
| 167 CComPtr<IHTMLWindow2> pWnd2; | 167 CComPtr<IHTMLWindow2> pWnd2; |
| 168 pDoc2->get_parentWindow(&pWnd2); | 168 pDoc2->get_parentWindow(&pWnd2); |
| 169 if (!pWnd2) | 169 if (!pWnd2) |
| 170 { | 170 { |
| 171 DEBUG_ERROR_LOG(0, PLUGIN_ERROR_CREATE_SETTINGS_JAVASCRIPT, PLUGIN_ERROR_CRE
ATE_SETTINGS_JAVASCRIPT_INVOKE, "CPluginTabBase::InjectABP - Failed to get paren
t window"); | 171 DEBUG_ERROR_LOG(0, PLUGIN_ERROR_CREATE_SETTINGS_JAVASCRIPT, PLUGIN_ERROR_CRE
ATE_SETTINGS_JAVASCRIPT_INVOKE, "CPluginTabBase::InjectABP - Failed to get paren
t window"); |
| 172 return; | 172 return; |
| 173 } | 173 } |
| 174 CComQIPtr<IDispatchEx> pWndEx = pWnd2; | 174 CComQIPtr<IDispatchEx> pWndEx(pWnd2); |
| 175 if (!pWndEx) | 175 if (!pWndEx) |
| 176 { | 176 { |
| 177 DEBUG_ERROR_LOG(0, PLUGIN_ERROR_CREATE_SETTINGS_JAVASCRIPT, PLUGIN_ERROR_CRE
ATE_SETTINGS_JAVASCRIPT_INVOKE, "CPluginTabBase::InjectABP - Failed to QI dispat
ch"); | 177 DEBUG_ERROR_LOG(0, PLUGIN_ERROR_CREATE_SETTINGS_JAVASCRIPT, PLUGIN_ERROR_CRE
ATE_SETTINGS_JAVASCRIPT_INVOKE, "CPluginTabBase::InjectABP - Failed to QI dispat
ch"); |
| 178 return; | 178 return; |
| 179 } | 179 } |
| 180 // Create "Settings" object in JavaScript. | 180 // Create "Settings" object in JavaScript. |
| 181 // A method call of "Settings" in JavaScript, transfered to "Invoke" of m_plug
inUserSettings | 181 // A method call of "Settings" in JavaScript, transfered to "Invoke" of m_plug
inUserSettings |
| 182 DISPID dispid; | 182 DISPID dispid; |
| 183 HRESULT hr = pWndEx->GetDispID(L"Settings", fdexNameEnsure, &dispid); | 183 HRESULT hr = pWndEx->GetDispID(L"Settings", fdexNameEnsure, &dispid); |
| 184 if (FAILED(hr)) | 184 if (FAILED(hr)) |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 if (urlLegacy.Left(6) != "res://") | 230 if (urlLegacy.Left(6) != "res://") |
| 231 { | 231 { |
| 232 // Get document | 232 // Get document |
| 233 CComPtr<IDispatch> pDocDispatch; | 233 CComPtr<IDispatch> pDocDispatch; |
| 234 HRESULT hr = browser->get_Document(&pDocDispatch); | 234 HRESULT hr = browser->get_Document(&pDocDispatch); |
| 235 if (FAILED(hr) || !pDocDispatch) | 235 if (FAILED(hr) || !pDocDispatch) |
| 236 { | 236 { |
| 237 return; | 237 return; |
| 238 } | 238 } |
| 239 | 239 |
| 240 CComQIPtr<IHTMLDocument2> pDoc = pDocDispatch; | 240 CComQIPtr<IHTMLDocument2> pDoc(pDocDispatch); |
| 241 if (!pDoc) | 241 if (!pDoc) |
| 242 { | 242 { |
| 243 return; | 243 return; |
| 244 } | 244 } |
| 245 |
| 245 CComPtr<IOleObject> pOleObj; | 246 CComPtr<IOleObject> pOleObj; |
| 246 | 247 pDocDispatch->QueryInterface(&pOleObj); |
| 247 pDocDispatch->QueryInterface(IID_IOleObject, (void**)&pOleObj); | 248 if (!pOleObj) |
| 248 | 249 { |
| 249 | 250 return; |
| 251 } |
| 250 CComPtr<IOleClientSite> pClientSite; | 252 CComPtr<IOleClientSite> pClientSite; |
| 251 pOleObj->GetClientSite(&pClientSite); | 253 pOleObj->GetClientSite(&pClientSite); |
| 252 if (pClientSite != NULL) | 254 if (pClientSite != NULL) |
| 253 { | 255 { |
| 254 CComPtr<IDocHostUIHandler> docHostUIHandler; | 256 CComPtr<IDocHostUIHandler> docHostUIHandler; |
| 255 pClientSite->QueryInterface(IID_IDocHostUIHandler, (void**)&docHostUIHandl
er); | 257 pClientSite->QueryInterface(&docHostUIHandler); |
| 256 if (docHostUIHandler != NULL) | 258 if (docHostUIHandler != NULL) |
| 257 { | 259 { |
| 258 docHostUIHandler->UpdateUI(); | 260 docHostUIHandler->UpdateUI(); |
| 259 } | 261 } |
| 260 } | 262 } |
| 261 } | 263 } |
| 262 } | 264 } |
| 263 | 265 |
| 264 std::wstring CPluginTabBase::GetDocumentDomain() | 266 std::wstring CPluginTabBase::GetDocumentDomain() |
| 265 { | 267 { |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 LogQueue::LogPluginError(pluginError.GetErrorCode(), pluginError.GetEr
rorId(), pluginError.GetErrorSubid(), pluginError.GetErrorDescription(), true, p
luginError.GetProcessId(), pluginError.GetThreadId()); | 387 LogQueue::LogPluginError(pluginError.GetErrorCode(), pluginError.GetEr
rorId(), pluginError.GetErrorSubid(), pluginError.GetErrorDescription(), true, p
luginError.GetProcessId(), pluginError.GetThreadId()); |
| 386 } | 388 } |
| 387 | 389 |
| 388 // Non-hanging sleep | 390 // Non-hanging sleep |
| 389 Sleep(50); | 391 Sleep(50); |
| 390 } | 392 } |
| 391 | 393 |
| 392 tabLoopIteration++; | 394 tabLoopIteration++; |
| 393 } | 395 } |
| 394 } | 396 } |
| OLD | NEW |