Skip to content

Commit 0af0b72

Browse files
authored
Merge pull request #282 from smartdevicelink/bugfix/set-rpc-notification-range-limit
setRpcNotificationListeners only accepts notification RPCs
2 parents 7ba9337 + f357f60 commit 0af0b72

7 files changed

Lines changed: 43 additions & 9 deletions

File tree

examples/js/hello-sdl/SDL.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/node/hello-sdl-tcp/SDL.min.js

Lines changed: 10 additions & 1 deletion
Large diffs are not rendered by default.

examples/node/hello-sdl/SDL.min.js

Lines changed: 10 additions & 1 deletion
Large diffs are not rendered by default.

examples/webengine/hello-sdl/SDL.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/js/dist/SDL.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/js/src/manager/LifecycleConfig.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,13 @@ class LifecycleConfig {
437437
* @returns {LifecycleConfig} - A reference to this instance to support method chaining.
438438
*/
439439
setRpcNotificationListeners (listeners) {
440+
// only allow notifications to be used to keep consistency with Java APIs and with the method's name
441+
for (const key in listeners) {
442+
const keyNumber = Number(key); // coerce to Number from String
443+
if (! (keyNumber >= 0x8000 && keyNumber <= 0xFFFF)) {
444+
throw new Error(`Passed in FunctionID ${keyNumber} not within notification range ${0x8000} - ${0xFFFF}`);
445+
}
446+
}
440447
this._onRpcNotificationListeners = listeners;
441448
return this;
442449
}

lib/node/dist/SDL.min.js

Lines changed: 10 additions & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)