blackberry / BB10-WebWorks-Framework

The BB10 WebWorks Framework is packaged within an application BAR file to run on a BB10 device (or simulator)
60 stars 34 forks source link

Move all WebWorks APIs to qnx.callExtension method and away from URI and executeJavaScript #271

Open nukulb opened 12 years ago

nukulb commented 12 years ago

@cdelcol @rcruz @jeffheifetz @pagey

This is not a decision but a discussion forum right now.

Obviously changes will be all over but we should see a significant improvement. As we move to obvious

@jeffheifetz as we move to letting people create webview we will have to now or eventually allow people to setGeometery on it for animation.

@pagey is doing a sensors API and should see improvement

@rcruz - you might need to separate your RPC module after all.

jeffheifetz commented 12 years ago

What about our requirement to have URI based APIs?

rcruz commented 12 years ago

If we do qnx.callExtensionMethod using the RPC module, we still need to use executeJavaScript for rpc to function correctly. If using that is fine, then it is just creating a reusable channel for webworks APIs

nukulb commented 12 years ago

@rcruz @jeffheifetz - @bryanhiggins will be working on this soon.

@bryanhiggins here are the list of things that will have to be done -

  1. Allow qnx call extension methods on the client webview, should be just setting a property
  2. Move Webworks.js to use qnx.callextension method instead of xhr. Basically must change over
  3. The logic for getting all the extensions initially can stay over in xhr but logic for calling each extension must move to qnx.callextension. I would prefer if this changed as well but this has smaller runtime impact.
  4. On the controller you must listen to the qnx call extension method and simply move the logic from networkresourcerequested to this new listener. @rcruz has a rpc module in the web platform that you can use but you might have to copy over some code into the webworks.js
  5. Make sure you do not interfere with the overlay webview as its using the same logic to communicate

@rcruz @jeffheifetz - have I missed anything?

rcruz commented 12 years ago

Looks complete to me. There is an example of using the rpc channel in webplatform repo on the ui-elements branch under /framework/test/integration/rpc.

From: Nukul Bhasin [mailto:notifications@github.com] Sent: Tuesday, October 02, 2012 06:01 AM To: blackberry/BB10-WebWorks-Framework BB10-WebWorks-Framework@noreply.github.com Cc: Rowell Cruz Subject: Re: [BB10-WebWorks-Framework] Move all WebWorks APIs to qnx.callExtension method and away from URI and executeJavaScript (#271)

@rcruzhttps://github.com/rcruz @jeffheifetzhttps://github.com/jeffheifetz - @bryanhigginshttps://github.com/bryanhiggins will be working on this soon.

@bryanhigginshttps://github.com/bryanhiggins here are the list of things that will have to be done -

  1. Allow qnx call extension methods on the client webview, should be just setting a property
  2. Move Webworks.js to use qnx.callextension method instead of xhr. Basically must change over
  3. The logic for getting all the extensions initially can stay over in xhr but logic for calling each extension must move to qnx.callextension. I would prefer if this changed as well but this has smaller runtime impact.
  4. On the controller you must listen to the qnx call extension method and simply move the logic from networkresourcerequested to this new listener. @rcruzhttps://github.com/rcruz has a rpc module in the web platform that you can use but you might have to copy over some code into the webworks.js
  5. Make sure you do not interfere with the overlay webview as its using the same logic to communicate

@rcruzhttps://github.com/rcruz @jeffheifetzhttps://github.com/jeffheifetz - have I missed anything?

— Reply to this email directly or view it on GitHubhttps://github.com/blackberry/BB10-WebWorks-Framework/issues/271#issuecomment-9066043.


This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful.

jeffheifetz commented 12 years ago

Most of the logic in lib/request and lib/server are related to faking an XHR request. In the new world these can likely be combined and much of the complicated logic can be removed. We no longer really need to mock requests and responses.

nukulb commented 12 years ago

good point.

bryanhiggins commented 12 years ago

I've looked into this and came up with the following implementation plan. Given my limited exposure to the codebase, I would appreciate any feedback.

1. Expose qnx object on the client webview:    
- add _webviewObj.allowQnxObject = true to lib/webview.js
2. Publish RPC channel in controllerWebView.js
- controller.publishRemoteFunction
     - "client.remoteFunctionCall"
     - args[0] = URI
     - args[1] = params
- invoke action on default plugin or extension (logic from server.js)
3. Switch client from XHR to RPC call
- in window-webworks.js update RemoteFunctionCall
- use window.qnx.getController().remoteExec
- handle make calls and getting extensions
4. Clean up request/response mocking
- remove server.js
- strip request.js down to just whitelisting
- remove getURIPrefix from utils.js
rcruz commented 12 years ago

Looks good Bryan. Additionally you'll want to run _webviewObj.allowRpc = true.

From: bryanhiggins [mailto:notifications@github.com] Sent: Wednesday, October 03, 2012 05:09 PM To: blackberry/BB10-WebWorks-Framework BB10-WebWorks-Framework@noreply.github.com Cc: Rowell Cruz Subject: Re: [BB10-WebWorks-Framework] Move all WebWorks APIs to qnx.callExtension method and away from URI and executeJavaScript (#271)

I've looked into this and came up with the following implementation plan. Given my limited exposure to the codebase, I would appreciate any feedback.

  1. Expose qnx object on the client webview:
  2. add _webviewObj.allowQnxObject = true to lib/webview.js
  3. Publish RPC channel in controllerWebView.js
  4. controller.publishRemoteFunction
    • "client.remoteFunctionCall"
    • args[0] = URI
    • args[1] = params
  5. invoke action on default plugin or extension (logic from server.js)
  6. Switch client from XHR to RPC call
  7. in window-webworks.js update RemoteFunctionCall
  8. use window.qnx.getController().remoteExec
  9. handle make calls and getting extensions
  10. Clean up request/response mocking
  11. remove server.js
  12. strip request.js down to just whitelisting
  13. remove getURIPrefix from utils.js

— Reply to this email directly or view it on GitHubhttps://github.com/blackberry/BB10-WebWorks-Framework/issues/271#issuecomment-9122291.


This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful.

jeffheifetz commented 12 years ago

Bryan

lib/server (in most cases) is invoked using the exec method which means it gets routed to lib/default. Removing lib/server means you will need to reorganize things to route there on your own. One interesting fact is that lib/default returns HTML based errors that may no longer make sense in a non-xhr world.