diff --git a/app/extensions/brave/content/scripts/navigator.js b/app/extensions/brave/content/scripts/navigator.js index 261485ca4a2..02bf81fe8af 100644 --- a/app/extensions/brave/content/scripts/navigator.js +++ b/app/extensions/brave/content/scripts/navigator.js @@ -12,6 +12,11 @@ chrome.webFrame.setGlobal("navigator.getBattery", function () { return new Promise((resolve, reject) => { reject(new Error('navigator.getBattery not supported.')) }) }) +// bluetooth is not currently supported +executeScript("window.Navigator.prototype.__defineGetter__('bluetooth', () => { return undefined })") +// webusb also not supported yet +executeScript("window.Navigator.prototype.__defineGetter__('usb', () => { return undefined })") + if (chrome.contentSettings.doNotTrack == 'allow') { executeScript("window.Navigator.prototype.__defineGetter__('doNotTrack', () => { return 1 })") } diff --git a/test/contents/contentLoadingTest.js b/test/contents/contentLoadingTest.js index 84906d71275..f9c637673d3 100644 --- a/test/contents/contentLoadingTest.js +++ b/test/contents/contentLoadingTest.js @@ -51,4 +51,20 @@ describe('content loading', function () { .windowByUrl(Brave.browserWindowUrl) .waitForTextValue('[data-test-id="tabTitle"]', 'fail') }) + + it('does not support bluetooth API', function * () { + const page1 = Brave.fixtureUrl('navigator.html') + yield this.app.client + .tabByIndex(0) + .url(page1) + .waitForTextValue('#bluetooth', 'undefined') + }) + + it('does not support webusb API', function * () { + const page1 = Brave.fixtureUrl('navigator.html') + yield this.app.client + .tabByIndex(0) + .url(page1) + .waitForTextValue('#webusb', 'undefined') + }) }) diff --git a/test/fixtures/navigator.html b/test/fixtures/navigator.html new file mode 100644 index 00000000000..ee1763dc795 --- /dev/null +++ b/test/fixtures/navigator.html @@ -0,0 +1,12 @@ + +