         let contentController = ZHWebViewContentController.init(webView: webView, proxyDelegate: proxyDelegate)
         contentController.addUserPlugin(ZHWebViewBridgeJS)
         contentController.addScriptMessageHandler(ZHBridgeWBScriptMessageHandler.init(bridge: bridge), name: ZHBridgeName)
-        contentController.handleRequestBlock = { (wb:UIWebView, request:URLRequest) -> Bool in
-            return bridge.handleRequest(request)
-        }
+        contentController.requestHandler = bridge
         bridge.contentController = contentController
         
         return bridge

}

class ZHWebViewDelegateProxy: NSObject, UIWebViewDelegate {
    fileprivate weak var original:UIWebViewDelegate?
    fileprivate weak var proxy:UIWebViewDelegate?

    func webView(_ webView: UIWebView, shouldStartLoadWith request: URLRequest, navigationType: UIWebViewNavigationType) -> Bool {
        if let load = proxy?.webView?(webView, shouldStartLoadWith: request, navigationType: navigationType), !load {
            return false
        }
        return original?.webView?(webView, shouldStartLoadWith: request, navigationType: navigationType) ?? true
    }
    
    func webViewDidStartLoad(_ webView: UIWebView) {
        proxy?.webViewDidStartLoad?(webView)
        original?.webViewDidStartLoad?(webView)
    }
    
    func webViewDidFinishLoad(_ webView: UIWebView) {
        proxy?.webViewDidFinishLoad?(webView)
        original?.webViewDidFinishLoad?(webView)
    }
    
    func webView(_ webView: UIWebView, didFailLoadWithError error: Error) {
        proxy?.webView?(webView, didFailLoadWithError: error)
        original?.webView?(webView, didFailLoadWithError: error)
    }
}

class ZHWebViewContentController:NSObject {
    fileprivate(set) var webView:UIWebView
    fileprivate(set) var shouldProxyDelegate = false
    fileprivate(set) var handleRequestBlock:((UIWebView, URLRequest) -> Bool)?
    fileprivate(set) weak var jsContext:JSContext?
    fileprivate var delegateProxy:ZHWebViewDelegateProxy! = ZHWebViewDelegateProxy()
    fileprivate(set) var messageHandlers:[String:Any] = [:]
    fileprivate(set) var pluginScripts = [String]()
    fileprivate var contextKVO:Int = 0
    fileprivate let jsContextPath = "documentView.webView.mainFrame.javaScriptContext"
    fileprivate let delegatePath = "delegate"
    fileprivate let jsMessageHandlersKey = "zhbridge_messageHandlers"
    private var ignoreWbDelegateKVO = false
    private var updateWBDelegateLock = NSRecursiveLock.init()
    
    
    init(webView:UIWebView, proxyDelegate:Bool = true) {
        self.webView = webView
        shouldProxyDelegate = proxyDelegate
        super.init()
        
        jsContext = webView.value(forKeyPath: jsContextPath) as? JSContext
        webView.addObserver(self, forKeyPath: jsContextPath, options: [.initial, .new], context: &contextKVO)
        
        setupProxy(with: webView)
        webView.addObserver(self, forKeyPath: delegatePath, options: [.initial, .new], context: &contextKVO)
    }
    
    deinit {
        webView.removeObserver(self, forKeyPath: jsContextPath)
        webView.removeObserver(self, forKeyPath: delegatePath)
        webView.delegate = delegateProxy.original
        delegateProxy = nil
    }
    
    override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
        guard context == &contextKVO else {
            super.observeValue(forKeyPath: keyPath, of: object, change: change, context: context)
            return
        }
        
        if keyPath == jsContextPath {
            if let context = change?[NSKeyValueChangeKey.newKey] as? JSContext , jsContext !== context {
                updateJsContext(context)
            }
        } else if keyPath == delegatePath {
            updateWebViewDelegateInKVO()
        }
    }
    
    @inline(__always) fileprivate func updateWebViewDelegate() {
        updateWBDelegateLock.lock()
        
        ignoreWbDelegateKVO = true
        if webView.delegate !== delegateProxy {
            delegateProxy.original = webView.delegate
        }
        webView.delegate = delegateProxy
        ignoreWbDelegateKVO = false
        updateWBDelegateLock.unlock()
    }
    
    fileprivate func setupProxy(with webView:UIWebView) {
        guard shouldProxyDelegate else {
            return
        }
        delegateProxy.proxy = self
        ignoreWbDelegateKVO = true
        updateWebViewDelegate()
    }
    
    fileprivate func updateWebViewDelegateInKVO() {
        guard shouldProxyDelegate, !ignoreWbDelegateKVO else {
            return
        }
        
        guard delegateProxy !== webView.delegate else {
            return
        }
        updateWebViewDelegate()
    }
    
    fileprivate func updateJsContext(_ context:JSContext) {

    }
}

open class ZHWebViewBridge: ZHRequestHandler {
    fileprivate var handlerMapper:[String: (([Any]) -> (Bool, [Any]?))] = [:]

    fileprivate(set) weak var bridge:ZHWebViewBridgeProtocol?
