Commit 96c6bfab authored by Luciano Pacheco's avatar Luciano Pacheco Committed by Chromium LUCI CQ

Files app: Remove incorrect .bind(this) and fix cr.ui.Command

Remove incorrect .bind(this) because rollup fails because `this` is null
in that context. These callbacks don't use `this` so it's safe to remove
the binding.

Import webui_command_extender.m.js to add the method setHidden() in
cr.ui.Command when running as JS modules.

Bug: 1133186
Change-Id: Iac70f1364a2bf77bfbdf6eb4d3d453786519c2e1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2636006
Commit-Queue: Luciano Pacheco <lucmult@chromium.org>
Reviewed-by: default avatarJeremie Boulic <jboulic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#844634}
parent 09587416
...@@ -934,6 +934,7 @@ js_library("file_manager_commands.m") { ...@@ -934,6 +934,7 @@ js_library("file_manager_commands.m") {
":file_tasks.m", ":file_tasks.m",
":holding_space_util.m", ":holding_space_util.m",
":path_component.m", ":path_component.m",
":webui_command_extender.m",
"ui:directory_tree.m", "ui:directory_tree.m",
"ui:files_confirm_dialog.m", "ui:files_confirm_dialog.m",
"ui:suggest_apps_dialog.m", "ui:suggest_apps_dialog.m",
......
...@@ -60,8 +60,7 @@ crossoverSearchUtils.findQueryMatchedDirectoryEntry = ...@@ -60,8 +60,7 @@ crossoverSearchUtils.findQueryMatchedDirectoryEntry =
const scanner = dirModel.createScannerFactory(dirEntry, searchQuery)(); const scanner = dirModel.createScannerFactory(dirEntry, searchQuery)();
await new Promise( await new Promise(
resolve => scanner.scan( resolve => scanner.scan(entriesCallback, resolve, errorCallback));
entriesCallback.bind(this), resolve, errorCallback.bind(this)));
if (isMatchedEntryFound) { if (isMatchedEntryFound) {
return dirEntry; return dirEntry;
} }
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
// #import {metrics} from '../../common/js/metrics.m.js'; // #import {metrics} from '../../common/js/metrics.m.js';
// #import {assert} from 'chrome://resources/js/assert.m.js'; // #import {assert} from 'chrome://resources/js/assert.m.js';
// #import {Command} from 'chrome://resources/js/cr/ui/command.m.js'; // #import {Command} from 'chrome://resources/js/cr/ui/command.m.js';
// #import './webui_command_extender.m.js';
// clang-format on // clang-format on
......
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