Skip to content
This repository has been archived by the owner on Dec 27, 2023. It is now read-only.

Make Injectable Apps fail passively when they fail #19

Open
smcgregor opened this issue Mar 16, 2013 · 4 comments
Open

Make Injectable Apps fail passively when they fail #19

smcgregor opened this issue Mar 16, 2013 · 4 comments

Comments

@smcgregor
Copy link
Member

The content script currently injects an application regardless of whether the content returns status 200. Future versions should not change the User Experience for links that don't return content for injection. The injectable apps should decide whether they want to be displayed.

@smcgregor
Copy link
Member Author

I think the proper way to do this is to allow the injected iframe to ask the content script that injected it to:

  • Show the injected iframe (hide the link original link)
  • Destroy the injected iframe (remove the iframe from the DOM and show the original link)

To maintain consistency with how it is currently implemented, all links should temporarily show themselves while they are loading, but the injected iframe could then choose to destroy itself if it doesn't get a good status from the server or fails to decrypt.

@smcgregor
Copy link
Member Author

Doing this properly will take a few implementation steps, the most challenging of which is figuring out how to get messages from the iframe to the content script. Since we already send a resize message to the content script, you should look at where the privly.js file sends and receives resize messages.

  1. Modify privly.js's resize code to accept serialized JSON content. See JSON.stringify and JSON.parse().
  2. Modify host_page_integration.js to send JSON instead of the current CSV format.
  3. Change the resize command to be in JSON format with {privly:{resize:10}} could represent a command to the privly.js script to resize the iframe to 10 pixels.
  4. Add functions to the host_page_integration.js script for showInjectedIframe and destroyInjectedIframe. These will both use the new JSON message format to tell the privly.js file to take the requested action.
  5. Modify the privly.js file to take the requested action after examining the JSON message.
  6. Add unit test coverage.
  7. Add Selenium test coverage.

@bhavul
Copy link
Contributor

bhavul commented Mar 1, 2015

@smcgregor quick question. In the point #3 above {privly:{resize:10}} should represent the script to resize the iframe to 10px. is 'privly' the name of the iframe? I'm trying for {frameId : {resize:height}}
But, after JSON stringify it gets converted to {"frameId" : {"resize" : 41}} instead of {ifrm0 : {"resize" : 41}}

@bhavul
Copy link
Contributor

bhavul commented Mar 1, 2015

@smcgregor Nevermind. @irdan helped me. It's sorted out.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants