From d931a49e891363ee714df49cd084decbeb47ab8b Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Fri, 21 Aug 2015 18:02:58 +0800 Subject: [PATCH] Warn about removed protocol APIs --- atom/browser/api/lib/protocol.coffee | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/atom/browser/api/lib/protocol.coffee b/atom/browser/api/lib/protocol.coffee index 4a45c702..13f2a6d1 100644 --- a/atom/browser/api/lib/protocol.coffee +++ b/atom/browser/api/lib/protocol.coffee @@ -3,4 +3,22 @@ throw new Error('Can not initialize protocol module before app is ready') unless protocol = process.atomBinding('protocol').protocol +# Warn about removed APIs. +logAndThrow = (callback, message) -> + console.error message + if callback then callback(new Error(message)) else throw new Error(message) +protocol.registerProtocol = (scheme, handler, callback) -> + logAndThrow callback, + 'registerProtocol API has been replaced by the + register[File/Http/Buffer/String]Protocol API family, please + switch to the new APIs.' +protocol.isHandledProtocol = (scheme, callback) -> + logAndThrow callback, + 'isHandledProtocol API has been replaced by isProtocolHandled.' +protocol.interceptProtocol = (scheme, handler, callback) -> + logAndThrow callback, + 'interceptProtocol API has been replaced by the + intercept[File/Http/Buffer/String]Protocol API family, please + switch to the new APIs.' + module.exports = protocol -- 2.43.0