Explore Ebooks
Categories
Explore Audiobooks
Categories
Explore Magazines
Categories
Explore Documents
Categories
YANIV GOLAN
Version
Primary Author(s)
Description of Version
Date Completed
Internal Shared with AOL Toolbar team Integrated comments following review with Steve Rice Created following conclusions from 1st prototype created by the Toolbar team Added LoadDelay Added Includes (white list) Added implementation checklist Renamed control file to config.xml Clarified host-id format Added secret key exchange between host and client Added method for the script to notify the host about request to remove the JASPAX code.
Jan 19, 2009 Jan 25, 2009 Feb 4, 2009 May 3, 2009
75292669.doc
Page 2
TABLE
OF
CONTENTS
1. ABOUT THIS DOCUMENT................................................................................................................................................5 2. TERMINOLOGY...............................................................................................................................................................6 3. JASPAX HOST - FLOW DIAGRAM.................................................................................................................................7 4. WHY SO MANY TYPES OF SCRIPTS?...................................................................................................................................8 5. CONFIGURING JASPAX................................................................................................................................................9 5.1 OVERVIEW...................................................................................................................................................................9 5.2 FORMAT......................................................................................................................................................................9
8. LOAD & ACTIVATE JASPAX DOMAIN SCRIPT.............................................................................................................14 8.1 LOADING...................................................................................................................................................................14 8.2 ACTIVATING..............................................................................................................................................................14 8.3 JASPAX_DOMAINSCRIPT_INIT........................................................................................................................................14
75292669.doc
Page 3
75292669.doc
Page 4
75292669.doc
Page 5
2. TERMINOLOGY
JASPAX Host: Browser-resident code (toolbar, plugin) which is responsible for identifying, loading and injecting a specific JavaScript code into the web page currently viewed in the browser. JASPAX Domain Script: A JavaScript file which implements a domain-specific functionality. Page Script Multiplexer: A specific Domain Script which given the current page URL and configuration data identifies, loads and activates a Page Script. Page Script: JavaScript code which is relevant to a specific set of pages in the domain, as indicated by the associated regular expressions.
75292669.doc
Page 6
Kill switch on ?
Toolbar.exe
Do nothing
Domain Script 1
Domain Script 2
Page Script 1
Page Script 3
75292669.doc
Page 7
4. WHY
We would like the host code to be as simple and reliable as possible, and to contain as little applicationspecific logic as possible, to enable a wide range of applications. At the same time, it is desired to allow the host to be able to cache the script files effectively. Hence, the only type of scripts the host needs to deal with is Domain Scripts. Conceptually there is 1 domain script for each domain. However: If multiple domains require the same functionality, a single domain script file can be served to the host for multiple different domain script requests. If a domain requires substantially different functionality for different parts of the site, the domain script can implement logic to identify the type of functionality based on some criteria, such as the current page URL, and load additional more specialized scripts. All domains requesting a domain-specific domain script will actually be served the same script (i.e. the Page Script Multiplexer). This single shared domain script implements logic which, based on the current page URL and a RegExp-driven configuration data, identifies and loads additional scripts (i.e. Page Scripts) which provide functionality which is relevant for specific groups of pages in the domain.
Conceivably we could have hard-coded the RegExp-driven logic into the host. The cons of this approach would be: Host implementation more complex and less reliable Hard-coded RegExp logic would require host update to use different logic if needed (say, geodriven logic, promotions and sponsorships, etc)
75292669.doc
Page 8
5. CONFIGURING JASPAX
5.1 Overview
It is important that a host will be able to configure the JASPAX-related aspects of the client remotely. It is also important to allow a specific web site to control a subset of the JASPAX-related functionalities of the client. These remote configuration capabilities are enabled using the JASPAX configuration file. This file is stored in a central location accessible to all hosts (a.k.a Master Config). In addition, each web site can publish a website-specific configuration file that configures the relevant subset (a.k.a Domain-Specific Config).
5.2
Format
75292669.doc
Page 9
5.3
Locations
5.3.1 Master Config
75292669.doc
Page 10
6.2
If the Master Config file does not exist at the location specific in Section 5.3.1, it should be assumed that the JASPAX functionality should be disabled for all sites and user agents.
6.3
Logic
1. If cached Master Config data does not exist or expired, try to retrieve it. Otherwise use the cached data; 2. If failed to retrieve, cache this fact and disable! 3. Compare current host id with the excluded host ids in the Master Config data; if matches, disable! 4. Compare current user agent with excluded user agents in the Master Config data; if matches, disable!
75292669.doc
Page 11
5. Compare current url with excluded urls list in the Master Config data; if matches, disable! 6. If cached Domain-Specific Config data for current domain does not exist or expired, try to retrieve it. Otherwise use the cached data; 7. If failed to retrieve, cache this fact. 8. Compare current host id with the excluded host ids in the Domain-Specific Config data; if matches, disable! 9. Compare current user agent with the excluded user agents in the Domain-Specific Config data; if matches, disable! 10. Compare current url with the excluded urls list in the Domain-Specific Config data; if matches, disable! Note that the easiest and fastest way to disable JASPAX functionality at once for all sites (hence completely disabling the plugins functionality for all running toolbars) is to simply delete the Master Config file. The actual functional disable will happen only once all cached copies of the config files expire. Hence, the files should be marked as non-cachable, and the host should cache the data for a relatively short time.
75292669.doc
Page 12
7. LOCATE
7.1
THE
Overview
A JASPAX Domain Script is a per-site JavaScript file which is injected into the current page by a host. Only one JASPAX Domain Script is supported per site & host. The Domain Script JavaScript may be cached by the host for the time period indicated by the relevant HTTP headers. However, if cached, the activation logic must still be followed per each page.
7.2
Location
The host should retrieve the Domain Script from the following URL:
https://jaspax.aol.com/v1/domainscripts/get?<domain-name>.js
Where domain-name is the domain part of the URL for which the Domain Script is being loaded. For example, if viewing https://business.blogs.cnn.com/2008/12/11/what-if-interest-rate-cuts-arent-enough/ The domain name is business.blogs.cnn.com And the Domain Script JavaScript file URL is
https://jaspax.aol.com/v1/domainscripts/get?business.blogs.cnn.com.js
7.3
Redirects
Hosts must respect and follow and HTTP 30x redirects it may receive as a response to a request to a domain script.
7.4
SSL Certificates
Hosts must validate the SSL certificate returned by jaspax.aol.com to prevent man-in-the-middile attacks.
75292669.doc
Page 13
8.2
Activating
hostId, domain, userAgent,
Every JASPAX Domain Script must implement, at the minimum, the following function: function jaspax_domainScript_init(secret, secsSincePageLoad)
This function must be invoked by the host exactly once for each page. The host should call this function at a point in the page lifetime which is equivalent to DOMContentLoaded. The host must not call this function earlier in the page lifetime than the equivalent of DOMContentLoaded. Implementation note: a cross-browser implementation of the Mozilla-specific DOMContentLoaded can be found here.
8.3
secret
jaspax_domainScript_init
8.3.1 Inputs
String; a secret value exchanged between the host and the loaded script; both host and script should keep this value in memory. The script will use this value in any callback function provided by the host, and the host should reject any callback that does not include the correct key. This will help preventing unauthorized JavaScript code in the page from invoking host callback functions.
hostId
String; a unique id for the host (e.g. aol;mapquestion;1.0) This value should uniquely identify a specific host. It must be specific enough to allow for host-specific configuration, and it must be readable to 3rd parties as well. The exact format of this string is up to the host developers; it is their responsibility to ensure its uniqueness and readability. All hosts IDs issued by AOL developers must conform to the following format: aol;host-name;host-version e.g. aol;mapquest_toolbar;1.0
domain
The domain name of the page for which the script is being loaded. This is identical to the value passed in section 7.2 Location
75292669.doc
Page 14
userAgent secsSincePageLoad
The browsers user agent string value The elapsed time (in seconds) since the page started loading (e.g. the user navigated to the page URL). If unknown to the host, value should be -1. This value will be used by some implementations to calculate a delay before showing a specific user interface.
8.3.2 Returns
True if successful. If false, this plugin should be disabled for the entire browser session as if it appeared on the exclude list.
75292669.doc
Page 15
9. DISABLING JASPAX
UI
The client UI displayed by the injected code should provide a user interface that will let the user turn off the JASPAX-provided experience completely in a specific machine (for the logged in user). To enable this, the host should expose a window.external function with the following signature: jaspax_host_disableAll(secret) The function receives a single parameter secret, which should be the same value passed earlier by the host to the jaspax_domainScript_init function. If the values dont match, the host should ignore the call. If the value do match, the host should store in the context of the logged in user on the machine an indication that the JASPAX code should not be loaded in the future. The client is responsible for removing the user experience for the current page after calling the host.
75292669.doc
Page 16
Example:
<PageSets> <PageSet>
75292669.doc
Page 17
<FriendlyName>CNN World News Popbar UI</FriendlyName> <Triggers> <Include>http://.*news/.cnn/.com.*</Include> <Include>http://.*hot/.cnn/.com.*</Include > </Triggers> <ScriptURL>http://jaspax.yedda.com/scripts/ps/cnn/news-hot-1.js</ScriptURL> <ScriptInitJSCallback>yedda_cnn_worldnews_init</ScriptInitJSCallback> <Parameters> <name1>value1</name1> <name2>value2</name2> <name3>value3</name2> </Parameters> </PageSet> </PageSets>
Note that the JASPAX Domain Script implementing the PSM can be automatically generated from this data. ScriptURL is used to load the Page Script. The returned script is compatible with JSON-based insertions into the page. If multiple page scripts match the current URL, all matching page scripts should be loaded and activated. ScriptInitJSCallback is the name of a JavaScript function implemented by the script specified by ScriptURL which is used to initialize the script.
The init function will be called exactly once for each Page Script per page. It will be called by the domain script jaspax_domainScript_init function. Note that while it is guaranteed that the DOM is available at this point (e.g. DOMContentLoaded), it is not guaranteed that all resources were loaded (e.g. not body.onload). hostId: string, unique id for the host (e.g aol;toolbar;mapquest;1.0) userAgent: The user agent url: The URL of the current page params: Array with the specified parameters and their values. returns: true if successful. If false, this plugin should be disabled for the entire browser session as if it appeared on the exclude list.
75292669.doc
Page 18
75292669.doc
Page 19