Currently such promises can only be resolved (meaning successfully fulfilled). Need a way to also reject.
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/8b4b5952c3259661772fb882053bbe67b9de2a67 commit 8b4b5952c3259661772fb882053bbe67b9de2a67 Author: dpapad <dpapad@chromium.org> Date: Thu Mar 03 21:56:50 2016 WebUI: Allow rejecting a promise that is returned from cr.sendWithPromise(). - Moving PromiseResolver helper class such that it can be used from cr.js - Updating cr.webUIResponse to accept an isSuccess parameter. - Renaming SettingsPageUIHandler#CallJavascriptCallback to ResolveJavascriptCallback, and adding new RejectJavascriptCallback method. - Adding test. BUG= 591266 Review URL: https://codereview.chromium.org/1758013002 Cr-Commit-Position: refs/heads/master@{#379104} [modify] https://crrev.com/8b4b5952c3259661772fb882053bbe67b9de2a67/chrome/browser/ui/webui/settings/appearance_handler.cc [modify] https://crrev.com/8b4b5952c3259661772fb882053bbe67b9de2a67/chrome/browser/ui/webui/settings/md_settings_ui.cc [modify] https://crrev.com/8b4b5952c3259661772fb882053bbe67b9de2a67/chrome/browser/ui/webui/settings/md_settings_ui.h [modify] https://crrev.com/8b4b5952c3259661772fb882053bbe67b9de2a67/chrome/browser/ui/webui/settings/search_engines_handler.cc [modify] https://crrev.com/8b4b5952c3259661772fb882053bbe67b9de2a67/chrome/browser/ui/webui/settings/site_settings_handler.cc [modify] https://crrev.com/8b4b5952c3259661772fb882053bbe67b9de2a67/chrome/test/data/webui/settings/cr_settings_browsertest.js [modify] https://crrev.com/8b4b5952c3259661772fb882053bbe67b9de2a67/chrome/test/data/webui/webui_resource_async_browsertest.js [modify] https://crrev.com/8b4b5952c3259661772fb882053bbe67b9de2a67/ui/webui/resources/html/cr.html [add] https://crrev.com/8b4b5952c3259661772fb882053bbe67b9de2a67/ui/webui/resources/html/promise_resolver.html [modify] https://crrev.com/8b4b5952c3259661772fb882053bbe67b9de2a67/ui/webui/resources/js/cr.js [rename] https://crrev.com/8b4b5952c3259661772fb882053bbe67b9de2a67/ui/webui/resources/js/promise_resolver.js [modify] https://crrev.com/8b4b5952c3259661772fb882053bbe67b9de2a67/ui/webui/resources/webui_resources.grd
Comment 1 by dpa...@chromium.org
, Mar 2 2016