1

I have a Chrome extension that takes a userid/password and then passes it to a content script that runs in another tab to log in to that site. The content script uses jquery to programmatically update the userid and password fields and then click the login button. This worked fine until the login screen was rewritten with Ember.

Now, the login button is not active until inputs are seen in the userid/password fields. The jquery .val() function updates the fields but the app apparently has an Ember bind for change to activate the login button when both fields have text. The .val() update does not trigger the change. I have tried two approaches and can not get either to work.

  1. I added .trigger('change') but that doesn't seem to get noticed by ember. At least the login button does not become active.

  2. I tried adding Ember.View.views['emberxxxx'].set() which works in the debug console but not in my Chrome content script. I get error "TypeError: Cannot read property 'views' of undefined". I wonder if I need to define something more to get this statement to work. I do have ember.prod.js defined in JS in my manifest file, but nothing else. I am very Ember-challenged.

Any advice is appreciated!

Thanks, Doug

  • For the 2nd method to work: inject the code via ` – wOxxOm Oct 29 '15 at 18:25
  • Ah, and you don't need ember.prod.js in your extension. Just inject the script element with code that accesses Ember loaded on the webpage. – wOxxOm Oct 29 '15 at 20:38
  • Thank you! I've never had to inject code before with my simple content scripts and was clueless about needing to inject code. I used method 2 of the answer you pointed to and I was able to code either Ember.View. etc or the jquery with trigger. Both work! I guess this should be considered a duplicate to that question. – Doug Trottman Oct 31 '15 at 03:01

0 Answers0