Left: | ||
Right: |
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 19 matching lines...) Expand all Loading... | |
30 | 30 |
31 extern std::string jsSources[]; | 31 extern std::string jsSources[]; |
32 | 32 |
33 Filter::Filter(JsValue&& value) | 33 Filter::Filter(JsValue&& value) |
34 : JsValue(std::move(value)) | 34 : JsValue(std::move(value)) |
35 { | 35 { |
36 if (!IsObject()) | 36 if (!IsObject()) |
37 throw std::runtime_error("JavaScript value is not an object"); | 37 throw std::runtime_error("JavaScript value is not an object"); |
38 } | 38 } |
39 | 39 |
40 Filter::Type Filter::GetType() | 40 Filter::Type Filter::GetType() const |
41 { | 41 { |
42 std::string className = GetClass(); | 42 std::string className = GetClass(); |
43 if (className == "BlockingFilter") | 43 if (className == "BlockingFilter") |
44 return TYPE_BLOCKING; | 44 return TYPE_BLOCKING; |
45 else if (className == "WhitelistFilter") | 45 else if (className == "WhitelistFilter") |
46 return TYPE_EXCEPTION; | 46 return TYPE_EXCEPTION; |
47 else if (className == "ElemHideFilter") | 47 else if (className == "ElemHideFilter") |
48 return TYPE_ELEMHIDE; | 48 return TYPE_ELEMHIDE; |
49 else if (className == "ElemHideException") | 49 else if (className == "ElemHideException") |
50 return TYPE_ELEMHIDE_EXCEPTION; | 50 return TYPE_ELEMHIDE_EXCEPTION; |
51 else if (className == "CommentFilter") | 51 else if (className == "CommentFilter") |
52 return TYPE_COMMENT; | 52 return TYPE_COMMENT; |
53 else | 53 else |
54 return TYPE_INVALID; | 54 return TYPE_INVALID; |
55 } | 55 } |
56 | 56 |
57 bool Filter::IsListed() | 57 bool Filter::IsListed() const |
58 { | 58 { |
59 JsValuePtr func = jsEngine->Evaluate("API.isListedFilter"); | 59 JsValuePtr func = jsEngine->Evaluate("API.isListedFilter"); |
60 JsValueList params; | 60 JsConstValueList params; |
61 params.push_back(shared_from_this()); | 61 params.push_back(shared_from_this()); |
62 return func->Call(params)->AsBool(); | 62 return func->Call(params)->AsBool(); |
sergei
2017/03/23 19:46:06
There is actually `JsValue::Call(const JsValue& ar
hub
2017/03/24 13:45:15
Now that I'm looking at it, I think that this func
sergei
2017/03/24 13:56:47
We don't need to reallocate new JsValue here.
Act
hub
2017/03/24 14:08:03
In JsValue::Call() we currently do:
params.push_b
sergei
2017/03/24 14:24:55
I think that we should simply change the implement
hub
2017/03/24 16:05:06
Agreed. Issue 3589?
sergei
2017/03/24 16:27:52
I think it should be another issue (https://issues
| |
63 } | 63 } |
64 | 64 |
65 void Filter::AddToList() | 65 void Filter::AddToList() |
66 { | 66 { |
67 JsValuePtr func = jsEngine->Evaluate("API.addFilterToList"); | 67 JsValuePtr func = jsEngine->Evaluate("API.addFilterToList"); |
68 JsValueList params; | 68 JsConstValueList params; |
69 params.push_back(shared_from_this()); | 69 params.push_back(shared_from_this()); |
70 func->Call(params); | 70 func->Call(params); |
71 } | 71 } |
72 | 72 |
73 void Filter::RemoveFromList() | 73 void Filter::RemoveFromList() |
74 { | 74 { |
75 JsValuePtr func = jsEngine->Evaluate("API.removeFilterFromList"); | 75 JsValuePtr func = jsEngine->Evaluate("API.removeFilterFromList"); |
76 JsValueList params; | 76 JsConstValueList params; |
77 params.push_back(shared_from_this()); | 77 params.push_back(shared_from_this()); |
78 func->Call(params); | 78 func->Call(params); |
79 } | 79 } |
80 | 80 |
81 bool Filter::operator==(const Filter& filter) const | 81 bool Filter::operator==(const Filter& filter) const |
82 { | 82 { |
83 return GetProperty("text")->AsString() == filter.GetProperty("text")->AsString (); | 83 return GetProperty("text")->AsString() == filter.GetProperty("text")->AsString (); |
84 } | 84 } |
85 | 85 |
86 Subscription::Subscription(JsValue&& value) | 86 Subscription::Subscription(JsValue&& value) |
87 : JsValue(std::move(value)) | 87 : JsValue(std::move(value)) |
88 { | 88 { |
89 if (!IsObject()) | 89 if (!IsObject()) |
90 throw std::runtime_error("JavaScript value is not an object"); | 90 throw std::runtime_error("JavaScript value is not an object"); |
91 } | 91 } |
92 | 92 |
93 bool Subscription::IsListed() | 93 bool Subscription::IsListed() const |
94 { | 94 { |
95 JsValuePtr func = jsEngine->Evaluate("API.isListedSubscription"); | 95 JsValuePtr func = jsEngine->Evaluate("API.isListedSubscription"); |
96 JsValueList params; | 96 JsConstValueList params; |
97 params.push_back(shared_from_this()); | 97 params.push_back(shared_from_this()); |
98 return func->Call(params)->AsBool(); | 98 return func->Call(params)->AsBool(); |
99 } | 99 } |
100 | 100 |
101 void Subscription::AddToList() | 101 void Subscription::AddToList() |
102 { | 102 { |
103 JsValuePtr func = jsEngine->Evaluate("API.addSubscriptionToList"); | 103 JsValuePtr func = jsEngine->Evaluate("API.addSubscriptionToList"); |
104 JsValueList params; | 104 JsConstValueList params; |
105 params.push_back(shared_from_this()); | 105 params.push_back(shared_from_this()); |
106 func->Call(params); | 106 func->Call(params); |
107 } | 107 } |
108 | 108 |
109 void Subscription::RemoveFromList() | 109 void Subscription::RemoveFromList() |
110 { | 110 { |
111 JsValuePtr func = jsEngine->Evaluate("API.removeSubscriptionFromList"); | 111 JsValuePtr func = jsEngine->Evaluate("API.removeSubscriptionFromList"); |
112 JsValueList params; | 112 JsConstValueList params; |
113 params.push_back(shared_from_this()); | 113 params.push_back(shared_from_this()); |
114 func->Call(params); | 114 func->Call(params); |
115 } | 115 } |
116 | 116 |
117 void Subscription::UpdateFilters() | 117 void Subscription::UpdateFilters() |
118 { | 118 { |
119 JsValuePtr func = jsEngine->Evaluate("API.updateSubscription"); | 119 JsValuePtr func = jsEngine->Evaluate("API.updateSubscription"); |
120 JsValueList params; | 120 JsConstValueList params; |
121 params.push_back(shared_from_this()); | 121 params.push_back(shared_from_this()); |
122 func->Call(params); | 122 func->Call(params); |
123 } | 123 } |
124 | 124 |
125 bool Subscription::IsUpdating() | 125 bool Subscription::IsUpdating() const |
126 { | 126 { |
127 JsValuePtr func = jsEngine->Evaluate("API.isSubscriptionUpdating"); | 127 JsValuePtr func = jsEngine->Evaluate("API.isSubscriptionUpdating"); |
128 JsValueList params; | 128 JsConstValueList params; |
129 params.push_back(shared_from_this()); | 129 params.push_back(shared_from_this()); |
130 JsValuePtr result = func->Call(params); | 130 JsValuePtr result = func->Call(params); |
131 return result->AsBool(); | 131 return result->AsBool(); |
132 } | 132 } |
133 | 133 |
134 bool Subscription::operator==(const Subscription& subscription) const | 134 bool Subscription::operator==(const Subscription& subscription) const |
135 { | 135 { |
136 return GetProperty("url")->AsString() == subscription.GetProperty("url")->AsSt ring(); | 136 return GetProperty("url")->AsString() == subscription.GetProperty("url")->AsSt ring(); |
137 } | 137 } |
138 | 138 |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
282 return it->first; | 282 return it->first; |
283 } | 283 } |
284 throw std::invalid_argument("Cannot convert argument to ContentType"); | 284 throw std::invalid_argument("Cannot convert argument to ContentType"); |
285 } | 285 } |
286 | 286 |
287 bool FilterEngine::IsFirstRun() const | 287 bool FilterEngine::IsFirstRun() const |
288 { | 288 { |
289 return firstRun; | 289 return firstRun; |
290 } | 290 } |
291 | 291 |
292 FilterPtr FilterEngine::GetFilter(const std::string& text) | 292 FilterPtr FilterEngine::GetFilter(const std::string& text) const |
293 { | 293 { |
294 JsValuePtr func = jsEngine->Evaluate("API.getFilterFromText"); | 294 JsValuePtr func = jsEngine->Evaluate("API.getFilterFromText"); |
295 JsValueList params; | 295 JsConstValueList params; |
296 params.push_back(jsEngine->NewValue(text)); | 296 params.push_back(jsEngine->NewValue(text)); |
297 return FilterPtr(new Filter(std::move(*func->Call(params)))); | 297 return FilterPtr(new Filter(std::move(*func->Call(params)))); |
298 } | 298 } |
299 | 299 |
300 SubscriptionPtr FilterEngine::GetSubscription(const std::string& url) | 300 SubscriptionPtr FilterEngine::GetSubscription(const std::string& url) const |
301 { | 301 { |
302 JsValuePtr func = jsEngine->Evaluate("API.getSubscriptionFromUrl"); | 302 JsValuePtr func = jsEngine->Evaluate("API.getSubscriptionFromUrl"); |
303 JsValueList params; | 303 JsConstValueList params; |
304 params.push_back(jsEngine->NewValue(url)); | 304 params.push_back(jsEngine->NewValue(url)); |
305 return SubscriptionPtr(new Subscription(std::move(*func->Call(params)))); | 305 return SubscriptionPtr(new Subscription(std::move(*func->Call(params)))); |
306 } | 306 } |
307 | 307 |
308 std::vector<FilterPtr> FilterEngine::GetListedFilters() const | 308 std::vector<FilterPtr> FilterEngine::GetListedFilters() const |
309 { | 309 { |
310 JsValuePtr func = jsEngine->Evaluate("API.getListedFilters"); | 310 JsValuePtr func = jsEngine->Evaluate("API.getListedFilters"); |
311 JsValueList values = func->Call()->AsList(); | 311 JsValueList values = func->Call()->AsList(); |
312 std::vector<FilterPtr> result; | 312 std::vector<FilterPtr> result; |
313 for (JsValueList::iterator it = values.begin(); it != values.end(); it++) | 313 for (JsValueList::iterator it = values.begin(); it != values.end(); it++) |
(...skipping 17 matching lines...) Expand all Loading... | |
331 JsValueList values = func->Call()->AsList(); | 331 JsValueList values = func->Call()->AsList(); |
332 std::vector<SubscriptionPtr> result; | 332 std::vector<SubscriptionPtr> result; |
333 for (JsValueList::iterator it = values.begin(); it != values.end(); it++) | 333 for (JsValueList::iterator it = values.begin(); it != values.end(); it++) |
334 result.push_back(SubscriptionPtr(new Subscription(std::move(**it)))); | 334 result.push_back(SubscriptionPtr(new Subscription(std::move(**it)))); |
335 return result; | 335 return result; |
336 } | 336 } |
337 | 337 |
338 void FilterEngine::ShowNextNotification(const std::string& url) | 338 void FilterEngine::ShowNextNotification(const std::string& url) |
339 { | 339 { |
340 JsValuePtr func = jsEngine->Evaluate("API.showNextNotification"); | 340 JsValuePtr func = jsEngine->Evaluate("API.showNextNotification"); |
341 JsValueList params; | 341 JsConstValueList params; |
342 if (!url.empty()) | 342 if (!url.empty()) |
343 { | 343 { |
344 params.push_back(jsEngine->NewValue(url)); | 344 params.push_back(jsEngine->NewValue(url)); |
345 } | 345 } |
346 func->Call(params); | 346 func->Call(params); |
347 } | 347 } |
348 | 348 |
349 void FilterEngine::SetShowNotificationCallback(const ShowNotificationCallback& v alue) | 349 void FilterEngine::SetShowNotificationCallback(const ShowNotificationCallback& v alue) |
350 { | 350 { |
351 if (!value) | 351 if (!value) |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
402 const std::vector<std::string>& documentUrls) const | 402 const std::vector<std::string>& documentUrls) const |
403 { | 403 { |
404 return !!GetWhitelistingFilter(url, CONTENT_TYPE_ELEMHIDE, documentUrls); | 404 return !!GetWhitelistingFilter(url, CONTENT_TYPE_ELEMHIDE, documentUrls); |
405 } | 405 } |
406 | 406 |
407 AdblockPlus::FilterPtr FilterEngine::CheckFilterMatch(const std::string& url, | 407 AdblockPlus::FilterPtr FilterEngine::CheckFilterMatch(const std::string& url, |
408 ContentTypeMask contentTypeMask, | 408 ContentTypeMask contentTypeMask, |
409 const std::string& documentUrl) const | 409 const std::string& documentUrl) const |
410 { | 410 { |
411 JsValuePtr func = jsEngine->Evaluate("API.checkFilterMatch"); | 411 JsValuePtr func = jsEngine->Evaluate("API.checkFilterMatch"); |
412 JsValueList params; | 412 JsConstValueList params; |
413 params.push_back(jsEngine->NewValue(url)); | 413 params.push_back(jsEngine->NewValue(url)); |
414 params.push_back(jsEngine->NewValue(contentTypeMask)); | 414 params.push_back(jsEngine->NewValue(contentTypeMask)); |
415 params.push_back(jsEngine->NewValue(documentUrl)); | 415 params.push_back(jsEngine->NewValue(documentUrl)); |
416 JsValuePtr result = func->Call(params); | 416 JsValuePtr result = func->Call(params); |
417 if (!result->IsNull()) | 417 if (!result->IsNull()) |
418 return FilterPtr(new Filter(std::move(*result))); | 418 return FilterPtr(new Filter(std::move(*result))); |
419 else | 419 else |
420 return FilterPtr(); | 420 return FilterPtr(); |
421 } | 421 } |
422 | 422 |
423 std::vector<std::string> FilterEngine::GetElementHidingSelectors(const std::stri ng& domain) const | 423 std::vector<std::string> FilterEngine::GetElementHidingSelectors(const std::stri ng& domain) const |
424 { | 424 { |
425 JsValuePtr func = jsEngine->Evaluate("API.getElementHidingSelectors"); | 425 JsValuePtr func = jsEngine->Evaluate("API.getElementHidingSelectors"); |
426 JsValueList params; | 426 JsConstValueList params; |
427 params.push_back(jsEngine->NewValue(domain)); | 427 params.push_back(jsEngine->NewValue(domain)); |
428 JsValueList result = func->Call(params)->AsList(); | 428 JsValueList result = func->Call(params)->AsList(); |
429 std::vector<std::string> selectors; | 429 std::vector<std::string> selectors; |
430 for (JsValueList::iterator it = result.begin(); it != result.end(); ++it) | 430 for (JsValueList::iterator it = result.begin(); it != result.end(); ++it) |
431 selectors.push_back((*it)->AsString()); | 431 selectors.push_back((*it)->AsString()); |
432 return selectors; | 432 return selectors; |
433 } | 433 } |
434 | 434 |
435 JsValuePtr FilterEngine::GetPref(const std::string& pref) const | 435 JsValuePtr FilterEngine::GetPref(const std::string& pref) const |
436 { | 436 { |
437 JsValuePtr func = jsEngine->Evaluate("API.getPref"); | 437 JsValuePtr func = jsEngine->Evaluate("API.getPref"); |
438 JsValueList params; | 438 JsConstValueList params; |
439 params.push_back(jsEngine->NewValue(pref)); | 439 params.push_back(jsEngine->NewValue(pref)); |
440 return func->Call(params); | 440 return func->Call(params); |
441 } | 441 } |
442 | 442 |
443 void FilterEngine::SetPref(const std::string& pref, JsValuePtr value) | 443 void FilterEngine::SetPref(const std::string& pref, JsValuePtr value) |
444 { | 444 { |
445 JsValuePtr func = jsEngine->Evaluate("API.setPref"); | 445 JsValuePtr func = jsEngine->Evaluate("API.setPref"); |
446 JsValueList params; | 446 JsConstValueList params; |
447 params.push_back(jsEngine->NewValue(pref)); | 447 params.push_back(jsEngine->NewValue(pref)); |
448 if (value) | 448 if (value) |
449 params.push_back(value); | 449 params.push_back(value); |
450 func->Call(params); | 450 func->Call(params); |
451 } | 451 } |
452 | 452 |
453 std::string FilterEngine::GetHostFromURL(const std::string& url) | 453 std::string FilterEngine::GetHostFromURL(const std::string& url) const |
454 { | 454 { |
455 JsValuePtr func = jsEngine->Evaluate("API.getHostFromUrl"); | 455 JsValuePtr func = jsEngine->Evaluate("API.getHostFromUrl"); |
456 JsValueList params; | 456 JsConstValueList params; |
457 params.push_back(jsEngine->NewValue(url)); | 457 params.push_back(jsEngine->NewValue(url)); |
458 return func->Call(params)->AsString(); | 458 return func->Call(params)->AsString(); |
459 } | 459 } |
460 | 460 |
461 void FilterEngine::SetUpdateAvailableCallback( | 461 void FilterEngine::SetUpdateAvailableCallback( |
462 FilterEngine::UpdateAvailableCallback callback) | 462 FilterEngine::UpdateAvailableCallback callback) |
463 { | 463 { |
464 jsEngine->SetEventCallback("updateAvailable", | 464 jsEngine->SetEventCallback("updateAvailable", |
465 std::bind(&FilterEngine::UpdateAvailable, this, callback, | 465 std::bind(&FilterEngine::UpdateAvailable, this, callback, |
466 std::placeholders::_1)); | 466 std::placeholders::_1)); |
467 } | 467 } |
468 | 468 |
469 void FilterEngine::RemoveUpdateAvailableCallback() | 469 void FilterEngine::RemoveUpdateAvailableCallback() |
470 { | 470 { |
471 jsEngine->RemoveEventCallback("updateAvailable"); | 471 jsEngine->RemoveEventCallback("updateAvailable"); |
472 } | 472 } |
473 | 473 |
474 void FilterEngine::UpdateAvailable( | 474 void FilterEngine::UpdateAvailable( |
475 FilterEngine::UpdateAvailableCallback callback, JsValueList& params) | 475 FilterEngine::UpdateAvailableCallback callback, JsValueList& params) |
476 { | 476 { |
477 if (params.size() >= 1 && !params[0]->IsNull()) | 477 if (params.size() >= 1 && !params[0]->IsNull()) |
478 callback(params[0]->AsString()); | 478 callback(params[0]->AsString()); |
479 } | 479 } |
480 | 480 |
481 void FilterEngine::ForceUpdateCheck( | 481 void FilterEngine::ForceUpdateCheck( |
482 const FilterEngine::UpdateCheckDoneCallback& callback) | 482 const FilterEngine::UpdateCheckDoneCallback& callback) |
483 { | 483 { |
484 JsValuePtr func = jsEngine->Evaluate("API.forceUpdateCheck"); | 484 JsValuePtr func = jsEngine->Evaluate("API.forceUpdateCheck"); |
485 JsValueList params; | 485 JsConstValueList params; |
486 if (callback) | 486 if (callback) |
487 { | 487 { |
488 std::string eventName = "_updateCheckDone" + std::to_string(++updateCheckId) ; | 488 std::string eventName = "_updateCheckDone" + std::to_string(++updateCheckId) ; |
489 jsEngine->SetEventCallback(eventName, std::bind(&FilterEngine::UpdateCheckDo ne, | 489 jsEngine->SetEventCallback(eventName, std::bind(&FilterEngine::UpdateCheckDo ne, |
490 this, eventName, callback, std::placeholders::_1)); | 490 this, eventName, callback, std::placeholders::_1)); |
491 params.push_back(jsEngine->NewValue(eventName)); | 491 params.push_back(jsEngine->NewValue(eventName)); |
492 } | 492 } |
493 func->Call(params); | 493 func->Call(params); |
494 } | 494 } |
495 | 495 |
(...skipping 15 matching lines...) Expand all Loading... | |
511 void FilterEngine::RemoveFilterChangeCallback() | 511 void FilterEngine::RemoveFilterChangeCallback() |
512 { | 512 { |
513 jsEngine->RemoveEventCallback("filterChange"); | 513 jsEngine->RemoveEventCallback("filterChange"); |
514 } | 514 } |
515 | 515 |
516 void FilterEngine::SetAllowedConnectionType(const std::string* value) | 516 void FilterEngine::SetAllowedConnectionType(const std::string* value) |
517 { | 517 { |
518 SetPref("allowed_connection_type", value ? jsEngine->NewValue(*value) : nullpt r); | 518 SetPref("allowed_connection_type", value ? jsEngine->NewValue(*value) : nullpt r); |
519 } | 519 } |
520 | 520 |
521 std::unique_ptr<std::string> FilterEngine::GetAllowedConnectionType() | 521 std::unique_ptr<std::string> FilterEngine::GetAllowedConnectionType() const |
522 { | 522 { |
523 auto prefValue = GetPref("allowed_connection_type"); | 523 auto prefValue = GetPref("allowed_connection_type"); |
524 if (prefValue->IsUndefined()) | 524 if (prefValue->IsUndefined()) |
525 return nullptr; | 525 return nullptr; |
526 return std::unique_ptr<std::string>(new std::string(prefValue->AsString())); | 526 return std::unique_ptr<std::string>(new std::string(prefValue->AsString())); |
527 } | 527 } |
528 | 528 |
529 void FilterEngine::FilterChanged(FilterEngine::FilterChangeCallback callback, Js ValueList& params) | 529 void FilterEngine::FilterChanged(FilterEngine::FilterChangeCallback callback, Js ValueList& params) |
530 { | 530 { |
531 std::string action(params.size() >= 1 && !params[0]->IsNull() ? params[0]->AsS tring() : ""); | 531 std::string action(params.size() >= 1 && !params[0]->IsNull() ? params[0]->AsS tring() : ""); |
532 JsValuePtr item(params.size() >= 2 ? params[1] : jsEngine->NewValue(false)); | 532 JsValuePtr item(params.size() >= 2 ? params[1] : jsEngine->NewValue(false)); |
533 callback(action, item); | 533 callback(action, item); |
534 } | 534 } |
535 | 535 |
536 void FilterEngine::ShowNotification(const ShowNotificationCallback& callback, | 536 void FilterEngine::ShowNotification(const ShowNotificationCallback& callback, |
537 const JsValueList& params) | 537 const JsValueList& params) |
538 { | 538 { |
539 if (params.size() < 1) | 539 if (params.size() < 1) |
540 return; | 540 return; |
541 | 541 |
542 if (!params[0]->IsObject()) | 542 if (!params[0]->IsObject()) |
543 { | 543 { |
544 return; | 544 return; |
545 } | 545 } |
546 callback(NotificationPtr(new Notification(std::move(*params[0])))); | 546 callback(NotificationPtr(new Notification(std::move(*params[0])))); |
547 } | 547 } |
548 | 548 |
549 | 549 |
550 int FilterEngine::CompareVersions(const std::string& v1, const std::string& v2) | 550 int FilterEngine::CompareVersions(const std::string& v1, const std::string& v2) const |
551 { | 551 { |
552 JsValueList params; | 552 JsConstValueList params; |
553 params.push_back(jsEngine->NewValue(v1)); | 553 params.push_back(jsEngine->NewValue(v1)); |
554 params.push_back(jsEngine->NewValue(v2)); | 554 params.push_back(jsEngine->NewValue(v2)); |
555 JsValuePtr func = jsEngine->Evaluate("API.compareVersions"); | 555 JsValuePtr func = jsEngine->Evaluate("API.compareVersions"); |
556 return func->Call(params)->AsInt(); | 556 return func->Call(params)->AsInt(); |
557 } | 557 } |
558 | 558 |
559 FilterPtr FilterEngine::GetWhitelistingFilter(const std::string& url, | 559 FilterPtr FilterEngine::GetWhitelistingFilter(const std::string& url, |
560 ContentTypeMask contentTypeMask, const std::string& documentUrl) const | 560 ContentTypeMask contentTypeMask, const std::string& documentUrl) const |
561 { | 561 { |
562 FilterPtr match = Matches(url, contentTypeMask, documentUrl); | 562 FilterPtr match = Matches(url, contentTypeMask, documentUrl); |
(...skipping 21 matching lines...) Expand all Loading... | |
584 FilterPtr filter = GetWhitelistingFilter(currentUrl, contentTypeMask, parent Url); | 584 FilterPtr filter = GetWhitelistingFilter(currentUrl, contentTypeMask, parent Url); |
585 if (filter) | 585 if (filter) |
586 { | 586 { |
587 return filter; | 587 return filter; |
588 } | 588 } |
589 currentUrl = parentUrl; | 589 currentUrl = parentUrl; |
590 } | 590 } |
591 while (urlIterator != documentUrls.end()); | 591 while (urlIterator != documentUrls.end()); |
592 return FilterPtr(); | 592 return FilterPtr(); |
593 } | 593 } |
OLD | NEW |