Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Don't alias navigator.id #10

Merged
merged 1 commit into from

3 participants

@mnoorenberghe

The alias for fail changes the context from navigator.id to window so that doesn't work in a native DOM implementation.

@jedp
Collaborator

Crazy JS scopey trickiness. @lloyd FYI, Ben has already proposed on the dev-identity alias that, as a safeguard, we make this function and others fail if their 'this' isn't navigator.id.

@lloyd

r+

@lloyd lloyd merged commit 9404edb into mozilla:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 5, 2012
  1. @mnoorenberghe

    The alias for fail changes the context from navigator.id to window so…

    mnoorenberghe authored
    … that doesn't work in a native DOM implementation.
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 7 deletions.
  1. +3 −7 static/browserid/provision.html
View
10 static/browserid/provision.html
@@ -4,10 +4,6 @@
<script type="text/javascript" src="https://browserid.org/provisioning_api.js"></script>
<script type="text/javascript" src="/js/jquery.js"></script>
<script type="text/javascript">
-
- // an alias
- var fail = navigator.id.raiseProvisioningFailure;
-
// begin provisioning! This both gives us indicated to browserid that we're
// a well formed provisioning page and gives us the parameters of the provisioning
navigator.id.beginProvisioning(function(email, cert_duration) {
@@ -17,7 +13,7 @@
.success(function(r) {
email = email.replace('@eyedee.me', '').toLowerCase();
if (email != r.user) {
- return fail('user is not authenticated as target user');
+ return navigator.id.raiseProvisioningFailure('user is not authenticated as target user');
}
// Awesome! The user is authenticated as who we want to provision. let's
@@ -39,13 +35,13 @@
navigator.id.registerCertificate(r.cert);
},
error: function(r) {
- fail("couldn't certify key");
+ navigator.id.raiseProvisioningFailure("couldn't certify key");
}
});
});
})
.error(function() {
- fail('user is not authenticated');
+ navigator.id.raiseProvisioningFailure('user is not authenticated');
});
});
</script>
Something went wrong with that request. Please try again.