Commit 9c813b8d authored by Devlin Cronin's avatar Devlin Cronin Committed by Commit Bot

[Extensions] Rename match_data_urls to match_origin_as_fallback

In content scripts, rename match_data_urls to match_origin_as_fallback.
The associated bug has the full discussion, but this field better suits
matching multiple schemes, and will apply to any frame where we need to
compare the initiator/precursor origin.

Note: this is a pure rename CL. It does *not* adjust any of the
functionality.

Bug: 55084
Change-Id: Iec4ba3e8f0bb0559eb800cc3e0d453c7b353598e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2340494Reviewed-by: default avatarKaran Bhatia <karandeepb@chromium.org>
Commit-Queue: Devlin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#796587}
parent fb16adbc
...@@ -1105,8 +1105,9 @@ class ContentScriptRelatedFrameTest : public ContentScriptApiTest { ...@@ -1105,8 +1105,9 @@ class ContentScriptRelatedFrameTest : public ContentScriptApiTest {
void SetUpOnMainThread() override; void SetUpOnMainThread() override;
// Whether the extension's content script should also match data: URLs. // Whether the extension's content script should specify
virtual bool IncludeMatchDataUrls() { return false; } // match_origin_as_fallback as true.
virtual bool IncludeMatchOriginAsFallback() { return false; }
// Returns true if the extension's content script executed in the specified // Returns true if the extension's content script executed in the specified
// |frame|. // |frame|.
...@@ -1198,8 +1199,8 @@ void ContentScriptRelatedFrameTest::SetUpOnMainThread() { ...@@ -1198,8 +1199,8 @@ void ContentScriptRelatedFrameTest::SetUpOnMainThread() {
}] }]
})"; })";
const char* extra_property = ""; const char* extra_property = "";
if (IncludeMatchDataUrls()) if (IncludeMatchOriginAsFallback())
extra_property = R"("match_data_urls": true,)"; extra_property = R"("match_origin_as_fallback": true,)";
std::string manifest = base::StringPrintf(kManifest, extra_property); std::string manifest = base::StringPrintf(kManifest, extra_property);
test_extension_dir_.WriteManifest(manifest); test_extension_dir_.WriteManifest(manifest);
...@@ -1368,11 +1369,11 @@ class ContentScriptDataURLTest : public ContentScriptRelatedFrameTest { ...@@ -1368,11 +1369,11 @@ class ContentScriptDataURLTest : public ContentScriptRelatedFrameTest {
public: public:
ContentScriptDataURLTest() { ContentScriptDataURLTest() {
feature_list_.InitAndEnableFeature( feature_list_.InitAndEnableFeature(
extensions_features::kContentScriptsOnDataUrls); extensions_features::kContentScriptsMatchOriginAsFallback);
} }
~ContentScriptDataURLTest() override = default; ~ContentScriptDataURLTest() override = default;
bool IncludeMatchDataUrls() override { return true; } bool IncludeMatchOriginAsFallback() override { return true; }
private: private:
base::test::ScopedFeatureList feature_list_; base::test::ScopedFeatureList feature_list_;
......
...@@ -104,43 +104,44 @@ TEST_F(ContentScriptsManifestTest, FailLoadingNonUTF8Scripts) { ...@@ -104,43 +104,44 @@ TEST_F(ContentScriptsManifestTest, FailLoadingNonUTF8Scripts) {
error.c_str()); error.c_str());
} }
TEST_F(ContentScriptsManifestTest, MatchDataURLs_FeatureEnabled) { TEST_F(ContentScriptsManifestTest, MatchOriginAsFallback_FeatureEnabled) {
base::test::ScopedFeatureList scoped_feature_list; base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitAndEnableFeature( scoped_feature_list.InitAndEnableFeature(
extensions_features::kContentScriptsOnDataUrls); extensions_features::kContentScriptsMatchOriginAsFallback);
scoped_refptr<const Extension> extension = scoped_refptr<const Extension> extension =
LoadAndExpectSuccess("content_script_match_data_urls.json"); LoadAndExpectSuccess("content_script_match_origin_as_fallback.json");
ASSERT_TRUE(extension); ASSERT_TRUE(extension);
const UserScriptList& user_scripts = const UserScriptList& user_scripts =
ContentScriptsInfo::GetContentScripts(extension.get()); ContentScriptsInfo::GetContentScripts(extension.get());
ASSERT_EQ(3u, user_scripts.size()); ASSERT_EQ(3u, user_scripts.size());
// The first script specifies `"match_data_urls": true`. // The first script specifies `"match_origin_as_fallback": true`.
EXPECT_TRUE(user_scripts[0]->match_data_urls()); EXPECT_TRUE(user_scripts[0]->match_origin_as_fallback());
// The second specifies `"match_data_urls": false`. // The second specifies `"match_origin_as_fallback": false`.
EXPECT_FALSE(user_scripts[1]->match_data_urls()); EXPECT_FALSE(user_scripts[1]->match_origin_as_fallback());
// The third doesn't specify a value for "match_data_urls"; it should // The third doesn't specify a value for "match_origin_as_fallback"; it
// default to false. // should default to false.
EXPECT_FALSE(user_scripts[2]->match_data_urls()); EXPECT_FALSE(user_scripts[2]->match_origin_as_fallback());
} }
TEST_F(ContentScriptsManifestTest, MatchDataURLs_FeatureDisabled) { TEST_F(ContentScriptsManifestTest, MatchOriginAsFallback_FeatureDisabled) {
base::test::ScopedFeatureList scoped_feature_list; base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitAndDisableFeature( scoped_feature_list.InitAndDisableFeature(
extensions_features::kContentScriptsOnDataUrls); extensions_features::kContentScriptsMatchOriginAsFallback);
scoped_refptr<const Extension> extension = scoped_refptr<const Extension> extension =
LoadAndExpectSuccess("content_script_match_data_urls.json"); LoadAndExpectSuccess("content_script_match_origin_as_fallback.json");
ASSERT_TRUE(extension); ASSERT_TRUE(extension);
const UserScriptList& user_scripts = const UserScriptList& user_scripts =
ContentScriptsInfo::GetContentScripts(extension.get()); ContentScriptsInfo::GetContentScripts(extension.get());
ASSERT_EQ(3u, user_scripts.size()); ASSERT_EQ(3u, user_scripts.size());
// Without the feature enabled, match_data_urls should always be false. // Without the feature enabled, match_origin_as_fallback should always be
EXPECT_FALSE(user_scripts[0]->match_data_urls()); // false.
EXPECT_FALSE(user_scripts[1]->match_data_urls()); EXPECT_FALSE(user_scripts[0]->match_origin_as_fallback());
EXPECT_FALSE(user_scripts[2]->match_data_urls()); EXPECT_FALSE(user_scripts[1]->match_origin_as_fallback());
EXPECT_FALSE(user_scripts[2]->match_origin_as_fallback());
} }
} // namespace extensions } // namespace extensions
...@@ -5,11 +5,11 @@ ...@@ -5,11 +5,11 @@
"manifest_version": 2, "manifest_version": 2,
"content_scripts": [{ "content_scripts": [{
"matches": ["https://example.com/*"], "matches": ["https://example.com/*"],
"match_data_urls": true, "match_origin_as_fallback": true,
"js": ["file.js"] "js": ["file.js"]
}, { }, {
"matches": ["https://foo.example/*"], "matches": ["https://foo.example/*"],
"match_data_urls": false, "match_origin_as_fallback": false,
"js": ["file.js"] "js": ["file.js"]
}, { }, {
"matches": ["https://bar.example/*"], "matches": ["https://bar.example/*"],
......
...@@ -43,9 +43,10 @@ const base::Feature kAllowWithholdingExtensionPermissionsOnInstall{ ...@@ -43,9 +43,10 @@ const base::Feature kAllowWithholdingExtensionPermissionsOnInstall{
"AllowWithholdingExtensionPermissionsOnInstall", "AllowWithholdingExtensionPermissionsOnInstall",
base::FEATURE_DISABLED_BY_DEFAULT}; base::FEATURE_DISABLED_BY_DEFAULT};
// Enables content scripts on data URLs. // Enables support for the "match_origin_as_fallback" property in content
const base::Feature kContentScriptsOnDataUrls{ // scripts.
"ContentScriptsOnDataUrls", base::FEATURE_DISABLED_BY_DEFAULT}; const base::Feature kContentScriptsMatchOriginAsFallback{
"ContentScriptsMatchOriginAsFallback", base::FEATURE_DISABLED_BY_DEFAULT};
// Reports Extensions.WebRequest.KeepaliveRequestFinished when enabled. // Reports Extensions.WebRequest.KeepaliveRequestFinished when enabled.
const base::Feature kReportKeepaliveUkm{"ReportKeepaliveUkm", const base::Feature kReportKeepaliveUkm{"ReportKeepaliveUkm",
......
...@@ -25,7 +25,7 @@ extern const base::Feature kForceWebRequestProxyForTest; ...@@ -25,7 +25,7 @@ extern const base::Feature kForceWebRequestProxyForTest;
extern const base::Feature kAllowWithholdingExtensionPermissionsOnInstall; extern const base::Feature kAllowWithholdingExtensionPermissionsOnInstall;
extern const base::Feature kContentScriptsOnDataUrls; extern const base::Feature kContentScriptsMatchOriginAsFallback;
extern const base::Feature kReportKeepaliveUkm; extern const base::Feature kReportKeepaliveUkm;
......
...@@ -105,7 +105,7 @@ const char kLinkedAppIconURL[] = "url"; ...@@ -105,7 +105,7 @@ const char kLinkedAppIconURL[] = "url";
const char kLinkedAppIconSize[] = "size"; const char kLinkedAppIconSize[] = "size";
const char kManifestVersion[] = "manifest_version"; const char kManifestVersion[] = "manifest_version";
const char kMatchAboutBlank[] = "match_about_blank"; const char kMatchAboutBlank[] = "match_about_blank";
const char kMatchDataUrls[] = "match_data_urls"; const char kMatchOriginAsFallback[] = "match_origin_as_fallback";
const char kMatches[] = "matches"; const char kMatches[] = "matches";
const char kMinimumChromeVersion[] = "minimum_chrome_version"; const char kMinimumChromeVersion[] = "minimum_chrome_version";
const char kMinimumVersion[] = "minimum_version"; const char kMinimumVersion[] = "minimum_version";
...@@ -569,8 +569,8 @@ const char kInvalidMatch[] = ...@@ -569,8 +569,8 @@ const char kInvalidMatch[] =
"Invalid value for 'content_scripts[*].matches[*]': *"; "Invalid value for 'content_scripts[*].matches[*]': *";
const char kInvalidMatchAboutBlank[] = const char kInvalidMatchAboutBlank[] =
"Invalid value for 'content_scripts[*].match_about_blank'."; "Invalid value for 'content_scripts[*].match_about_blank'.";
const char kInvalidMatchDataUrls[] = const char kInvalidMatchOriginAsFallback[] =
"Invalid value for 'content_scripts[*].match_data_urls'."; "Invalid value for 'content_scripts[*].match_origin_as_fallback'.";
const char kInvalidMatchCount[] = const char kInvalidMatchCount[] =
"Invalid value for 'content_scripts[*].matches'. There must be at least " "Invalid value for 'content_scripts[*].matches'. There must be at least "
"one match specified."; "one match specified.";
......
...@@ -108,7 +108,7 @@ extern const char kLinkedAppIconURL[]; ...@@ -108,7 +108,7 @@ extern const char kLinkedAppIconURL[];
extern const char kLinkedAppIconSize[]; extern const char kLinkedAppIconSize[];
extern const char kManifestVersion[]; extern const char kManifestVersion[];
extern const char kMatchAboutBlank[]; extern const char kMatchAboutBlank[];
extern const char kMatchDataUrls[]; extern const char kMatchOriginAsFallback[];
extern const char kMatches[]; extern const char kMatches[];
extern const char kMIMETypes[]; extern const char kMIMETypes[];
extern const char kMimeTypesHandler[]; extern const char kMimeTypesHandler[];
...@@ -419,7 +419,7 @@ extern const char kInvalidManifestVersion[]; ...@@ -419,7 +419,7 @@ extern const char kInvalidManifestVersion[];
extern const char kInvalidManifestVersionOld[]; extern const char kInvalidManifestVersionOld[];
extern const char kInvalidMatch[]; extern const char kInvalidMatch[];
extern const char kInvalidMatchAboutBlank[]; extern const char kInvalidMatchAboutBlank[];
extern const char kInvalidMatchDataUrls[]; extern const char kInvalidMatchOriginAsFallback[];
extern const char kInvalidMatchCount[]; extern const char kInvalidMatchCount[];
extern const char kInvalidMatches[]; extern const char kInvalidMatches[];
extern const char kInvalidMIMETypes[]; extern const char kInvalidMIMETypes[];
......
...@@ -127,19 +127,19 @@ std::unique_ptr<UserScript> LoadUserScriptFromDictionary( ...@@ -127,19 +127,19 @@ std::unique_ptr<UserScript> LoadUserScriptFromDictionary(
result->set_match_about_blank(match_about_blank->GetBool()); result->set_match_about_blank(match_about_blank->GetBool());
} }
// match data urls // match origin as fallback
if (base::FeatureList::IsEnabled( if (base::FeatureList::IsEnabled(
extensions_features::kContentScriptsOnDataUrls)) { extensions_features::kContentScriptsMatchOriginAsFallback)) {
const base::Value* match_data_urls = const base::Value* match_origin_as_fallback =
content_script.FindKey(keys::kMatchDataUrls); content_script.FindKey(keys::kMatchOriginAsFallback);
if (match_data_urls) { if (match_origin_as_fallback) {
if (!match_data_urls->is_bool()) { if (!match_origin_as_fallback->is_bool()) {
*error = ErrorUtils::FormatErrorMessageUTF16( *error = ErrorUtils::FormatErrorMessageUTF16(
errors::kInvalidMatchDataUrls, errors::kInvalidMatchOriginAsFallback,
base::NumberToString(definition_index)); base::NumberToString(definition_index));
return nullptr; return nullptr;
} }
result->set_match_data_urls(match_data_urls->GetBool()); result->set_match_origin_as_fallback(match_origin_as_fallback->GetBool());
} }
} }
......
...@@ -98,7 +98,7 @@ UserScript::UserScript() ...@@ -98,7 +98,7 @@ UserScript::UserScript()
emulate_greasemonkey_(false), emulate_greasemonkey_(false),
match_all_frames_(false), match_all_frames_(false),
match_about_blank_(false), match_about_blank_(false),
match_data_urls_(false), match_origin_as_fallback_(false),
incognito_enabled_(false) {} incognito_enabled_(false) {}
UserScript::~UserScript() { UserScript::~UserScript() {
...@@ -133,7 +133,7 @@ std::unique_ptr<UserScript> UserScript::CopyMetadataFrom( ...@@ -133,7 +133,7 @@ std::unique_ptr<UserScript> UserScript::CopyMetadataFrom(
script->emulate_greasemonkey_ = other.emulate_greasemonkey_; script->emulate_greasemonkey_ = other.emulate_greasemonkey_;
script->match_all_frames_ = other.match_all_frames_; script->match_all_frames_ = other.match_all_frames_;
script->match_about_blank_ = other.match_about_blank_; script->match_about_blank_ = other.match_about_blank_;
script->match_data_urls_ = other.match_data_urls_; script->match_origin_as_fallback_ = other.match_origin_as_fallback_;
script->incognito_enabled_ = other.incognito_enabled_; script->incognito_enabled_ = other.incognito_enabled_;
return script; return script;
...@@ -200,7 +200,7 @@ void UserScript::Pickle(base::Pickle* pickle) const { ...@@ -200,7 +200,7 @@ void UserScript::Pickle(base::Pickle* pickle) const {
pickle->WriteBool(emulate_greasemonkey()); pickle->WriteBool(emulate_greasemonkey());
pickle->WriteBool(match_all_frames()); pickle->WriteBool(match_all_frames());
pickle->WriteBool(match_about_blank()); pickle->WriteBool(match_about_blank());
pickle->WriteBool(match_data_urls()); pickle->WriteBool(match_origin_as_fallback());
pickle->WriteBool(is_incognito_enabled()); pickle->WriteBool(is_incognito_enabled());
PickleHostID(pickle, host_id_); PickleHostID(pickle, host_id_);
...@@ -256,7 +256,7 @@ void UserScript::Unpickle(const base::Pickle& pickle, ...@@ -256,7 +256,7 @@ void UserScript::Unpickle(const base::Pickle& pickle,
CHECK(iter->ReadBool(&emulate_greasemonkey_)); CHECK(iter->ReadBool(&emulate_greasemonkey_));
CHECK(iter->ReadBool(&match_all_frames_)); CHECK(iter->ReadBool(&match_all_frames_));
CHECK(iter->ReadBool(&match_about_blank_)); CHECK(iter->ReadBool(&match_about_blank_));
CHECK(iter->ReadBool(&match_data_urls_)); CHECK(iter->ReadBool(&match_origin_as_fallback_));
CHECK(iter->ReadBool(&incognito_enabled_)); CHECK(iter->ReadBool(&incognito_enabled_));
UnpickleHostID(pickle, iter, &host_id_); UnpickleHostID(pickle, iter, &host_id_);
......
...@@ -174,9 +174,12 @@ class UserScript { ...@@ -174,9 +174,12 @@ class UserScript {
bool match_about_blank() const { return match_about_blank_; } bool match_about_blank() const { return match_about_blank_; }
void set_match_about_blank(bool val) { match_about_blank_ = val; } void set_match_about_blank(bool val) { match_about_blank_ = val; }
// Whether to match data:-scheme URLs. // Whether to match on the origin if an appropriate URL cannot be found for
bool match_data_urls() const { return match_data_urls_; } // the frame.
void set_match_data_urls(bool val) { match_data_urls_ = val; } bool match_origin_as_fallback() const { return match_origin_as_fallback_; }
void set_match_origin_as_fallback(bool val) {
match_origin_as_fallback_ = val;
}
// The globs, if any, that determine which pages this script runs against. // The globs, if any, that determine which pages this script runs against.
// These are only used with "standalone" Greasemonkey-like user scripts. // These are only used with "standalone" Greasemonkey-like user scripts.
...@@ -237,7 +240,7 @@ class UserScript { ...@@ -237,7 +240,7 @@ class UserScript {
// Returns true if the script should be applied to the given // Returns true if the script should be applied to the given
// |effective_document_url|. It is the caller's responsibility to calculate // |effective_document_url|. It is the caller's responsibility to calculate
// |effective_document_url| based on match_about_blank() and // |effective_document_url| based on match_about_blank() and
// match_data_urls(). // match_origin_as_fallback().
bool MatchesDocument(const GURL& effective_document_url, bool MatchesDocument(const GURL& effective_document_url,
bool is_subframe) const; bool is_subframe) const;
...@@ -330,9 +333,11 @@ class UserScript { ...@@ -330,9 +333,11 @@ class UserScript {
// Defaults to false. // Defaults to false.
bool match_about_blank_; bool match_about_blank_;
// Whether the user script should run in data:-scheme frames. // Whether the user script should run in frames whose initiator / precursor
// Defaults to false. // origin matches a match pattern, if an appropriate URL cannot be found for
bool match_data_urls_; // the frame for matching purposes, such as in the case of about:, data:, and
// other schemes.
bool match_origin_as_fallback_;
// True if the script should be injected into an incognito tab. // True if the script should be injected into an incognito tab.
bool incognito_enabled_; bool incognito_enabled_;
......
...@@ -83,7 +83,7 @@ PermissionsData::PageAccess ProgrammaticScriptInjector::CanExecuteOnFrame( ...@@ -83,7 +83,7 @@ PermissionsData::PageAccess ProgrammaticScriptInjector::CanExecuteOnFrame(
GURL effective_document_url = GURL effective_document_url =
ScriptContext::GetEffectiveDocumentURLForInjection( ScriptContext::GetEffectiveDocumentURLForInjection(
frame, frame->GetDocument().Url(), params_->match_about_blank, frame, frame->GetDocument().Url(), params_->match_about_blank,
/*match_data_urls=*/false); /*match_origin_as_fallback=*/false);
if (params_->is_web_view) { if (params_->is_web_view) {
if (frame->Parent()) { if (frame->Parent()) {
// This is a subframe inside <webview>, so allow it. // This is a subframe inside <webview>, so allow it.
......
...@@ -467,14 +467,14 @@ GURL ScriptContext::GetEffectiveDocumentURLForInjection( ...@@ -467,14 +467,14 @@ GURL ScriptContext::GetEffectiveDocumentURLForInjection(
blink::WebLocalFrame* frame, blink::WebLocalFrame* frame,
const GURL& document_url, const GURL& document_url,
bool match_about_blank, bool match_about_blank,
bool match_data_urls) { bool match_origin_as_fallback) {
// We explicitly allow inaccessible parents here. Extensions should still be // We explicitly allow inaccessible parents here. Extensions should still be
// able to inject into a sandboxed iframe if it has access to the embedding // able to inject into a sandboxed iframe if it has access to the embedding
// origin. // origin.
int flags = kAllowInaccessibleParents; int flags = kAllowInaccessibleParents;
if (match_about_blank) if (match_about_blank)
flags |= kAllowAboutFrames; flags |= kAllowAboutFrames;
if (match_data_urls) if (match_origin_as_fallback)
flags |= kAllowDataFrames; flags |= kAllowDataFrames;
return GetEffectiveDocumentURL(frame, document_url, flags); return GetEffectiveDocumentURL(frame, document_url, flags);
......
...@@ -226,14 +226,16 @@ class ScriptContext { ...@@ -226,14 +226,16 @@ class ScriptContext {
// frame without an about: or data: URL that matches the initiator origin. // frame without an about: or data: URL that matches the initiator origin.
// This may not be the immediate parent. Returns |document_url| if it is not // This may not be the immediate parent. Returns |document_url| if it is not
// an about: or data: URL, if the corresponding |match_about_blank| or // an about: or data: URL, if the corresponding |match_about_blank| or
// |match_data_urls| is false, or if a suitable parent cannot be found. // |match_origin_as_fallback| is false, or if a suitable parent cannot be
// found.
// Considers parent contexts that cannot be accessed (as is the case for // Considers parent contexts that cannot be accessed (as is the case for
// sandboxed frames). // sandboxed frames).
// TODO(devlin): Enum-ify match_about_* here. // TODO(devlin): Enum-ify match_about_* here.
static GURL GetEffectiveDocumentURLForInjection(blink::WebLocalFrame* frame, static GURL GetEffectiveDocumentURLForInjection(
const GURL& document_url, blink::WebLocalFrame* frame,
bool match_about_blank, const GURL& document_url,
bool match_data_urls); bool match_about_blank,
bool match_origin_as_fallback);
// Grants a set of content capabilities to this context. // Grants a set of content capabilities to this context.
void set_content_capabilities(APIPermissionSet capabilities) { void set_content_capabilities(APIPermissionSet capabilities) {
......
...@@ -25,12 +25,12 @@ class ScriptContextTest : public ChromeRenderViewTest { ...@@ -25,12 +25,12 @@ class ScriptContextTest : public ChromeRenderViewTest {
GURL GetEffectiveDocumentURLForInjection(WebLocalFrame* frame) { GURL GetEffectiveDocumentURLForInjection(WebLocalFrame* frame) {
return ScriptContext::GetEffectiveDocumentURLForInjection( return ScriptContext::GetEffectiveDocumentURLForInjection(
frame, frame->GetDocument().Url(), frame, frame->GetDocument().Url(),
/*match_about_blank=*/true, /*match_data_urls=*/true); /*match_about_blank=*/true, /*match_origin_as_fallback=*/true);
} }
GURL GetEffectiveURLForInjectionWithoutMatchingData(WebLocalFrame* frame) { GURL GetEffectiveURLForInjectionWithoutMatchingData(WebLocalFrame* frame) {
return ScriptContext::GetEffectiveDocumentURLForInjection( return ScriptContext::GetEffectiveDocumentURLForInjection(
frame, frame->GetDocument().Url(), frame, frame->GetDocument().Url(),
/*match_about_blank=*/true, /*match_data_urls=*/false); /*match_about_blank=*/true, /*match_origin_as_fallback=*/false);
} }
}; };
......
...@@ -204,7 +204,7 @@ PermissionsData::PageAccess UserScriptInjector::CanExecuteOnFrame( ...@@ -204,7 +204,7 @@ PermissionsData::PageAccess UserScriptInjector::CanExecuteOnFrame(
GURL effective_document_url = GURL effective_document_url =
ScriptContext::GetEffectiveDocumentURLForInjection( ScriptContext::GetEffectiveDocumentURLForInjection(
web_frame, web_frame->GetDocument().Url(), web_frame, web_frame->GetDocument().Url(),
script_->match_about_blank(), script_->match_data_urls()); script_->match_about_blank(), script_->match_origin_as_fallback());
return injection_host->CanExecuteOnFrame( return injection_host->CanExecuteOnFrame(
effective_document_url, effective_document_url,
......
...@@ -218,7 +218,7 @@ std::unique_ptr<ScriptInjection> UserScriptSet::GetInjectionForScript( ...@@ -218,7 +218,7 @@ std::unique_ptr<ScriptInjection> UserScriptSet::GetInjectionForScript(
GURL effective_document_url = GURL effective_document_url =
ScriptContext::GetEffectiveDocumentURLForInjection( ScriptContext::GetEffectiveDocumentURLForInjection(
web_frame, document_url, script->match_about_blank(), web_frame, document_url, script->match_about_blank(),
script->match_data_urls()); script->match_origin_as_fallback());
bool is_subframe = web_frame->Parent(); bool is_subframe = web_frame->Parent();
if (!script->MatchesDocument(effective_document_url, is_subframe)) if (!script->MatchesDocument(effective_document_url, is_subframe))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment