Skip to content

Commit

Permalink
Fix test build and eliminate one extra patch
Browse files Browse the repository at this point in the history
  • Loading branch information
darkdh committed Dec 11, 2020
1 parent 28a271d commit 3482ddd
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 52 deletions.
9 changes: 5 additions & 4 deletions browser/tor/tor_profile_manager_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -339,10 +339,11 @@ IN_PROC_BROWSER_TEST_F(TorProfileManagerExtensionTest,
EXPECT_TRUE(extensions::util::IsIncognitoEnabled(id, tor_profile));
EXPECT_TRUE(extensions::util::IsIncognitoEnabled(id, parent_profile));
// Default mode is spanning but we force it to be split in Tor
EXPECT_FALSE(extensions::IncognitoInfo::IsSplitMode(
extension, primary_otr_profile->IsTor()));
EXPECT_TRUE(
extensions::IncognitoInfo::IsSplitMode(extension, tor_profile->IsTor()));
EXPECT_FALSE(
extensions::IncognitoInfo::ForSplitModeCheck(primary_otr_profile->IsTor())
->IsSplitMode(extension));
EXPECT_TRUE(extensions::IncognitoInfo::ForSplitModeCheck(tor_profile->IsTor())
->IsSplitMode(extension));

// Allow in Tor depends on Allow in private
parent_extension_prefs->SetIsIncognitoEnabled(id, false);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/* Copyright (c) 2020 The Brave Authors. All rights reserved.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "extensions/common/manifest_handlers/incognito_info.h"

#define IsSplitMode ForSplitModeCheck(browser_context_->IsTor())->IsSplitMode
#include "../../../../../chrome/browser/extensions/chrome_test_extension_loader.cc"
#undef IsSplitMode
16 changes: 16 additions & 0 deletions chromium_src/extensions/browser/extension_util.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/* Copyright (c) 2020 The Brave Authors. All rights reserved.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */

#ifndef BRAVE_CHROMIUM_SRC_EXTENSIONS_BROWSER_EXTENSION_UTIL_H_
#define BRAVE_CHROMIUM_SRC_EXTENSIONS_BROWSER_EXTENSION_UTIL_H_

#define IsIncognitoEnabled \
IsTorEnabled(const std::string& extension_id, \
content::BrowserContext* context); \
bool IsIncognitoEnabled
#include "../../../../extensions/browser/extension_util.h"
#undef IsIncognitoEnabled

#endif // BRAVE_CHROMIUM_SRC_EXTENSIONS_BROWSER_EXTENSION_UTIL_H_
2 changes: 1 addition & 1 deletion chromium_src/extensions/browser/task_queue_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@

#define IsSplitMode ForSplitModeCheck(browser_context->IsTor())->IsSplitMode
#include "../../../../extensions/browser/task_queue_util.cc"
#undef IsSplitMode
#undef IsSplitMode
10 changes: 10 additions & 0 deletions chromium_src/extensions/test/extension_background_page_waiter.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/* Copyright (c) 2020 The Brave Authors. All rights reserved.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "extensions/common/manifest_handlers/incognito_info.h"

#define IsSplitMode ForSplitModeCheck(browser_context_->IsTor())->IsSplitMode
#include "../../../../extensions/test/extension_background_page_waiter.cc"
#undef IsSplitMode

This file was deleted.

6 changes: 3 additions & 3 deletions patches/chrome-browser-extensions-extension_tab_util.cc.patch
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
diff --git a/chrome/browser/extensions/extension_tab_util.cc b/chrome/browser/extensions/extension_tab_util.cc
index 4260e615cf9bc4bcc0fbabfc8a5fb5b236b8bd0f..84559e23b05b1ca28e4cc1cdbee48fa798b5dced 100644
index aaac6830f2da4b5b58dc5a2bf9ffada09647e44a..106b6497697593b13e09c3107173dc6f54009d72 100644
--- a/chrome/browser/extensions/extension_tab_util.cc
+++ b/chrome/browser/extensions/extension_tab_util.cc
@@ -779,6 +779,7 @@ bool ExtensionTabUtil::IsKillURL(const GURL& url) {
@@ -766,6 +766,7 @@ bool ExtensionTabUtil::IsKillURL(const GURL& url) {
GURL fixed_url =
url_formatter::FixupURL(url.possibly_invalid_spec(), std::string());
if (!fixed_url.SchemeIs(content::kChromeUIScheme))
+ if (!fixed_url.SchemeIs(content::kBraveUIScheme))
return false;

base::StringPiece fixed_host = fixed_url.host_piece();
@@ -878,7 +879,7 @@ bool ExtensionTabUtil::OpenOptionsPageFromAPI(
@@ -865,7 +866,7 @@ bool ExtensionTabUtil::OpenOptionsPageFromAPI(
// initiated the command via chrome.runtime.openOptionsPage. For a spanning
// mode extension, this API could only be called from a regular profile, since
// that's the only place it's running.
Expand Down
10 changes: 5 additions & 5 deletions patches/extensions-browser-extension_protocols.cc.patch
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
diff --git a/extensions/browser/extension_protocols.cc b/extensions/browser/extension_protocols.cc
index 1841283a1f846af6c8d40eacaba409c63766a2c1..6f6f66ada5ced358db6288fe0bdaff39249a21a8 100644
index e4e1bf4054ad7f19a4e965d6a36c972484196307..dee959c3b2176ec404537ab7dc48c09e7e10dc3b 100644
--- a/extensions/browser/extension_protocols.cc
+++ b/extensions/browser/extension_protocols.cc
@@ -243,6 +243,7 @@ void ReadResourceFilePathAndLastModifiedTime(
@@ -242,6 +242,7 @@ void ReadResourceFilePathAndLastModifiedTime(

bool ExtensionCanLoadInIncognito(bool is_main_frame,
const Extension* extension,
+ bool is_tor,
bool extension_enabled_in_incognito) {
if (!extension || !extension_enabled_in_incognito)
return false;
@@ -265,6 +266,7 @@ bool AllowExtensionResourceLoad(const GURL& url,
@@ -264,6 +265,7 @@ bool AllowExtensionResourceLoad(const GURL& url,
ui::PageTransition page_transition,
int child_id,
bool is_incognito,
+ bool is_tor,
const Extension* extension,
bool extension_enabled_in_incognito,
const ExtensionSet& extensions,
@@ -273,6 +275,7 @@ bool AllowExtensionResourceLoad(const GURL& url,
@@ -272,6 +274,7 @@ bool AllowExtensionResourceLoad(const GURL& url,
resource_type == blink::mojom::ResourceType::kMainFrame;
if (is_incognito &&
!ExtensionCanLoadInIncognito(is_main_frame, extension,
+ is_tor,
extension_enabled_in_incognito)) {
return false;
}
@@ -556,6 +559,7 @@ class ExtensionURLLoaderFactory
@@ -555,6 +558,7 @@ class ExtensionURLLoaderFactory
static_cast<blink::mojom::ResourceType>(request.resource_type),
static_cast<ui::PageTransition>(request.transition_type),
render_process_id_, browser_context_->IsOffTheRecord(),
Expand Down
13 changes: 0 additions & 13 deletions patches/extensions-browser-extension_util.h.patch

This file was deleted.

13 changes: 0 additions & 13 deletions patches/extensions-test-extension_background_page_waiter.cc.patch

This file was deleted.

0 comments on commit 3482ddd

Please sign in to comment.