-
Notifications
You must be signed in to change notification settings - Fork 883
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disabling getBattery | bluetooth | credential.get/store | navigator.u…
…sb apis
- Loading branch information
Showing
9 changed files
with
177 additions
and
0 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
chromium_src/third_party/blink/render/modules/battery/navigator_battery.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#include "third_party/blink/renderer/modules/battery/navigator_battery.h" | ||
|
||
#include "gin/converter.h" | ||
#include "third_party/blink/renderer/platform/bindings/v8_per_isolate_data.h" | ||
#include "net/proxy_resolution/proxy_resolver_v8.h" | ||
|
||
namespace blink { | ||
ScriptPromise NavigatorBattery::getBattery(ScriptState* script_state, | ||
Navigator& navigator) { | ||
v8::Isolate* isolate = V8PerIsolateData::MainThreadIsolate(); | ||
return blink::ScriptPromise::Reject(script_state, | ||
v8::Exception::TypeError(gin::StringToV8(isolate, "This api has been disabled."))); | ||
} | ||
} // namespace blink |
11 changes: 11 additions & 0 deletions
11
chromium_src/third_party/blink/render/modules/bluetooth/navigator_bluetooth.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#include "third_party/blink/renderer/modules/bluetooth/navigator_bluetooth.h" | ||
|
||
namespace blink { | ||
Bluetooth* NavigatorBluetooth::bluetooth(Navigator& navigator) { | ||
return NULL; | ||
} | ||
|
||
Bluetooth* NavigatorBluetooth::bluetooth() { | ||
return NULL; | ||
} | ||
} // namespace blink |
24 changes: 24 additions & 0 deletions
24
...ium_src/third_party/blink/render/modules/credentialmanager/brave_credentials_container.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#include "third_party/blink/renderer/modules/credentialmanager/credentials_container.h" | ||
|
||
#include "gin/converter.h" | ||
#include "third_party/blink/renderer/bindings/core/v8/script_promise.h" | ||
#include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h" | ||
#include "third_party/blink/renderer/platform/bindings/v8_per_isolate_data.h" | ||
|
||
namespace blink { | ||
|
||
ScriptPromise CredentialsContainer::get( | ||
ScriptState* script_state, | ||
const CredentialRequestOptions& options) { | ||
v8::Isolate* isolate = V8PerIsolateData::MainThreadIsolate(); | ||
return ScriptPromise::Reject(script_state, v8::Exception::TypeError(gin::StringToV8(isolate, | ||
"This api has been disabled."))); | ||
} | ||
|
||
ScriptPromise CredentialsContainer::store(ScriptState* script_state, | ||
Credential* credential) { | ||
v8::Isolate* isolate = V8PerIsolateData::MainThreadIsolate(); | ||
return ScriptPromise::Reject(script_state, v8::Exception::TypeError(gin::StringToV8(isolate, | ||
"This api has been disabled."))); | ||
} | ||
} // namespace blink |
14 changes: 14 additions & 0 deletions
14
patches/third_party-blink-renderer-modules-battery-BUILD.gn.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
diff --git a/third_party/blink/renderer/modules/battery/BUILD.gn b/third_party/blink/renderer/modules/battery/BUILD.gn | ||
index 64c9513c20a1bfa765c26de56acc8ee2c16a98f5..a4cbd9ac777e35f9e108beca8b8ebe7f6cc2cbcf 100644 | ||
--- a/third_party/blink/renderer/modules/battery/BUILD.gn | ||
+++ b/third_party/blink/renderer/modules/battery/BUILD.gn | ||
@@ -11,8 +11,8 @@ blink_modules_sources("battery") { | ||
"battery_manager.cc", | ||
"battery_manager.h", | ||
"battery_status.h", | ||
- "navigator_battery.cc", | ||
"navigator_battery.h", | ||
+ "//brave/chromium_src/third_party/blink/render/modules/battery/navigator_battery.cc", | ||
] | ||
|
||
deps = [ |
13 changes: 13 additions & 0 deletions
13
patches/third_party-blink-renderer-modules-bluetooth-BUILD.gn.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
diff --git a/third_party/blink/renderer/modules/bluetooth/BUILD.gn b/third_party/blink/renderer/modules/bluetooth/BUILD.gn | ||
index 86525ded88b86ee42b6f01cfe19231dec5cedbb5..cc7fec1705f7034f732bafc10290da72b88dbea7 100644 | ||
--- a/third_party/blink/renderer/modules/bluetooth/BUILD.gn | ||
+++ b/third_party/blink/renderer/modules/bluetooth/BUILD.gn | ||
@@ -28,7 +28,7 @@ blink_modules_sources("bluetooth") { | ||
"bluetooth_remote_gatt_utils.h", | ||
"bluetooth_uuid.cc", | ||
"bluetooth_uuid.h", | ||
- "navigator_bluetooth.cc", | ||
+ "//brave/chromium_src/third_party/blink/render/modules/bluetooth/navigator_bluetooth.cc", | ||
"navigator_bluetooth.h", | ||
] | ||
|
12 changes: 12 additions & 0 deletions
12
patches/third_party-blink-renderer-modules-credentialmanager-BUILD.gn.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
diff --git a/third_party/blink/renderer/modules/credentialmanager/BUILD.gn b/third_party/blink/renderer/modules/credentialmanager/BUILD.gn | ||
index 18f143a1e7c1a8bfb9ecf8d2b2702195c0065488..d530694993fa2082f8d463f111f57543da237613 100644 | ||
--- a/third_party/blink/renderer/modules/credentialmanager/BUILD.gn | ||
+++ b/third_party/blink/renderer/modules/credentialmanager/BUILD.gn | ||
@@ -19,6 +19,7 @@ blink_modules_sources("credentialmanager") { | ||
"credential_manager_type_converters.cc", | ||
"credential_manager_type_converters.h", | ||
"credentials_container.cc", | ||
+ "//brave/chromium_src/third_party/blink/render/modules/credentialmanager/brave_credentials_container.cc", | ||
"credentials_container.h", | ||
"federated_credential.cc", | ||
"federated_credential.h", |
83 changes: 83 additions & 0 deletions
83
patches/third_party-blink-renderer-modules-credentialmanager-credentials_container.cc.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
diff --git a/third_party/blink/renderer/modules/credentialmanager/credentials_container.cc b/third_party/blink/renderer/modules/credentialmanager/credentials_container.cc | ||
index 004fca6cd7d6a1fbba472d7ead99f18659d5e402..3d225496d5f00d049808aab8d754d46569f84ff0 100644 | ||
--- a/third_party/blink/renderer/modules/credentialmanager/credentials_container.cc | ||
+++ b/third_party/blink/renderer/modules/credentialmanager/credentials_container.cc | ||
@@ -214,6 +214,7 @@ bool CheckPublicKeySecurityRequirements(ScriptPromiseResolver* resolver, | ||
return true; | ||
} | ||
|
||
+#if defined(MUON_CHROMIUM_BUILD) | ||
// Checks if the icon URL of |credential| is an a-priori authenticated URL. | ||
// https://w3c.github.io/webappsec-credential-management/#dom-credentialuserdata-iconurl | ||
bool IsIconURLEmptyOrSecure(const Credential* credential) { | ||
@@ -235,6 +236,7 @@ bool IsIconURLEmptyOrSecure(const Credential* credential) { | ||
url.ProtocolIsData() || | ||
SecurityOrigin::Create(url)->IsPotentiallyTrustworthy(); | ||
} | ||
+#endif | ||
|
||
DOMException* CredentialManagerErrorToDOMException( | ||
CredentialManagerError reason) { | ||
@@ -303,12 +305,14 @@ DOMException* CredentialManagerErrorToDOMException( | ||
return nullptr; | ||
} | ||
|
||
+#if defined(MUON_CHROMIUM_BUILD) | ||
void OnStoreComplete(std::unique_ptr<ScopedPromiseResolver> scoped_resolver, | ||
RequiredOriginType required_origin_type) { | ||
auto* resolver = scoped_resolver->Release(); | ||
AssertSecurityRequirementsBeforeResponse(resolver, required_origin_type); | ||
resolver->Resolve(); | ||
} | ||
+#endif | ||
|
||
void OnPreventSilentAccessComplete( | ||
std::unique_ptr<ScopedPromiseResolver> scoped_resolver) { | ||
@@ -319,6 +323,7 @@ void OnPreventSilentAccessComplete( | ||
resolver->Resolve(); | ||
} | ||
|
||
+#if defined(MUON_CHROMIUM_BUILD) | ||
void OnGetComplete(std::unique_ptr<ScopedPromiseResolver> scoped_resolver, | ||
RequiredOriginType required_origin_type, | ||
CredentialManagerError error, | ||
@@ -336,6 +341,7 @@ void OnGetComplete(std::unique_ptr<ScopedPromiseResolver> scoped_resolver, | ||
resolver->Reject(CredentialManagerErrorToDOMException(error)); | ||
} | ||
} | ||
+#endif | ||
|
||
DOMArrayBuffer* VectorToDOMArrayBuffer(const Vector<uint8_t> buffer) { | ||
return DOMArrayBuffer::Create(static_cast<const void*>(buffer.data()), | ||
@@ -375,6 +381,7 @@ void OnMakePublicKeyCredentialComplete( | ||
} | ||
} | ||
|
||
+#if defined(MUON_CHROMIUM_BUILD) | ||
void OnGetAssertionComplete( | ||
std::unique_ptr<ScopedPromiseResolver> scoped_resolver, | ||
AuthenticatorStatus status, | ||
@@ -415,6 +422,7 @@ void OnGetAssertionComplete( | ||
mojo::ConvertTo<CredentialManagerError>(status))); | ||
} | ||
} | ||
+#endif | ||
|
||
} // namespace | ||
|
||
@@ -424,6 +432,7 @@ CredentialsContainer* CredentialsContainer::Create() { | ||
|
||
CredentialsContainer::CredentialsContainer() = default; | ||
|
||
+#if defined(MUON_CHROMIUM_BUILD) | ||
ScriptPromise CredentialsContainer::get( | ||
ScriptState* script_state, | ||
const CredentialRequestOptions& options) { | ||
@@ -549,6 +558,7 @@ ScriptPromise CredentialsContainer::store(ScriptState* script_state, | ||
|
||
return promise; | ||
} | ||
+#endif | ||
|
||
ScriptPromise CredentialsContainer::create( | ||
ScriptState* script_state, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters