![]() |
Making JavaScript Safe for Advertising.JavaScript, the programming language of the web browser, is not a secure language. Any script in a page has intimate access to all of the information and relationships of the page. ADsafe makes it safe to put guest code (such as third party scripted advertising or widgets) on any web page. ADsafe defines a subset of JavaScript that is powerful enough to allow guest code to perform valuable interactions, while at the same time preventing malicious or accidental damage or intrusion. The ADsafe subset can be verified mechanically by tools like JSLint so that no human inspection is necessary to review guest code for safety. The ADsafe subset also enforces good coding practices, increasing the likelihood that guest code will run correctly. The ADsafe subset blocks a script from accessing any global
variables or from directly accessing the Document Object Model or any
of its elements. Instead, ADsafe gives the script access to an
ADsafe does not modify scripts. It will not make scripts bigger or slower or alter their behavior. ADsafe makes it possible to quickly and reliably determine that script is safe for placement on a site's pages. How ADsafe Works.ADsafe removes features from JavaScript that are either unsafe or grant uncontrolled access to unsafe components or that diminsh code quality. The removed features include
All other features of the language, including the methods of the standard
types, are available without limitation. ADsafe provides in place
of the excluded features an |
var ADSAFE = function () {
var error = function () {
throw {
name: "ADsafe",
message: "ADsafe violation."
};
};
var reject = function (object, name) {
| |
|
The services provided through In order for a module to be passed by ADsafe, it must make use of
no global variables except the | |
(function () {
/*
Define here the variables and functions of the module.
Use the ADSAFE object to access the DOM and to register
for events and other services.
*/
})();
| |
RestrictionsAll files and components must be encoded in UTF-8 and be properly identified as such. Untrusted code will be able to indirectly call the |
|