| Index: chrome/browser/resources/gaia_auth/saml_injected.js
|
| diff --git a/chrome/browser/resources/gaia_auth/saml_injected.js b/chrome/browser/resources/gaia_auth/saml_injected.js
|
| index f79c62649293a13ab79900937ea9c284d611445d..6c3d1c0dff0f60352e5781026d63683306d494f8 100644
|
| --- a/chrome/browser/resources/gaia_auth/saml_injected.js
|
| +++ b/chrome/browser/resources/gaia_auth/saml_injected.js
|
| @@ -15,8 +15,7 @@
|
| */
|
|
|
| (function() {
|
| - function APICallForwarder() {
|
| - }
|
| + function APICallForwarder() {}
|
|
|
| /**
|
| * The credential passing API is used by sending messages to the SAML page's
|
| @@ -34,15 +33,14 @@
|
| */
|
| init: function(channel) {
|
| this.channel_ = channel;
|
| - this.channel_.registerMessage('apiResponse',
|
| - this.onAPIResponse_.bind(this));
|
| + this.channel_.registerMessage(
|
| + 'apiResponse', this.onAPIResponse_.bind(this));
|
|
|
| window.addEventListener('message', this.onMessage_.bind(this));
|
| },
|
|
|
| onMessage_: function(event) {
|
| - if (event.source != window ||
|
| - typeof event.data != 'object' ||
|
| + if (event.source != window || typeof event.data != 'object' ||
|
| !event.data.hasOwnProperty('type') ||
|
| event.data.type != 'gaia_saml_api') {
|
| return;
|
| @@ -53,8 +51,8 @@
|
|
|
| onAPIResponse_: function(msg) {
|
| // Forward API responses to the SAML page.
|
| - window.postMessage({type: 'gaia_saml_api_reply', response: msg.response},
|
| - '/');
|
| + window.postMessage(
|
| + {type: 'gaia_saml_api_reply', response: msg.response}, '/');
|
| }
|
| };
|
|
|
| @@ -62,8 +60,7 @@
|
| * A class to scrape password from type=password input elements under a given
|
| * docRoot and send them back via a Channel.
|
| */
|
| - function PasswordInputScraper() {
|
| - }
|
| + function PasswordInputScraper() {}
|
|
|
| PasswordInputScraper.prototype = {
|
| // URL of the page.
|
| @@ -102,21 +99,20 @@
|
| this.passwordFieldsObserver = new MutationObserver(function(mutations) {
|
| mutations.forEach(function(mutation) {
|
| Array.prototype.forEach.call(
|
| - mutation.addedNodes,
|
| - function(addedNode) {
|
| - if (addedNode.nodeType != Node.ELEMENT_NODE)
|
| - return;
|
| -
|
| - if (addedNode.matches('input[type=password]')) {
|
| - this.trackPasswordField(addedNode);
|
| - } else {
|
| - this.findAndTrackChildren(addedNode);
|
| - }
|
| - }.bind(this));
|
| + mutation.addedNodes, function(addedNode) {
|
| + if (addedNode.nodeType != Node.ELEMENT_NODE)
|
| + return;
|
| +
|
| + if (addedNode.matches('input[type=password]')) {
|
| + this.trackPasswordField(addedNode);
|
| + } else {
|
| + this.findAndTrackChildren(addedNode);
|
| + }
|
| + }.bind(this));
|
| }.bind(this));
|
| }.bind(this));
|
| - this.passwordFieldsObserver.observe(docRoot,
|
| - {subtree: true, childList: true});
|
| + this.passwordFieldsObserver.observe(
|
| + docRoot, {subtree: true, childList: true});
|
| },
|
|
|
| /**
|
| @@ -164,13 +160,10 @@
|
| // Use an invalid char for URL as delimiter to concatenate page url,
|
| // password field index and id to construct a unique ID for the password
|
| // field.
|
| - var passwordId = this.pageURL_.split('#')[0].split('?')[0] +
|
| - '|' + index + '|' + fieldId;
|
| - this.channel_.send({
|
| - name: 'updatePassword',
|
| - id: passwordId,
|
| - password: newValue
|
| - });
|
| + var passwordId = this.pageURL_.split('#')[0].split('?')[0] + '|' + index +
|
| + '|' + fieldId;
|
| + this.channel_.send(
|
| + {name: 'updatePassword', id: passwordId, password: newValue});
|
| },
|
|
|
| /**
|
| @@ -210,8 +203,8 @@
|
|
|
| var channel = Channel.create();
|
| channel.connect('injected');
|
| - channel.sendWithCallback({name: 'getSAMLFlag'},
|
| - onGetSAMLFlag.bind(undefined, channel));
|
| + channel.sendWithCallback(
|
| + {name: 'getSAMLFlag'}, onGetSAMLFlag.bind(undefined, channel));
|
|
|
| var apiCallForwarder = new APICallForwarder();
|
| apiCallForwarder.init(channel);
|
|
|