-
Notifications
You must be signed in to change notification settings - Fork 902
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #776 from brave/user_gesture
Issue 542: Request user confirmation before opening all external applications
- Loading branch information
Showing
3 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
chromium_src/chrome/browser/external_protocol/external_protocol_handler_unittest.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,26 @@ | ||
#include "chrome/browser/external_protocol/external_protocol_handler.h" | ||
|
||
#include "chrome/test/base/testing_browser_process.h" | ||
#include "chrome/test/base/testing_profile.h" | ||
#include "content/public/test/test_browser_thread_bundle.h" | ||
#include "testing/gtest/include/gtest/gtest.h" | ||
|
||
class ExternalProtocolHandlerTest : public testing::Test { | ||
protected: | ||
void SetUp() override { | ||
profile_.reset(new TestingProfile()); | ||
} | ||
|
||
void TearDown() override { | ||
TestingBrowserProcess::GetGlobal()->SetLocalState(nullptr); | ||
} | ||
|
||
content::TestBrowserThreadBundle test_browser_thread_bundle_; | ||
std::unique_ptr<TestingProfile> profile_; | ||
}; | ||
|
||
TEST_F(ExternalProtocolHandlerTest, TestGetBlockStateMailto) { | ||
ExternalProtocolHandler::BlockState block_state = | ||
ExternalProtocolHandler::GetBlockState("mailto", profile_.get()); | ||
EXPECT_EQ(ExternalProtocolHandler::UNKNOWN, block_state); | ||
} |
13 changes: 13 additions & 0 deletions
13
patches/chrome-browser-external_protocol-external_protocol_handler.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,13 @@ | ||
diff --git a/chrome/browser/external_protocol/external_protocol_handler.cc b/chrome/browser/external_protocol/external_protocol_handler.cc | ||
index 3779df927d069657d0e244703739811c8eed2d6f..422f10a87fdb1b80495e314ec685a3347f32dc28 100644 | ||
--- a/chrome/browser/external_protocol/external_protocol_handler.cc | ||
+++ b/chrome/browser/external_protocol/external_protocol_handler.cc | ||
@@ -183,7 +183,7 @@ ExternalProtocolHandler::BlockState ExternalProtocolHandler::GetBlockState( | ||
// Always allow the hard-coded allowed schemes. | ||
for (size_t i = 0; i < arraysize(kAllowedSchemes); ++i) { | ||
if (kAllowedSchemes[i] == scheme) | ||
- return DONT_BLOCK; | ||
+ return UNKNOWN; | ||
} | ||
|
||
PrefService* profile_prefs = profile->GetPrefs(); |
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