WebBrowser/AdBlock/AdBlockRule.py

changeset 5194
4750c83cc718
parent 4881
c269212cceac
child 5389
9b1c800daff3
equal deleted inserted replaced
5193:04ba3ea482fe 5194:4750c83cc718
9 9
10 from __future__ import unicode_literals 10 from __future__ import unicode_literals
11 11
12 import re 12 import re
13 13
14 from PyQt5.QtCore import Qt, QRegExp 14 from PyQt5.QtCore import qVersion, Qt, QRegExp
15 from PyQt5.QtWebEngineCore import QWebEngineUrlRequestInfo 15 from PyQt5.QtWebEngineCore import QWebEngineUrlRequestInfo
16 16
17 17
18 def toSecondLevelDomain(url): 18 def toSecondLevelDomain(url):
19 """ 19 """
530 @return flag indicating a match (boolean) 530 @return flag indicating a match (boolean)
531 """ 531 """
532 match = ( 532 match = (
533 req.resourceType() == 533 req.resourceType() ==
534 QWebEngineUrlRequestInfo.ResourceTypeSubResource) 534 QWebEngineUrlRequestInfo.ResourceTypeSubResource)
535 if qVersion() >= "5.7.0":
536 match = match or (
537 req.resourceType() ==
538 QWebEngineUrlRequestInfo.ResourceTypePluginResource)
535 539
536 if self.__objectSubrequestException: 540 if self.__objectSubrequestException:
537 return not match 541 return not match
538 else: 542 else:
539 return match 543 return match

eric ide

mercurial