Skip to content

Commit

Permalink
Remove remaining code for Event.path
Browse files Browse the repository at this point in the history
Event.path has been removed in M109 on all non-WebView platforms, and
M111 on WebView. Now it's safe to conclude the feature removal by
removing any remaining code, including implementation, flags, switches
and the enterprise policy.

Fixed: 1277431
Change-Id: Id9cb729b2922cead932ed6f932a1cc7c7a7e488a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4562400
Reviewed-by: Chris Harrelson <chrishtr@chromium.org>
Commit-Queue: Xiaocheng Hu <xiaochengh@chromium.org>
Reviewed-by: Mason Freed <masonf@chromium.org>
Reviewed-by: Pavol Marko <pmarko@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1151919}
  • Loading branch information
xiaochengh authored and Chromium LUCI CQ committed Jun 1, 2023
1 parent 24e7f9a commit b19fe52
Show file tree
Hide file tree
Showing 18 changed files with 6 additions and 227 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,6 @@ private ProductionSupportedFlagList() {}
+ "thread."),
Flag.baseFeature(BaseFeatures.OPTIMIZE_DATA_URLS,
"Optimizes parsing and loading of data: URLs."),
Flag.baseFeature(BlinkFeatures.EVENT_PATH, "Enables the deprecated Event.path API."),
Flag.baseFeature(BlinkFeatures.PREFETCH_FONT_LOOKUP_TABLES,
"If enabled, font lookup tables will be prefetched on renderer startup."),
Flag.baseFeature(BlinkFeatures.PRECOMPILE_INLINE_SCRIPTS,
Expand Down
10 changes: 0 additions & 10 deletions chrome/browser/chrome_content_browser_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1637,8 +1637,6 @@ void ChromeContentBrowserClient::RegisterProfilePrefs(
registry->RegisterBooleanPref(
policy::policy_prefs::kIsolatedAppsDeveloperModeAllowed, true);

registry->RegisterBooleanPref(policy::policy_prefs::kEventPathEnabled, false);

registry->RegisterBooleanPref(
prefs::kStrictMimetypeCheckForWorkerScriptsEnabled, true);

Expand Down Expand Up @@ -2758,14 +2756,6 @@ void ChromeContentBrowserClient::AppendExtraCommandLineSwitches(
command_line->AppendSwitch(switches::kDisableScrollToTextFragment);
}

// Override EventPath feature if its Enterprise Policy is specified.
if (prefs->HasPrefPath(policy::policy_prefs::kEventPathEnabled)) {
command_line->AppendSwitchASCII(
blink::switches::kEventPathPolicy,
prefs->GetBoolean(policy::policy_prefs::kEventPathEnabled)
? blink::switches::kEventPathPolicy_ForceEnable
: blink::switches::kEventPathPolicy_ForceDisable);
}
// Override OffsetParentNewSpecBehavior feature if its Enterprise policy
// is specified.
if (prefs->HasPrefPath(
Expand Down
1 change: 0 additions & 1 deletion chrome/browser/policy/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ source_set("policy_specific_browser_tests") {
"policy_network_browsertest.cc",
"site_isolation_policy_browsertest.cc",
"test/certificate_transparency_policy_browsertest.cc",
"test/event_path_policy_browsertest.cc",
"test/hsts_policy_browsertest.cc",
"test/network_prediction_policy_browsertest.cc",
"test/offset_parent_new_spec_behavior_policy_browsertest.cc",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1843,9 +1843,6 @@ const PolicyToPreferenceMapEntry kSimplePolicyMap[] = {
{ key::kAccessControlAllowMethodsInCORSPreflightSpecConformant,
prefs::kAccessControlAllowMethodsInCORSPreflightSpecConformant,
base::Value::Type::BOOLEAN},
{ key::kEventPathEnabled,
policy_prefs::kEventPathEnabled,
base::Value::Type::BOOLEAN},
{ key::kOffsetParentNewSpecBehaviorEnabled,
policy_prefs::kOffsetParentNewSpecBehaviorEnabled,
base::Value::Type::BOOLEAN},
Expand Down
75 changes: 0 additions & 75 deletions chrome/browser/policy/test/event_path_policy_browsertest.cc

This file was deleted.

5 changes: 0 additions & 5 deletions components/policy/core/common/policy_pref_names.cc
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,6 @@ const char kUserPolicyNotificationWasShown[] =
"policy.user_policy_notification_was_shown";
#endif

// A boolean indicating whether the deprecated API Event.path is enabled. It
// should eventually be disabled and removed.
// https://chromestatus.com/feature/5726124632965120
const char kEventPathEnabled[] = "policy.event_path_enabled";

// A boolean indicating whether the newly specified behavior for
// Element.offsetParent is in effect.
const char kOffsetParentNewSpecBehaviorEnabled[] =
Expand Down
1 change: 0 additions & 1 deletion components/policy/core/common/policy_pref_names.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ extern const char kLastPolicyCheckTime[];
#if BUILDFLAG(IS_IOS)
extern const char kUserPolicyNotificationWasShown[];
#endif
extern const char kEventPathEnabled[];
extern const char kOffsetParentNewSpecBehaviorEnabled[];
extern const char kSendMouseEventsDisabledFormControlsEnabled[];
extern const char kForceGoogleSafeSearch[];
Expand Down
40 changes: 1 addition & 39 deletions components/policy/test/data/policy_test_cases.json
Original file line number Diff line number Diff line change
Expand Up @@ -21192,45 +21192,7 @@
]
},
"EventPathEnabled": {
"os": [
"win",
"linux",
"mac",
"chromeos_ash",
"chromeos_lacros",
"android",
"fuchsia"
],
"policy_pref_mapping_tests": [
{
"policies": {
"EventPathEnabled": true
},
"prefs": {
"policy.event_path_enabled": {
"value": true
}
}
},
{
"policies": {
"EventPathEnabled": false
},
"prefs": {
"policy.event_path_enabled": {
"value": false
}
}
},
{
"policies": {},
"prefs": {
"policy.event_path_enabled": {
"default_value": false
}
}
}
]
"reason_for_missing_test": "Policy is not supported as of M116"
},
"OffsetParentNewSpecBehaviorEnabled": {
"os": [
Expand Down
24 changes: 0 additions & 24 deletions content/child/runtime_features.cc
Original file line number Diff line number Diff line change
Expand Up @@ -476,30 +476,6 @@ void SetRuntimeFeaturesFromCommandLine(const base::CommandLine& command_line) {
}
}

// Set the state of EventPath, which can be controlled by various sources in
// decreasing order of precedence:
// 1. Enterprise policy, if set
// 2. base::Feature overrides via field trial or enable/disable feature flags
// 3. --event-path-enabled-by-default flag, if set
// 4. The default value, which is disabled
if (command_line.HasSwitch(blink::switches::kEventPathPolicy)) {
const std::string value =
command_line.GetSwitchValueASCII(blink::switches::kEventPathPolicy);
if (value == blink::switches::kEventPathPolicy_ForceEnable) {
WebRuntimeFeatures::EnableEventPath(true);
}
if (value == blink::switches::kEventPathPolicy_ForceDisable) {
WebRuntimeFeatures::EnableEventPath(false);
}
} else if (base::FeatureList::GetStateIfOverridden(
blink::features::kEventPath)
.has_value()) {
// Do nothing here; it will be handled in the standard way.
} else if (command_line.HasSwitch(
blink::switches::kEventPathEnabledByDefault)) {
WebRuntimeFeatures::EnableEventPath(true);
}

// Enable or disable OffsetParentNewSpecBehavior for Enterprise Policy. This
// overrides any existing settings via base::Feature.
if (command_line.HasSwitch(
Expand Down
17 changes: 0 additions & 17 deletions third_party/blink/common/switches.cc
Original file line number Diff line number Diff line change
Expand Up @@ -167,23 +167,6 @@ const char kJavaScriptFlags[] = "js-flags";
// Controls whether WebSQL is force enabled.
const char kWebSQLAccess[] = "web-sql-access";

// Used to communicate managed policy for the EventPath feature. This feature is
// typically controlled by base::Feature (see blink/common/features.*) but
// requires an enterprise policy override. This is implicitly a tri-state, and
// can be either unset, or set to "1" for force enable, or "0" for force
// disable.
extern const char kEventPathPolicy[] = "event-path-policy";
extern const char kEventPathPolicy_ForceDisable[] = "0";
extern const char kEventPathPolicy_ForceEnable[] = "1";

// The EventPath feature is disabled by default on almost all platforms and
// channels, with a few exceptions that require a more gradual removal. Those
// platforms/channels should pass this flag to renderer to enable the feature.
// The flag has higher precedence than Blink runtime enabled feature, but lower
// precedence than base::Feature overrides and enterprise policy.
extern const char kEventPathEnabledByDefault[] =
"event-path-enabled-by-default";

// Used to communicate managed policy for the OffsetParentNewSpecBehavior
// feature. This feature is typically controlled by base::Feature (see
// blink/common/features.*) but requires an enterprise policy override. This is
Expand Down
4 changes: 0 additions & 4 deletions third_party/blink/public/common/switches.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ BLINK_COMMON_EXPORT extern const char kEnablePreferCompositingToLCDText[];
BLINK_COMMON_EXPORT extern const char kEnableRasterSideDarkModeForImages[];
BLINK_COMMON_EXPORT extern const char kEnableRGBA4444Textures[];
BLINK_COMMON_EXPORT extern const char kEnableZeroCopy[];
BLINK_COMMON_EXPORT extern const char kEventPathPolicy[];
BLINK_COMMON_EXPORT extern const char kEventPathPolicy_ForceDisable[];
BLINK_COMMON_EXPORT extern const char kEventPathPolicy_ForceEnable[];
BLINK_COMMON_EXPORT extern const char kEventPathEnabledByDefault[];
BLINK_COMMON_EXPORT extern const char kOffsetParentNewSpecBehaviorPolicy[];
BLINK_COMMON_EXPORT extern const char
kOffsetParentNewSpecBehaviorPolicy_ForceDisable[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ enum WebFeature {
kSVGSVGElementInXMLDocument = 329,
kEventSrcElement = 343,
kEventCancelBubble = 344,
kEventPath = 345,
kOBSOLETE_EventPath = 345,
kNodeIteratorDetach = 347,
kEventGetReturnValueTrue = 350,
kEventGetReturnValueFalse = 351,
Expand Down
22 changes: 3 additions & 19 deletions third_party/blink/renderer/core/dom/events/event.cc
Original file line number Diff line number Diff line change
Expand Up @@ -289,25 +289,12 @@ void Event::InitEventPath(Node& node) {
}
}

ScriptValue Event::path(ScriptState* script_state) const {
Deprecation::CountDeprecation(ExecutionContext::From(script_state),
WebFeature::kEventPath);
return ScriptValue(
script_state->GetIsolate(),
ToV8(PathInternal(script_state, kNonEmptyAfterDispatch), script_state));
}

HeapVector<Member<EventTarget>> Event::composedPath(
ScriptState* script_state) const {
return PathInternal(script_state, kEmptyAfterDispatch);
}

void Event::SetHandlingPassive(PassiveMode mode) {
handling_passive_ = mode;
}

HeapVector<Member<EventTarget>> Event::PathInternal(ScriptState* script_state,
EventPathMode mode) const {
HeapVector<Member<EventTarget>> Event::composedPath(
ScriptState* script_state) const {
if (!current_target_) {
DCHECK_EQ(Event::PhaseType::kNone, event_phase_);
if (!event_path_) {
Expand All @@ -316,10 +303,7 @@ HeapVector<Member<EventTarget>> Event::PathInternal(ScriptState* script_state,
}
DCHECK(!event_path_->IsEmpty());
// After dispatching the event
if (mode == kEmptyAfterDispatch)
return HeapVector<Member<EventTarget>>();
return event_path_->Last().GetTreeScopeEventContext().EnsureEventPath(
*event_path_);
return HeapVector<Member<EventTarget>>();
}

if (Node* node = current_target_->ToNode()) {
Expand Down
7 changes: 0 additions & 7 deletions third_party/blink/renderer/core/dom/events/event.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ class EventPath;
class EventTarget;
class Node;
class ScriptState;
class ScriptValue;

class CORE_EXPORT Event : public ScriptWrappable {
DEFINE_WRAPPERTYPEINFO();
Expand Down Expand Up @@ -264,7 +263,6 @@ class CORE_EXPORT Event : public ScriptWrappable {
}
void InitEventPath(Node&);

ScriptValue path(ScriptState*) const;
HeapVector<Member<EventTarget>> composedPath(ScriptState*) const;

bool IsBeingDispatched() const { return eventPhase() != PhaseType::kNone; }
Expand Down Expand Up @@ -322,11 +320,6 @@ class CORE_EXPORT Event : public ScriptWrappable {
PassiveMode HandlingPassive() const { return handling_passive_; }

private:
enum EventPathMode { kEmptyAfterDispatch, kNonEmptyAfterDispatch };

HeapVector<Member<EventTarget>> PathInternal(ScriptState*,
EventPathMode) const;

AtomicString type_;
unsigned bubbles_ : 1;
unsigned cancelable_ : 1;
Expand Down
4 changes: 0 additions & 4 deletions third_party/blink/renderer/core/dom/events/event.idl
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,4 @@
[MeasureAs=EventSrcElement] readonly attribute EventTarget srcElement;
[MeasureAs=EventReturnValue, CallWith=ScriptState, ImplementedAs=legacyReturnValue] attribute boolean returnValue;
[MeasureAs=EventCancelBubble, CallWith=ScriptState] attribute boolean cancelBubble;

// Non-standard APIs
[MeasureAs=EventPath, CallWith=ScriptState, RuntimeEnabled=EventPath]
readonly attribute object path;
};
Original file line number Diff line number Diff line change
Expand Up @@ -176,16 +176,6 @@
chrome_status_feature: 5083947249172480,
milestone: 127,
},
{
name: "EventPath",
message: "`Event.path` is deprecated and will be removed. Please use `Event.composedPath()` instead.",
translation_note: "Warning displayed to developers when the non-standard `Event.path` API is used to notify them that this API is deprecated.",
web_features: [
"kEventPath",
],
chrome_status_feature: 5726124632965120,
milestone: 109,
},
{
name: "ExpectCTHeader",
message: "The `Expect-CT` header is deprecated and will be removed. Chrome requires Certificate Transparency for all publicly trusted certificates issued after April 30, 2018.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1489,11 +1489,6 @@
name: "EscapeLtGtInAttributes",
status: "experimental",
},
{
// Non-standard API Event.path. Should be replaced by Event.composedPath.
name: "EventPath",
public: true,
},
{
name: "EventTimingInteractionCount",
status: "experimental",
Expand Down
2 changes: 1 addition & 1 deletion tools/metrics/histograms/enums.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38222,7 +38222,7 @@ Called by update_use_counter_feature_enum.py.-->
<int value="342" label="PrefixedPerformanceSetResourceTimingBufferSize"/>
<int value="343" label="EventSrcElement"/>
<int value="344" label="EventCancelBubble"/>
<int value="345" label="EventPath"/>
<int value="345" label="OBSOLETE_EventPath"/>
<int value="346" label="EventClipboardData"/>
<int value="347" label="NodeIteratorDetach"/>
<int value="348" label="AttrNodeValue"/>
Expand Down

0 comments on commit b19fe52

Please sign in to comment.