Skip to content

Commit 069dc52

Browse files
committed
Avoid throwing of plain JS strings. NFC
Replaced with `assert`, `abort` or `throw new Error` accordingly. We almost never want to be throwing plain values because we don't end up with a stack trace in that case.
1 parent 4803d1b commit 069dc52

File tree

75 files changed

+338
-342
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+338
-342
lines changed

src/cpuprofiler.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,7 @@ var emscriptenCpuProfiler = {
655655
case 9: glCtx[f] = (a1, a2, a3, a4, a5, a6, a7, a8, a9) => { this.enterSection(section); var ret = glCtx[realf](a1, a2, a3, a4, a5, a6, a7, a8, a9); this.endSection(section); return ret; }; break;
656656
case 10: glCtx[f] = (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) => { this.enterSection(section); var ret = glCtx[realf](a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); this.endSection(section); return ret; }; break;
657657
case 11: glCtx[f] = (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) => { this.enterSection(section); var ret = glCtx[realf](a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); this.endSection(section); return ret; }; break;
658-
default: throw 'hookWebGL failed! Unexpected length ' + glCtx[realf].length;
658+
default: throw new Error('hookWebGL failed! Unexpected length ' + glCtx[realf].length);
659659
}
660660
},
661661

src/lib/libaddfunction.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ addToLibrary({
159159
if (!(err instanceof RangeError)) {
160160
throw err;
161161
}
162-
throw 'Unable to grow wasm table. Set ALLOW_TABLE_GROWTH.';
162+
abort('Unable to grow wasm table. Set ALLOW_TABLE_GROWTH.');
163163
}
164164
#endif
165165
},

src/lib/libasync.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -664,19 +664,19 @@ addToLibrary({
664664
},
665665
#else // ASYNCIFY
666666
emscripten_sleep: () => {
667-
throw 'Please compile your program with async support in order to use asynchronous operations like emscripten_sleep';
667+
throw new Error('Please compile your program with async support in order to use asynchronous operations like emscripten_sleep');
668668
},
669669
emscripten_wget: (url, file) => {
670-
throw 'Please compile your program with async support in order to use asynchronous operations like emscripten_wget';
670+
throw new Error('Please compile your program with async support in order to use asynchronous operations like emscripten_wget');
671671
},
672672
emscripten_wget_data: (url, pbuffer, pnum, perror) => {
673-
throw 'Please compile your program with async support in order to use asynchronous operations like emscripten_wget_data';
673+
throw new Error('Please compile your program with async support in order to use asynchronous operations like emscripten_wget_data');
674674
},
675675
emscripten_scan_registers: (func) => {
676-
throw 'Please compile your program with async support in order to use asynchronous operations like emscripten_scan_registers';
676+
throw new Error('Please compile your program with async support in order to use asynchronous operations like emscripten_scan_registers');
677677
},
678678
emscripten_fiber_swap: (oldFiber, newFiber) => {
679-
throw 'Please compile your program with async support in order to use asynchronous operations like emscripten_fiber_swap';
679+
throw new Error('Please compile your program with async support in order to use asynchronous operations like emscripten_fiber_swap');
680680
},
681681
#endif // ASYNCIFY
682682
});

src/lib/libbrowser.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -374,11 +374,11 @@ var LibraryBrowser = {
374374
delta *= 80;
375375
break;
376376
default:
377-
throw 'unrecognized mouse wheel delta mode: ' + event.deltaMode;
377+
throw new Error('unrecognized mouse wheel delta mode: ' + event.deltaMode);
378378
}
379379
break;
380380
default:
381-
throw 'unrecognized mouse wheel event: ' + event.type;
381+
throw new Error('unrecognized mouse wheel event: ' + event.type);
382382
}
383383
return delta;
384384
},
@@ -804,7 +804,7 @@ var LibraryBrowser = {
804804
#if BUILD_AS_WORKER
805805
emscripten_worker_respond_provisionally__proxy: 'sync',
806806
emscripten_worker_respond_provisionally: (data, size) => {
807-
if (workerResponded) throw 'already responded with final response!';
807+
if (workerResponded) throw new Error('already responded with final response!');
808808
var transferObject = {
809809
'callbackId': workerCallbackId,
810810
'finalResponse': false,
@@ -819,7 +819,7 @@ var LibraryBrowser = {
819819

820820
emscripten_worker_respond__proxy: 'sync',
821821
emscripten_worker_respond: (data, size) => {
822-
if (workerResponded) throw 'already responded with final response!';
822+
if (workerResponded) throw new Error('already responded with final response!');
823823
workerResponded = true;
824824
var transferObject = {
825825
'callbackId': workerCallbackId,

src/lib/libc_preprocessor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ addToLibrary({
204204
}
205205
// else a number:
206206
#if ASSERTIONS
207-
if (tokens[i] == ')') throw 'Parsing failure, mismatched parentheses in parsing!' + tokens.toString();
207+
if (tokens[i] == ')') throw new Error('Parsing failure, mismatched parentheses in parsing!' + tokens.toString());
208208
assert(operatorAndPriority == -1);
209209
#endif
210210
var num = Number(tokens[i]);

src/lib/libcore.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1438,7 +1438,7 @@ addToLibrary({
14381438
if (fullret) return fullret;
14391439
return cache[name] = stringToNewUTF8(ret);
14401440
#else
1441-
throw 'You must build with -sRETAIN_COMPILER_SETTINGS for getCompilerSetting or emscripten_get_compiler_setting to work';
1441+
throw new Error('You must build with -sRETAIN_COMPILER_SETTINGS for getCompilerSetting or emscripten_get_compiler_setting to work');
14421442
#endif
14431443
},
14441444

src/lib/libfs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1825,7 +1825,7 @@ FS.staticInit();`;
18251825
}
18261826

18271827
if (typeof XMLHttpRequest != 'undefined') {
1828-
if (!ENVIRONMENT_IS_WORKER) throw 'Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc';
1828+
if (!ENVIRONMENT_IS_WORKER) throw new Error('Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc');
18291829
var lazyArray = new LazyUint8Array();
18301830
var properties = { isDevice: false, contents: lazyArray };
18311831
} else {

src/lib/libglemu.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ var LibraryGLEmulation = {
592592
dbg(`Info: ${JSON.stringify(GL.shaderInfos[shader])}`);
593593
dbg(`Original source: ${GL.shaderOriginalSources[shader]}`);
594594
dbg(`Source: ${GL.shaderSources[shader]}`);
595-
throw 'Shader compilation halt';
595+
abort('Shader compilation halt');
596596
}
597597
#endif
598598
};
@@ -3062,7 +3062,7 @@ var LibraryGLEmulation = {
30623062
emulatedElementArrayBuffer = true;
30633063
}
30643064
} else if (GLImmediate.mode > 6) { // above GL_TRIANGLE_FAN are the non-GL ES modes
3065-
if (GLImmediate.mode != 7) throw 'unsupported immediate mode ' + GLImmediate.mode; // GL_QUADS
3065+
if (GLImmediate.mode != 7) throw new Error('unsupported immediate mode ' + GLImmediate.mode); // GL_QUADS
30663066
// GLImmediate.firstVertex is the first vertex we want. Quad indexes are
30673067
// in the pattern 0 1 2, 0 2 3, 4 5 6, 4 6 7, so we need to look at
30683068
// index firstVertex * 1.5 to see it. Then since indexes are 2 bytes
@@ -3218,7 +3218,7 @@ var LibraryGLEmulation = {
32183218
glTexCoord2fv: (v) =>
32193219
_glTexCoord2i({{{ makeGetValue('v', '0', 'float') }}}, {{{ makeGetValue('v', '4', 'float') }}}),
32203220

3221-
glTexCoord4f: () => { throw 'glTexCoord4f: TODO' },
3221+
glTexCoord4f: () => { abort('glTexCoord4f: TODO') },
32223222

32233223
glColor4f: (r, g, b, a) => {
32243224
r = Math.max(Math.min(r, 1), 0);
@@ -3750,9 +3750,9 @@ var LibraryGLEmulation = {
37503750
},
37513751
glRotatef: 'glRotated',
37523752

3753-
glDrawBuffer: () => { throw 'glDrawBuffer: TODO' },
3753+
glDrawBuffer: () => { abort('glDrawBuffer: TODO') },
37543754
#if MAX_WEBGL_VERSION < 2
3755-
glReadBuffer: () => { throw 'glReadBuffer: TODO' },
3755+
glReadBuffer: () => { abort('glReadBuffer: TODO') },
37563756
#endif
37573757

37583758
glClipPlane: (pname, param) => {
@@ -3800,7 +3800,7 @@ var LibraryGLEmulation = {
38003800
// multiply position with current modelviewmatrix
38013801
GLImmediate.matrixLib.mat4.multiplyVec4(GLImmediate.matrix[0], GLEmulation.lightPosition[lightId]);
38023802
} else {
3803-
throw 'glLightfv: TODO: ' + pname;
3803+
abort('glLightfv: TODO: ' + pname);
38043804
}
38053805
}
38063806
},
@@ -3809,7 +3809,7 @@ var LibraryGLEmulation = {
38093809
if (pname == 0x0B52) { // GL_LIGHT_MODEL_TWO_SIDE
38103810
GLEmulation.lightModelTwoSide = (param != 0) ? true : false;
38113811
} else {
3812-
throw 'glLightModelf: TODO: ' + pname;
3812+
abort('glLightModelf: TODO: ' + pname);
38133813
}
38143814
},
38153815

@@ -3820,12 +3820,12 @@ var LibraryGLEmulation = {
38203820
GLEmulation.lightModelAmbient[2] = {{{ makeGetValue('param', '8', 'float') }}};
38213821
GLEmulation.lightModelAmbient[3] = {{{ makeGetValue('param', '12', 'float') }}};
38223822
} else {
3823-
throw 'glLightModelfv: TODO: ' + pname;
3823+
abort('glLightModelfv: TODO: ' + pname);
38243824
}
38253825
},
38263826

38273827
glMaterialfv: (face, pname, param) => {
3828-
if ((face != 0x0404) && (face != 0x0408)) { throw 'glMaterialfv: TODO' + face; } // only GL_FRONT and GL_FRONT_AND_BACK supported
3828+
if ((face != 0x0404) && (face != 0x0408)) { abort('glMaterialfv: TODO' + face); } // only GL_FRONT and GL_FRONT_AND_BACK supported
38293829

38303830
if (pname == 0x1200) { // GL_AMBIENT
38313831
GLEmulation.materialAmbient[0] = {{{ makeGetValue('param', '0', 'float') }}};
@@ -3845,22 +3845,22 @@ var LibraryGLEmulation = {
38453845
} else if (pname == 0x1601) { // GL_SHININESS
38463846
GLEmulation.materialShininess[0] = {{{ makeGetValue('param', '0', 'float') }}};
38473847
} else {
3848-
throw 'glMaterialfv: TODO: ' + pname;
3848+
abort('glMaterialfv: TODO: ' + pname);
38493849
}
38503850
},
38513851

3852-
glTexGeni: (coord, pname, param) => { throw 'glTexGeni: TODO' },
3853-
glTexGenfv: (coord, pname, param) => { throw 'glTexGenfv: TODO' },
3852+
glTexGeni: (coord, pname, param) => abort('glTexGeni: TODO'),
3853+
glTexGenfv: (coord, pname, param) => abort('glTexGenfv: TODO'),
38543854
glTexEnvi: (target, pname, params) => warnOnce('glTexEnvi: TODO'),
38553855
glTexEnvf: (target, pname, params) => warnOnce('glTexEnvf: TODO'),
38563856
glTexEnvfv: (target, pname, params) => warnOnce('glTexEnvfv: TODO'),
38573857

3858-
glGetTexEnviv: (target, pname, param) => { throw 'GL emulation not initialized!'; },
3859-
glGetTexEnvfv: (target, pname, param) => { throw 'GL emulation not initialized!'; },
3858+
glGetTexEnviv: (target, pname, param) => abort('GL emulation not initialized!'),
3859+
glGetTexEnvfv: (target, pname, param) => abort('GL emulation not initialized!'),
38603860

3861-
glTexImage1D: (target, level, internalformat, width, border, format, type, data) => { throw 'glTexImage1D: TODO' },
3862-
glTexCoord3f: (target, level, internalformat, width, border, format, type, data) => { throw 'glTexCoord3f: TODO' },
3863-
glGetTexLevelParameteriv: (target, level, pname, params) => { throw 'glGetTexLevelParameteriv: TODO' },
3861+
glTexImage1D: (target, level, internalformat, width, border, format, type, data) => abort('glTexImage1D: TODO'),
3862+
glTexCoord3f: (target, level, internalformat, width, border, format, type, data) => abort('glTexCoord3f: TODO'),
3863+
glGetTexLevelParameteriv: (target, level, pname, params) => abort('glGetTexLevelParameteriv: TODO'),
38643864

38653865
glShadeModel: () => warnOnce('TODO: glShadeModel'),
38663866

src/lib/libglfw.js

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,7 +1074,7 @@ var LibraryGLFW = {
10741074
for (i = 0; i < GLFW.windows.length && GLFW.windows[i] !== null; i++) {
10751075
// no-op
10761076
}
1077-
if (i > 0) throw "glfwCreateWindow only supports one window at time currently";
1077+
if (i > 0) abort("glfwCreateWindow only supports one window at time currently");
10781078

10791079
// id for window
10801080
id = i + 1;
@@ -1580,9 +1580,9 @@ var LibraryGLFW = {
15801580
// TODO: implement
15811581
glfwSetGamma: (monitor, gamma) => 0,
15821582

1583-
glfwGetGammaRamp: (monitor) => { throw "glfwGetGammaRamp not implemented."; },
1583+
glfwGetGammaRamp: (monitor) => abort("glfwGetGammaRamp not implemented."),
15841584

1585-
glfwSetGammaRamp: (monitor, ramp) => { throw "glfwSetGammaRamp not implemented."; },
1585+
glfwSetGammaRamp: (monitor, ramp) => abort("glfwSetGammaRamp not implemented."),
15861586

15871587
glfwDefaultWindowHints: () => GLFW.defaultWindowHints(),
15881588

@@ -1738,15 +1738,15 @@ var LibraryGLFW = {
17381738

17391739
glfwSetWindowAspectRatio: (winid, numer, denom) => 0,
17401740

1741-
glfwGetWindowFrameSize: (winid, left, top, right, bottom) => { throw "glfwGetWindowFrameSize not implemented."; },
1741+
glfwGetWindowFrameSize: (winid, left, top, right, bottom) => abort("glfwGetWindowFrameSize not implemented."),
17421742

17431743
glfwMaximizeWindow: (winid) => 0,
17441744

17451745
glfwFocusWindow: (winid) => 0,
17461746

17471747
glfwRequestWindowAttention: (winid) => 0, // maybe do window.focus()?
17481748

1749-
glfwSetWindowMonitor: (winid, monitor, xpos, ypos, width, height, refreshRate) => { throw "glfwSetWindowMonitor not implemented."; },
1749+
glfwSetWindowMonitor: (winid, monitor, xpos, ypos, width, height, refreshRate) => abort("glfwSetWindowMonitor not implemented."),
17501750

17511751
glfwCreateCursor: (image, xhot, yhot) => 0,
17521752

@@ -1797,9 +1797,9 @@ var LibraryGLFW = {
17971797

17981798
glfwGetKey: (winid, key) => GLFW.getKey(winid, key),
17991799

1800-
glfwGetKeyName: (key, scancode) => { throw "glfwGetKeyName not implemented."; },
1800+
glfwGetKeyName: (key, scancode) => abort("glfwGetKeyName not implemented."),
18011801

1802-
glfwGetKeyScancode: (key) => { throw "glfwGetKeyScancode not implemented."; },
1802+
glfwGetKeyScancode: (key) => abort("glfwGetKeyScancode not implemented."),
18031803

18041804
glfwGetMouseButton: (winid, button) => GLFW.getMouseButton(winid, button),
18051805

@@ -1812,7 +1812,7 @@ var LibraryGLFW = {
18121812

18131813
glfwSetCharCallback: (winid, cbfun) => GLFW.setCharCallback(winid, cbfun),
18141814

1815-
glfwSetCharModsCallback: (winid, cbfun) => { throw "glfwSetCharModsCallback not implemented."; },
1815+
glfwSetCharModsCallback: (winid, cbfun) => abort("glfwSetCharModsCallback not implemented."),
18161816

18171817
glfwSetMouseButtonCallback: (winid, cbfun) => GLFW.setMouseButtonCallback(winid, cbfun),
18181818

@@ -1832,11 +1832,11 @@ var LibraryGLFW = {
18321832

18331833
glfwSetDropCallback: (winid, cbfun) => GLFW.setDropCallback(winid, cbfun),
18341834

1835-
glfwGetTimerValue: () => { throw "glfwGetTimerValue is not implemented."; },
1835+
glfwGetTimerValue: () => abort("glfwGetTimerValue is not implemented."),
18361836

1837-
glfwGetTimerFrequency: () => { throw "glfwGetTimerFrequency is not implemented."; },
1837+
glfwGetTimerFrequency: () => abort("glfwGetTimerFrequency is not implemented."),
18381838

1839-
glfwGetRequiredInstanceExtensions: (count) => { throw "glfwGetRequiredInstanceExtensions is not implemented."; },
1839+
glfwGetRequiredInstanceExtensions: (count) => abort("glfwGetRequiredInstanceExtensions is not implemented."),
18401840

18411841
glfwJoystickPresent: (joy) => {
18421842
GLFW.refreshJoysticks();
@@ -1870,7 +1870,7 @@ var LibraryGLFW = {
18701870
return state.buttons;
18711871
},
18721872

1873-
glfwGetJoystickHats: (joy, count) => { throw "glfwGetJoystickHats is not implemented"; },
1873+
glfwGetJoystickHats: (joy, count) => abort("glfwGetJoystickHats is not implemented"),
18741874

18751875
glfwGetJoystickName: (joy) => {
18761876
if (GLFW.joys[joy]) {
@@ -1879,13 +1879,13 @@ var LibraryGLFW = {
18791879
return 0;
18801880
},
18811881

1882-
glfwGetJoystickGUID: (jid) => { throw "glfwGetJoystickGUID not implemented"; },
1882+
glfwGetJoystickGUID: (jid) => abort("glfwGetJoystickGUID not implemented"),
18831883

1884-
glfwSetJoystickUserPointer: (jid, ptr) => { throw "glfwSetJoystickUserPointer not implemented"; },
1884+
glfwSetJoystickUserPointer: (jid, ptr) => abort("glfwSetJoystickUserPointer not implemented"),
18851885

1886-
glfwGetJoystickUserPointer: (jid) => { throw "glfwGetJoystickUserPointer not implemented"; },
1886+
glfwGetJoystickUserPointer: (jid) => abort("glfwGetJoystickUserPointer not implemented"),
18871887

1888-
glfwJoystickIsGamepad: (jid) => { throw "glfwJoystickIsGamepad not implemented"; },
1888+
glfwJoystickIsGamepad: (jid) => abort("glfwJoystickIsGamepad not implemented"),
18891889

18901890
glfwSetJoystickCallback: (cbfun) => GLFW.setJoystickCallback(cbfun),
18911891

@@ -1991,7 +1991,7 @@ var LibraryGLFW = {
19911991
GLFW.setScrollCallback(GLFW.active.id, cbfun);
19921992
},
19931993

1994-
glfwGetDesktopMode: (mode) => { throw "glfwGetDesktopMode is not implemented."; },
1994+
glfwGetDesktopMode: (mode) => abort("glfwGetDesktopMode is not implemented."),
19951995

19961996
glfwSleep__deps: ['sleep'],
19971997
glfwSleep: (time) => _sleep(time),
@@ -2025,37 +2025,37 @@ var LibraryGLFW = {
20252025
// One single thread
20262026
glfwGetThreadID: () => 0,
20272027

2028-
glfwCreateMutex: () => { throw "glfwCreateMutex is not implemented."; },
2028+
glfwCreateMutex: () => abort("glfwCreateMutex is not implemented."),
20292029

2030-
glfwDestroyMutex: (mutex) => { throw "glfwDestroyMutex is not implemented."; },
2030+
glfwDestroyMutex: (mutex) => abort("glfwDestroyMutex is not implemented."),
20312031

2032-
glfwLockMutex: (mutex) => { throw "glfwLockMutex is not implemented."; },
2032+
glfwLockMutex: (mutex) => abort("glfwLockMutex is not implemented."),
20332033

2034-
glfwUnlockMutex: (mutex) => { throw "glfwUnlockMutex is not implemented."; },
2034+
glfwUnlockMutex: (mutex) => abort("glfwUnlockMutex is not implemented."),
20352035

2036-
glfwCreateCond: () => { throw "glfwCreateCond is not implemented."; },
2036+
glfwCreateCond: () => abort("glfwCreateCond is not implemented."),
20372037

2038-
glfwDestroyCond: (cond) => { throw "glfwDestroyCond is not implemented."; },
2038+
glfwDestroyCond: (cond) => abort("glfwDestroyCond is not implemented."),
20392039

2040-
glfwWaitCond: (cond, mutex, timeout) => { throw "glfwWaitCond is not implemented."; },
2040+
glfwWaitCond: (cond, mutex, timeout) => abort("glfwWaitCond is not implemented."),
20412041

2042-
glfwSignalCond: (cond) => { throw "glfwSignalCond is not implemented."; },
2042+
glfwSignalCond: (cond) => abort("glfwSignalCond is not implemented."),
20432043

2044-
glfwBroadcastCond: (cond) => { throw "glfwBroadcastCond is not implemented."; },
2044+
glfwBroadcastCond: (cond) => abort("glfwBroadcastCond is not implemented."),
20452045

20462046
glfwGetNumberOfProcessors: () => 1, // Threads are disabled anyway…
20472047

2048-
glfwReadImage: (name, img, flags) => { throw "glfwReadImage is not implemented."; },
2048+
glfwReadImage: (name, img, flags) => abort("glfwReadImage is not implemented."),
20492049

2050-
glfwReadMemoryImage: (data, size, img, flags) => { throw "glfwReadMemoryImage is not implemented."; },
2050+
glfwReadMemoryImage: (data, size, img, flags) => abort("glfwReadMemoryImage is not implemented."),
20512051

2052-
glfwFreeImage: (img) => { throw "glfwFreeImage is not implemented."; },
2052+
glfwFreeImage: (img) => abort("glfwFreeImage is not implemented."),
20532053

2054-
glfwLoadTexture2D: (name, flags) => { throw "glfwLoadTexture2D is not implemented."; },
2054+
glfwLoadTexture2D: (name, flags) => abort("glfwLoadTexture2D is not implemented."),
20552055

2056-
glfwLoadMemoryTexture2D: (data, size, flags) => { throw "glfwLoadMemoryTexture2D is not implemented."; },
2056+
glfwLoadMemoryTexture2D: (data, size, flags) => abort("glfwLoadMemoryTexture2D is not implemented."),
20572057

2058-
glfwLoadTextureImage2D: (img, flags) => { throw "glfwLoadTextureImage2D is not implemented."; },
2058+
glfwLoadTextureImage2D: (img, flags) => abort("glfwLoadTextureImage2D is not implemented."),
20592059
#endif // GLFW2
20602060
};
20612061

src/lib/libglut.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ var LibraryGLUT = {
422422
return GLctx.getContextAttributes().antialias ? 1 : 0;
423423

424424
default:
425-
throw "glutGet(" + type + ") not implemented yet";
425+
abort("glutGet(" + type + ") not implemented yet");
426426
}
427427
},
428428

@@ -562,7 +562,7 @@ var LibraryGLUT = {
562562
cursorStyle = 'none';
563563
break;
564564
default:
565-
throw "glutSetCursor: Unknown cursor type: " + cursor;
565+
abort("glutSetCursor: Unknown cursor type: " + cursor);
566566
}
567567
Browser.getCanvas().style.cursor = cursorStyle;
568568
},

0 commit comments

Comments
 (0)