[Mac] "Disable Javascript via Apple Events" menu item
Remove and replace the "Disable Applescript Javascript" finch
flag with a "Enable JavaScript in Apple Events" menu item.
The menu item is behind a finch flag and is attached to the
new profile preference: "browser.allow_javascript_apple_events"
New tests are also added.
Testing: Browser tests (TabAppleScriptTest, WindowAppleScriptTest,
BookmarkItemAppleScriptTest)
Bug: 662548, 777644
Change-Id: I6b1f0f308b3f25974cdaceb66b7c60903c6378a9
Reviewed-on: https://chromium-review.googlesource.com/603882
Reviewed-by: Robert Sesek <[email protected]>
Reviewed-by: Scott Violet <[email protected]>
Commit-Queue: Sarah Chan <[email protected]>
Cr-Commit-Position: refs/heads/master@{#511400}diff --git a/chrome/browser/ui/browser_command_controller.cc b/chrome/browser/ui/browser_command_controller.cc
index 6808143..361a38a 100644
--- a/chrome/browser/ui/browser_command_controller.cc
+++ b/chrome/browser/ui/browser_command_controller.cc
@@ -405,6 +405,12 @@
case IDC_TOGGLE_FULLSCREEN_TOOLBAR:
chrome::ToggleFullscreenToolbar(browser_);
break;
+ case IDC_TOGGLE_JAVASCRIPT_APPLE_EVENTS: {
+ PrefService* prefs = profile()->GetPrefs();
+ prefs->SetBoolean(prefs::kAllowJavascriptAppleEvents,
+ !prefs->GetBoolean(prefs::kAllowJavascriptAppleEvents));
+ break;
+ }
#endif
case IDC_EXIT:
Exit();
@@ -988,6 +994,10 @@
dev_tools_enabled);
command_updater_.UpdateCommandEnabled(IDC_DEV_TOOLS_TOGGLE,
dev_tools_enabled);
+#if defined(OS_MACOSX)
+ command_updater_.UpdateCommandEnabled(IDC_TOGGLE_JAVASCRIPT_APPLE_EVENTS,
+ dev_tools_enabled);
+#endif
}
void BrowserCommandController::UpdateCommandsForBookmarkEditing() {