Permalink
Browse files

Fix issues in IE.

  • Loading branch information...
1 parent f1f432b commit ad8a96f55c9ab2b2b12508d422a30aa3f603e538 @satazor satazor committed Nov 28, 2012
View
@@ -3,7 +3,8 @@
"console",
"require",
"define",
- "module"
+ "module",
+ "global"
],
"browser": true,
View
@@ -99,7 +99,8 @@ define([
callerClass,
callerClassId,
toStringInstance,
- toStringConstructor;
+ toStringConstructor,
+ glob = typeof window !== 'undefined' && window.navigator && window.document ? window : global;
/**
* Clones a property in order to make them unique for the instance.
@@ -150,7 +151,7 @@ define([
}
wrapper = function () {
- if (this == null) {
+ if (this == null || this === glob) {
throw new Error('Method "' + (wrapper[$name] || 'anonymous') + '" was called with a null context (did you forget to bind?).');
}
@@ -208,7 +209,7 @@ define([
wrapper;
wrapper = function () {
- if (this == null) {
+ if (this == null || this === glob) {
throw new Error('Static method "' + (wrapper[$name] || 'anonymous') + '" was called with a null context (did you forget to bind?).');
}
@@ -103,7 +103,8 @@ define([
callerClass,
callerClassId,
toStringInstance,
- toStringConstructor;
+ toStringConstructor,
+ glob = typeof window !== 'undefined' && window.navigator && window.document ? window : global;
/**
* Clones a property in order to make them unique for the instance.
@@ -154,7 +155,7 @@ define([
}
wrapper = function () {
- if (this == null) {
+ if (this == null || this === glob) {
throw new Error('Method "' + (wrapper[$name] || 'anonymous') + '" was called with a null context (did you forget to bind?).');
}
@@ -212,7 +213,7 @@ define([
wrapper;
wrapper = function () {
- if (this == null) {
+ if (this == null || this === glob) {
throw new Error('Static method "' + (wrapper[$name] || 'anonymous') + '" was called with a null context (did you forget to bind?).');
}
@@ -1759,7 +1759,8 @@ define('Class',[
callerClass,
callerClassId,
toStringInstance,
- toStringConstructor;
+ toStringConstructor,
+ glob = typeof window !== 'undefined' && window.navigator && window.document ? window : global;
/**
* Clones a property in order to make them unique for the instance.
@@ -1810,7 +1811,7 @@ define('Class',[
}
wrapper = function () {
- if (this == null) {
+ if (this == null || this === glob) {
throw new Error('Method "' + (wrapper[$name] || 'anonymous') + '" was called with a null context (did you forget to bind?).');
}
@@ -1868,7 +1869,7 @@ define('Class',[
wrapper;
wrapper = function () {
- if (this == null) {
+ if (this == null || this === glob) {
throw new Error('Static method "' + (wrapper[$name] || 'anonymous') + '" was called with a null context (did you forget to bind?).');
}
View
@@ -115,7 +115,8 @@ define([
callerClass,
callerClassId,
toStringInstance,
- toStringConstructor;
+ toStringConstructor,
+ glob = typeof window !== 'undefined' && window.navigator && window.document ? window : global;
//>>includeEnd('strict');
//>>excludeStart('strict', pragmas.strict);
var createClass,
@@ -242,7 +243,7 @@ define([
}
wrapper = function () {
- if (this == null) {
+ if (this == null || this === glob) {
throw new Error('Method "' + (wrapper[$name] || 'anonymous') + '" was called with a null context (did you forget to bind?).');
}
@@ -300,7 +301,7 @@ define([
wrapper;
wrapper = function () {
- if (this == null) {
+ if (this == null || this === glob) {
throw new Error('Static method "' + (wrapper[$name] || 'anonymous') + '" was called with a null context (did you forget to bind?).');
}
View
@@ -703,23 +703,32 @@ define(global.modules, function (
expect(function () {
SomeClass.foo = 'bar';
- }).to.throwException('not extensible');
+ if (!SomeClass.foo) {
+ throw new Error('not extensible');
+ }
+ }).to.throwException(/not extensible/);
expect(function () {
SomeClass.prototype.foo = 'bar';
- }).to.throwException('not extensible');
+ if (!SomeClass.prototype.foo) {
+ throw new Error('not extensible');
+ }
+ }).to.throwException(/not extensible/);
expect(function () {
someClass.bar = 'foo';
- }).to.throwException('not extensible');
+ if (!someClass.bar) {
+ throw new Error('not extensible');
+ }
+ }).to.throwException(/not extensible/);
expect(function () {
someClass.test = function () {};
- }).to.throwException('not extensible');
+ }).to.throwException(/(not extensible|cannot set)/i);
expect(function () {
SomeClass.staticFunc = function () {};
- }).to.throwException('not extensible');
+ }).to.throwException(/(not extensible|cannot set)/i);
});
@@ -736,7 +745,10 @@ define(global.modules, function (
expect(function () {
SomeClass.foo = 'bar';
- }).to.throwException('not extensible');
+ if (!SomeClass.foo) {
+ throw new Error('not extensible');
+ }
+ }).to.throwException(/not extensible/);
OtherClass.foo = 'bar';
@@ -541,21 +541,30 @@ define(global.modules, function (Class, AbstractClass, Interface, FinalClass, in
}, true), someClass = new SomeClass();
expect(function () {
SomeClass.foo = 'bar';
- }).to.throwException('not extensible');
+ if (!SomeClass.foo) {
+ throw new Error('not extensible');
+ }
+ }).to.throwException(/not extensible/);
expect(function () {
SomeClass.prototype.foo = 'bar';
- }).to.throwException('not extensible');
+ if (!SomeClass.prototype.foo) {
+ throw new Error('not extensible');
+ }
+ }).to.throwException(/not extensible/);
expect(function () {
someClass.bar = 'foo';
- }).to.throwException('not extensible');
+ if (!someClass.bar) {
+ throw new Error('not extensible');
+ }
+ }).to.throwException(/not extensible/);
expect(function () {
someClass.test = function () {
};
- }).to.throwException('not extensible');
+ }).to.throwException(/(not extensible|cannot set)/i);
expect(function () {
SomeClass.staticFunc = function () {
};
- }).to.throwException('not extensible');
+ }).to.throwException(/(not extensible|cannot set)/i);
});
it('should read the default value', function () {
options.locked = true;
@@ -568,7 +577,10 @@ define(global.modules, function (Class, AbstractClass, Interface, FinalClass, in
}, true);
expect(function () {
SomeClass.foo = 'bar';
- }).to.throwException('not extensible');
+ if (!SomeClass.foo) {
+ throw new Error('not extensible');
+ }
+ }).to.throwException(/not extensible/);
OtherClass.foo = 'bar';
expect(OtherClass.foo).to.equal('bar');
});

0 comments on commit ad8a96f

Please sign in to comment.