[iOS] Delete create_fill_namespace.ts
The fill namespace is no longer required because all fill.ts functions
have become utility functions shared via standard imports/exports.
This change removes unused files and moves the remaining variables to
fill_constants.ts.
No functional change is intended.
Bug: 448990422,40261693
Change-Id: I7f8438032beafc80bdc6ee8f41036c8559a3fda9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7252089
Commit-Queue: Alexandra Pereira <alexandrasp@google.com>
Reviewed-by: Vincent Boisselle <vincb@google.com>
Cr-Commit-Position: refs/heads/main@{#1558402}
diff --git a/components/autofill/ios/browser/BUILD.gn b/components/autofill/ios/browser/BUILD.gn
index 2fe67724..092dd3f 100644
--- a/components/autofill/ios/browser/BUILD.gn
+++ b/components/autofill/ios/browser/BUILD.gn
@@ -98,8 +98,8 @@
sources = [ "resources/autofill_controller.js" ]
deps = [
+ "//components/autofill/ios/form_util:fill_js_constants",
"//components/autofill/ios/form_util:fill_js_dependencies",
- "//components/autofill/ios/form_util:fill_js_namespace",
"//components/autofill/ios/form_util:form_js",
"//ios/web/public/js_messaging:gcrweb",
"//ios/web/public/js_messaging:util_scripts",
diff --git a/components/autofill/ios/form_util/BUILD.gn b/components/autofill/ios/form_util/BUILD.gn
index 631545b..6c40e649 100644
--- a/components/autofill/ios/form_util/BUILD.gn
+++ b/components/autofill/ios/form_util/BUILD.gn
@@ -120,7 +120,7 @@
sources = [ "resources/child_frame_registration_lib.ts" ]
deps = [
":autofill_form_features_ts",
- ":fill_js_namespace",
+ ":fill_js_constants",
"//ios/web/public/js_messaging:gcrweb",
"//ios/web/public/js_messaging:util_scripts",
]
@@ -130,7 +130,7 @@
deps = [
":autofill_form_features_ts",
":child_frame_registration_ts",
- ":fill_js_namespace",
+ ":fill_js_constants",
"//ios/web/public/js_messaging:gcrweb",
"//ios/web/public/js_messaging:util_scripts",
]
@@ -160,17 +160,14 @@
":autofill_form_features_ts",
":autofill_renderer_id_js",
":child_frame_registration_ts",
- ":fill_js_namespace",
+ ":fill_js_constants",
"//ios/web/public/js_messaging:gcrweb",
"//ios/web/public/js_messaging:util_scripts",
]
}
-compile_ts("fill_js_namespace") {
- sources = [
- "resources/create_fill_namespace.ts",
- "resources/fill_constants.ts",
- ]
+compile_ts("fill_js_constants") {
+ sources = [ "resources/fill_constants.ts" ]
deps = [ "//ios/web/public/js_messaging:gcrweb" ]
}
@@ -198,7 +195,6 @@
sources = [ "resources/form.ts" ]
deps = [
":fill_js_dependencies",
- ":fill_js_namespace",
"//ios/web/public/js_messaging:gcrweb",
"//ios/web/public/js_messaging:util_scripts",
]
@@ -236,7 +232,7 @@
compile_ts("autofill_renderer_id_js") {
sources = [ "resources/renderer_id.ts" ]
- deps = [ ":fill_js_namespace" ]
+ deps = [ ":fill_js_constants" ]
}
optimize_ts("renderer_id_test") {
diff --git a/components/autofill/ios/form_util/resources/create_fill_namespace.ts b/components/autofill/ios/form_util/resources/create_fill_namespace.ts
deleted file mode 100644
index 09e54dcd..0000000
--- a/components/autofill/ios/form_util/resources/create_fill_namespace.ts
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright 2023 The Chromium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-import {gCrWebLegacy} from '//ios/web/public/js_messaging/resources/gcrweb.js';
-
-// Add type extensions needed for other scripts defining the fill namespace.
-declare global {
- // Defines an additional property, `angular`, on the Window object.
- // The code below assumes that this property exists within the object.
- interface Window {
- angular: any;
- }
-
- // Extends the Document object to add the ability to access its
- // properties via the [] notation and defines a property that is
- // assumed to exist within the object.
- interface Document {
- [key: symbol]: number;
- __gCrElementMap: Map<any, any>;
- __gCrWebURLNormalizer: HTMLAnchorElement;
- }
-}
-
-if (!gCrWebLegacy.fill) {
- /**
- * Namespace for this file. It depends on |gCrWebLegacy| having already been
- * injected. String 'fill' is used in |gCrWebLegacy['fill']| as it needs to be
- * accessed in Objective-C code.
- */
- gCrWebLegacy.fill = {};
-
- // Store fill namespace object in a global __gCrWeb object referenced by a
- // string, so it does not get renamed by closure compiler during the
- // minification.
- gCrWebLegacy['fill'] = gCrWebLegacy.fill;
-}
diff --git a/components/autofill/ios/form_util/resources/fill_constants.ts b/components/autofill/ios/form_util/resources/fill_constants.ts
index bbab9d03..39a9412 100644
--- a/components/autofill/ios/form_util/resources/fill_constants.ts
+++ b/components/autofill/ios/form_util/resources/fill_constants.ts
@@ -2,7 +2,23 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-import '//components/autofill/ios/form_util/resources/create_fill_namespace.js';
+// Add type extensions needed for other scripts defining the fill namespace.
+declare global {
+ // Defines an additional property, `angular`, on the Window object.
+ // The code below assumes that this property exists within the object.
+ interface Window {
+ angular: any;
+ }
+
+ // Extends the Document object to add the ability to access its
+ // properties via the [] notation and defines a property that is
+ // assumed to exist within the object.
+ interface Document {
+ [key: symbol]: number;
+ __gCrElementMap: Map<any, any>;
+ __gCrWebURLNormalizer: HTMLAnchorElement;
+ }
+}
export declare type FormControlElement =
HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement;
diff --git a/components/autofill/ios/form_util/resources/fill_util.ts b/components/autofill/ios/form_util/resources/fill_util.ts
index 760fce5..11e0d040 100644
--- a/components/autofill/ios/form_util/resources/fill_util.ts
+++ b/components/autofill/ios/form_util/resources/fill_util.ts
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-import '//components/autofill/ios/form_util/resources/create_fill_namespace.js';
-
import * as fillConstants from '//components/autofill/ios/form_util/resources/fill_constants.js';
import * as inferenceUtil from '//components/autofill/ios/form_util/resources/fill_element_inference_util.js';
import {findChildText, hasTagName, isFormControlElement, isSelectElement} from '//components/autofill/ios/form_util/resources/fill_element_inference_util.js';
diff --git a/components/password_manager/ios/BUILD.gn b/components/password_manager/ios/BUILD.gn
index cb83bd0e..26654ed 100644
--- a/components/password_manager/ios/BUILD.gn
+++ b/components/password_manager/ios/BUILD.gn
@@ -109,8 +109,8 @@
sources = [ "resources/password_controller.ts" ]
deps = [
+ "//components/autofill/ios/form_util:fill_js_constants",
"//components/autofill/ios/form_util:fill_js_dependencies",
- "//components/autofill/ios/form_util:fill_js_namespace",
"//ios/web/public/js_messaging:gcrweb",
"//ios/web/public/js_messaging:util_scripts",
]