Index: Source/bindings/core/v8/PrivateScriptRunner.js |
diff --git a/Source/bindings/core/v8/PrivateScriptRunner.js b/Source/bindings/core/v8/PrivateScriptRunner.js |
index 88b9bed2f82cd428c1828486d87aedf4fbf51950..a9713204548bb24d6e0d12ebeeea8ce2610fe991 100644 |
--- a/Source/bindings/core/v8/PrivateScriptRunner.js |
+++ b/Source/bindings/core/v8/PrivateScriptRunner.js |
@@ -4,70 +4,8 @@ |
"use strict"; |
-// This list must be in sync with the enum in ExceptionCode.h. The order matters. |
-var domExceptions = [ |
- "IndexSizeError", |
- "HierarchyRequestError", |
- "WrongDocumentError", |
- "InvalidCharacterError", |
- "NoModificationAllowedError", |
- "NotFoundError", |
- "NotSupportedError", |
- "InUseAttributeError", // Historical. Only used in setAttributeNode etc which have been removed from the DOM specs. |
- |
- // Introduced in DOM Level 2: |
- "InvalidStateError", |
- "SyntaxError", |
- "InvalidModificationError", |
- "NamespaceError", |
- "InvalidAccessError", |
- |
- // Introduced in DOM Level 3: |
- "TypeMismatchError", // Historical; use TypeError instead |
- |
- // XMLHttpRequest extension: |
- "SecurityError", |
- |
- // Others introduced in HTML5: |
- "NetworkError", |
- "AbortError", |
- "URLMismatchError", |
- "QuotaExceededError", |
- "TimeoutError", |
- "InvalidNodeTypeError", |
- "DataCloneError", |
- |
- // These are IDB-specific. |
- "UnknownError", |
- "ConstraintError", |
- "DataError", |
- "TransactionInactiveError", |
- "ReadOnlyError", |
- "VersionError", |
- |
- // File system |
- "NotReadableError", |
- "EncodingError", |
- "PathExistsError", |
- |
- // SQL |
- "SQLDatabaseError", // Naming conflict with DatabaseError class. |
- |
- // Web Crypto |
- "OperationError", |
-]; |
- |
-var domExceptionCode = {}; |
var installedClasses = {}; |
- |
-function init() |
-{ |
- var code = 1; |
- domExceptions.forEach(function (exception) { |
- domExceptionCode[exception] = code; |
- code++; |
- }); |
-} |
+var domExceptionCode = {}; |
function DOMExceptionInPrivateScript(code, message) |
{ |
@@ -76,18 +14,77 @@ function DOMExceptionInPrivateScript(code, message) |
this.name = "DOMExceptionInPrivateScript"; |
} |
-function privateScriptClass() |
-{ |
-} |
- |
function installClass(className, implementation) |
{ |
+ function privateScriptClass() |
+ { |
+ } |
+ |
if (!(className in installedClasses)) |
installedClasses[className] = new privateScriptClass(); |
- implementation(window, installedClasses[className]); |
+ implementation(installedClasses[className]); |
} |
-init(); |
+(function (global) { |
+ // This list must be in sync with the enum in ExceptionCode.h. The order matters. |
+ var domExceptions = [ |
+ "IndexSizeError", |
+ "HierarchyRequestError", |
+ "WrongDocumentError", |
+ "InvalidCharacterError", |
+ "NoModificationAllowedError", |
+ "NotFoundError", |
+ "NotSupportedError", |
+ "InUseAttributeError", // Historical. Only used in setAttributeNode etc which have been removed from the DOM specs. |
+ |
+ // Introduced in DOM Level 2: |
+ "InvalidStateError", |
+ "SyntaxError", |
+ "InvalidModificationError", |
+ "NamespaceError", |
+ "InvalidAccessError", |
+ |
+ // Introduced in DOM Level 3: |
+ "TypeMismatchError", // Historical; use TypeError instead |
+ |
+ // XMLHttpRequest extension: |
+ "SecurityError", |
+ |
+ // Others introduced in HTML5: |
+ "NetworkError", |
+ "AbortError", |
+ "URLMismatchError", |
+ "QuotaExceededError", |
+ "TimeoutError", |
+ "InvalidNodeTypeError", |
+ "DataCloneError", |
+ |
+ // These are IDB-specific. |
+ "UnknownError", |
+ "ConstraintError", |
+ "DataError", |
+ "TransactionInactiveError", |
+ "ReadOnlyError", |
+ "VersionError", |
+ |
+ // File system |
+ "NotReadableError", |
+ "EncodingError", |
+ "PathExistsError", |
+ |
+ // SQL |
+ "SQLDatabaseError", // Naming conflict with DatabaseError class. |
+ |
+ // Web Crypto |
+ "OperationError", |
+ ]; |
+ |
+ var code = 1; |
+ domExceptions.forEach(function (exception) { |
+ global.domExceptionCode[exception] = code; |
+ code++; |
+ }); |
+})(window); |
// This line must be the last statement of this JS file. |
// A parenthesis is needed, because the caller of this script (PrivateScriptRunner.cpp) |