Skip to content

Commit

Permalink
Use separate var statements.
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Oct 15, 2014
1 parent dcfb10d commit a8715cb
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions test/worker-test.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
describe('Worker', function (undefined) {
var workerErrorEventToError = function (errorEvent) {
var errorText = "Error in Worker";
if (errorEvent.filename !== undefined) {
errorText += " " + errorEvent.filename;
}
if (errorEvent.lineno !== undefined) {
errorText += "(" + errorEvent.lineno + ")";
}
if (errorEvent.message !== undefined) {
errorText += ": " + errorEvent.message;
}
return new Error(errorText);
},
canRunWorkerTestInCurrentContext = function () {
var workerConstructorExists = typeof Worker !== 'undefined',
locationPropertyExists = typeof location !== 'undefined',
runningOnFileUriScheme = locationPropertyExists && location.protocol === 'file:';
var errorText = "Error in Worker";
if (errorEvent.filename !== undefined) {
errorText += " " + errorEvent.filename;
}
if (errorEvent.lineno !== undefined) {
errorText += "(" + errorEvent.lineno + ")";
}
if (errorEvent.message !== undefined) {
errorText += ": " + errorEvent.message;
}
return new Error(errorText);
};
var canRunWorkerTestInCurrentContext = function () {
var workerConstructorExists = typeof Worker !== 'undefined';
var locationPropertyExists = typeof location !== 'undefined';
var runningOnFileUriScheme = locationPropertyExists && location.protocol === 'file:';

// The Worker constructor doesn't exist in some older browsers nor does it exist in non-browser contexts like Node.
// Additionally some browsers (at least Chrome) don't allow Workers over file URIs.
// To prevent false negative test failures in the cases where Workers are unavailable for either of those reasons
// we skip this test.
return workerConstructorExists && !runningOnFileUriScheme;
};
// The Worker constructor doesn't exist in some older browsers nor does it exist in non-browser contexts like Node.
// Additionally some browsers (at least Chrome) don't allow Workers over file URIs.
// To prevent false negative test failures in the cases where Workers are unavailable for either of those reasons
// we skip this test.
return workerConstructorExists && !runningOnFileUriScheme;
};

if (canRunWorkerTestInCurrentContext()) {
it('can import es6-shim', function (done) {
Expand Down

0 comments on commit a8715cb

Please sign in to comment.