diff options
author | Jay Kamat <jaygkamat@gmail.com> | 2019-01-16 23:39:12 -0800 |
---|---|---|
committer | Jay Kamat <jaygkamat@gmail.com> | 2019-01-16 23:39:12 -0800 |
commit | 761e7c6ba1b27639b086e39ed8b4be59871d8736 (patch) | |
tree | acd40577c113ca05f513998368135604fda5b089 /qutebrowser/extensions | |
parent | da2c6a6ac90c6753e87d99b906f4dbf62b1ea078 (diff) | |
download | qutebrowser-761e7c6ba1b27639b086e39ed8b4be59871d8736.tar.gz qutebrowser-761e7c6ba1b27639b086e39ed8b4be59871d8736.zip |
Convert enum to class style and add simple test for interceptor map
Diffstat (limited to 'qutebrowser/extensions')
-rw-r--r-- | qutebrowser/extensions/interceptors.py | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/qutebrowser/extensions/interceptors.py b/qutebrowser/extensions/interceptors.py index 070019557..7f5e0cecb 100644 --- a/qutebrowser/extensions/interceptors.py +++ b/qutebrowser/extensions/interceptors.py @@ -30,15 +30,32 @@ if MYPY: from PyQt5.QtCore import QUrl -# Possible request types that can be received. Currently correspond to the -# QWebEngineUrlRequestInfo Enum: -# https://doc.qt.io/qt-5/qwebengineurlrequestinfo.html#ResourceType-enum -ResourceType = enum.Enum('ResourceType', - ['main_frame', 'sub_frame', 'stylesheet', 'script', - 'image', 'font_resource', 'sub_resource', 'object', - 'media', 'worker', 'shared_worker', 'prefetch', - 'favicon', 'xhr', 'ping', 'service_worker', - 'csp_report', 'plugin_resource', 'unknown']) +class ResourceType(enum.Enum): + """Possible request types that can be received. + + Currently corresponds to the QWebEngineUrlRequestInfo Enum: + https://doc.qt.io/qt-5/qwebengineurlrequestinfo.html#ResourceType-enum + """ + + MAIN_FRAME = 1 + SUB_FRAME = 2 + STYLESHEET = 3 + SCRIPT = 4 + IMAGE = 5 + FONT_RESOURCE = 6 + SUB_RESOURCE = 7 + OBJECT = 8 + MEDIA = 9 + WORKER = 10 + SHARED_WORKER = 11 + PREFETCH = 12 + FAVICON = 13 + XHR = 14 + PING = 15 + SERVICE_WORKER = 16 + CSP_REPORT = 17 + PLUGIN_RESOURCE = 18 + UNKNOWN = 19 @attr.s |