28 March 2013 - 6:57No self for new fancy => arrow functions!

Thanks Paul for letting people know how to define JavaScript functions, the ES6 way (in Firefox 22). I’m now busy converting my anonymous functions, e.g., function(x) x*x, to the new syntax: x => x*x.

But one thing caught my eye in the spec he linked, harmony:arrow_function_syntax:

// ''=>'' has only lexical ''this'', no dynamic ''this''

This means you no longer need to bind or do the self = this dance. Both patterns are common for setting up callbacks in JavaScript.

So if your code in a method of an object used to look like either of..

addEventListener(.., function(event) {
  .. this.value ..;
}.bind(this));

or

let self = this;
addEventListener(.., function(event) {
  .. self.value ..;
});

Your code can now look like this!

addEventListener(.., event => {
  .. this.value ..;
});

Exciting stuff! :)

5 Comments | Tags: Development, Mozilla

30 October 2012 - 9:36User Privacy Contracts and the Open Web

I’ve been blogging on the Labs blog about locally analyzing Firefox data [blog.mozilla.org] and helping users share that data while keeping users in control of their privacy. One area of ideas has involved users setting terms on how the shared data can be used, such as requiring temporary use of the data and increased transparency to let the user know what parts of the data was used.

Common web pattern of users agreeing to terms

So far what I’ve described seems compatible with the Open Web because Firefox can expose access to the user’s data through a web API such as geolocation where the user confirms or denies the request. One main difference is that the site agrees to the user’s data privacy contract — perhaps through an electronic signature. But even then, this difference isn’t too foreign because this digital agreement pattern seems common on the web — except most of the time, it’s the user agreeing to the site’s terms.

One followup idea, regarding who is creating contracts, suggested a non-profit who cares about the Open Web and users’ privacy could be well suited to negotiate with web sites. Instead of having each user provide a user data privacy contract to each web site, Firefox could refer to a list of allowed domains that have already agreed to the non-profits requirements on how user data from the browser can be used. Of course Firefox would still give users control of what data is analyzed and to what detail is the data shared.

With these site-by-site contracts of agreeing to treat users’ data at a privacy level acceptable/required by the non-profit, it seems like a potential slow-but-steady way to improve the web for all parties: the site gets high quality user data, the user gets better personalized content, and Firefox protects privacy for users.

The tricky part here is that there would be a split between which web site have access to the web API: those who are contractually bound to treat users’ data correctly and those who are not. If Firefox only allowed access to web sites that have signed the contract, would this still be part of the Open Web? Is it necessary to have this as part of the Open Web? How about if general web access could be enabled through a user preference while also requiring user confirmation on a per-site basis from a scary looking dialog?

I’m sure there are plenty of other questions in this area of protecting users’ data while improving the Open Web experience. So please comment and provide your thoughts or questions!

3 Comments | Tags: Development, Facebook, Mozilla, User Data

12 October 2012 - 10:17Stickers for your online presense?

After suggesting an idea of how Firefox could help users share their interests online [blog.mozilla.org], I’ve been wondering if it’s similar to something people already do outside of a browser. I gave it some quick thoughts, and stickers seem like they might be a suitable comparison in that they’re something people can easily acquire and customize and then present to others without giving them away.

Showing things you like on something you own

People seem to have all sorts of stickers placed on things they carry around, e.g., laptops, binders, or notepads; or a mode of transportation, e.g., cars, skateboards, or bikes. Even though showing something could be thought as a statement, I would guess that people aren’t necessarily always looking to have a conversation by displaying their sticker. They’re just happy to show off something they support or care about.

This note about having a presence without actively socializing seems to overlap in some way to the “Visitors” group from a study on Identity and the Internet [blog.mozilla.org]. Not everyone wants to be social on the internet and actively produce content, so using these stickers to show off one’s interests seems like a comfortable step from being completely without an online identity.

Do you use stickers? If so, what are you showing, where are you placing them, and why do you use them? I’m curious! :)

3 Comments | Tags: Development, Labs, Mozilla

5 October 2012 - 10:56about:profile – interest categories vs demographics

Over the last few weeks, I’ve been checking out my about:profile page [addons.mozilla.org], and I’ve been pretty surprised at how accurate it can get even though it’s a simple proof of concept to initiate discussions on how Mozilla should be analyzing data in the Firefox [blog.mozilla.org].

Overall categorization and detailed/recent interests

It shares some ideas with what Margaret implemented for about:me [wiki.mozilla.org] such as processing the local data within Firefox and not sending data out of Firefox, except in about:profile, we’re trying to generate higher-level concepts such as an interest category as opposed to statistics of your browser behavior. We happened to go with some readily available domain data of ODP categories and Alexa siteinfo, and we selected some hundreds of top sites to package into the add-on. So while the reference data is not an exhaustive list, it seems to work for quite a few people I’ve shown the add-on to.

Our somewhat arbitrary choices of category interests and site demographics got me thinking about what we could do with this data in Firefox, and I seem to keep coming back to this distinction of category data actually shows what I’m interested in whereas demographics appears to create a label/characteristic that opens things up to preconceived judgements. I suppose in other words, the former is based on something I did vs the latter is something I am. (Although technically, the about:profile experiment is trying to guess at who you are based on what you did.)

I’m sure others will be able to better describe the differences between the two, but I wonder if because there appears to be a fundamental difference, we should go about presenting the data differently to the user. For example, perhaps users will be happy to explicitly give Firefox one’s demographic data whereas trying to have the user create a list of interested categories might be overwhelming.

I’m excited that we’ve released the add-on to get a conversation started because there’s so many different ways to analyze the data in Firefox, and each method can lead to interesting discussions such as this one about categories vs demographics.

No Comments | Tags: Add-on, Development, Labs, Mozilla