WebBrowser/GreaseMonkey/GreaseMonkeyUrlInterceptor.py

branch
maintenance
changeset 5730
6422afc7adc4
parent 5695
9a71bd9e2e37
parent 5729
e67c1c4f4abb
child 5731
54829a44cea5
diff -r 9a71bd9e2e37 -r 6422afc7adc4 WebBrowser/GreaseMonkey/GreaseMonkeyUrlInterceptor.py
--- a/WebBrowser/GreaseMonkey/GreaseMonkeyUrlInterceptor.py	Sun Apr 09 16:52:55 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Copyright (c) 2016 - 2017 Detlev Offenbach <detlev@die-offenbachs.de>
-#
-
-"""
-Module implementing a handler for GreaseMonkey related URLs.
-"""
-
-from __future__ import unicode_literals
-
-from PyQt5.QtWebEngineCore import QWebEngineUrlRequestInfo
-
-from ..Network.UrlInterceptor import UrlInterceptor
-
-
-class GreaseMonkeyUrlInterceptor(UrlInterceptor):
-    """
-    Class implementing a handler for GreaseMonkey related URLs.
-    """
-    def __init__(self, manager):
-        """
-        Constructor
-        
-        @param manager reference to the GreaseMonkey manager
-        @type GreaseMonkeyManager
-        """
-        super(GreaseMonkeyUrlInterceptor, self).__init__(manager)
-        
-        self.__manager = manager
-    
-    def interceptRequest(self, info):
-        """
-        Public method to handle a GreaseMonkey request.
-        
-        @param info request info object
-        @type QWebEngineUrlRequestInfo
-        """
-        if info.navigationType() != \
-                QWebEngineUrlRequestInfo.NavigationTypeLink:
-            return
-        
-        if info.requestUrl().toString().endswith(".user.js"):
-            self.__manager.downloadScript(info.requestUrl())
-            info.block(True)

eric ide

mercurial