Add tests for packages with URI handlers

This commit is contained in:
Michelle Tilley
2017-10-03 13:20:48 -07:00
parent 4b67353f85
commit eb4357ce87
4 changed files with 30 additions and 4 deletions

View File

@@ -323,15 +323,15 @@ class Package
registerUrlHandler: ->
handlerConfig = @getUrlHandler()
if methodName = handlerConfig?.method
@urlHandlerSubscription = @packageManager.registerUrlHandlerForPackage @name, (url) =>
@handleUrl(url, methodName)
@urlHandlerSubscription = @packageManager.registerUrlHandlerForPackage @name, (args...) =>
@handleUrl(methodName, args)
unregisterUrlHandler: ->
@urlHandlerSubscription?.dispose()
handleUrl: (url, methodName) ->
handleUrl: (methodName, args) ->
@activate().then =>
@mainModule[methodName]?(url)
@mainModule[methodName]?.apply(@mainModule, args)
unless @mainActivated
@activateNow()