diff --git a/caps/nsIPrincipal.idl b/caps/nsIPrincipal.idl index 51a896396086..abc7b9665ab9 100644 --- a/caps/nsIPrincipal.idl +++ b/caps/nsIPrincipal.idl @@ -308,22 +308,15 @@ interface nsIPrincipal : nsISerializable * * @param scheme The scheme to be checked */ + [infallible] boolean schemeIs(in string scheme); - // Nicer, C++ Callable Version of SchemeIs - %{C++ - inline bool SchemeIs(const char* aScheme) { - bool ret; - SchemeIs(aScheme, &ret); - return ret; - } - %} - /* - * Checks if the Principal's URI is contained in the given Pref - * @param pref The pref to be checked - */ - bool isURIInPrefList(in string pref); + * Checks if the Principal's URI is contained in the given Pref + * @param pref The pref to be checked + */ + [infallible] + boolean isURIInPrefList(in string pref); /* * Uses NS_Security Compare to determine if the diff --git a/layout/base/PresShell.cpp b/layout/base/PresShell.cpp index 40676dca7319..68d22f4f8170 100644 --- a/layout/base/PresShell.cpp +++ b/layout/base/PresShell.cpp @@ -8641,41 +8641,25 @@ nsresult PresShell::EventHandler::DispatchEventToDOM( // behave so, however, some web apps may be broken. On such web apps, // we should keep using legacy our behavior. if (!mPresShell->mInitializedWithKeyPressEventDispatchingBlacklist) { - bool isInPrefList = false; mPresShell->mInitializedWithKeyPressEventDispatchingBlacklist = true; nsCOMPtr principal = GetDocumentPrincipalToCompareWithBlacklist(*mPresShell); if (principal) { - principal->IsURIInPrefList( - "dom.keyboardevent.keypress.hack.dispatch_non_printable_keys", - &isInPrefList); mPresShell->mForceDispatchKeyPressEventsForNonPrintableKeys = - isInPrefList; + principal->IsURIInPrefList( + "dom.keyboardevent.keypress.hack.dispatch_non_printable_" + "keys") || + principal->IsURIInPrefList( + "dom.keyboardevent.keypress.hack." + "dispatch_non_printable_keys.addl"); - principal->IsURIInPrefList( - "dom.keyboardevent.keypress.hack." - "dispatch_non_printable_keys.addl", - &isInPrefList); - mPresShell->mForceDispatchKeyPressEventsForNonPrintableKeys |= - isInPrefList; - - principal->IsURIInPrefList( - "dom.keyboardevent.keypress.hack." - "use_legacy_keycode_and_charcode", - &isInPrefList); - mPresShell->mForceUseLegacyKeyCodeAndCharCodeValues |= isInPrefList; - - principal->IsURIInPrefList( - "dom.keyboardevent.keypress.hack." - "use_legacy_keycode_and_charcode", - &isInPrefList); - mPresShell->mForceUseLegacyKeyCodeAndCharCodeValues |= isInPrefList; - - principal->IsURIInPrefList( - "dom.keyboardevent.keypress.hack." - "use_legacy_keycode_and_charcode.addl", - &isInPrefList); - mPresShell->mForceUseLegacyKeyCodeAndCharCodeValues |= isInPrefList; + mPresShell->mForceUseLegacyKeyCodeAndCharCodeValues |= + principal->IsURIInPrefList( + "dom.keyboardevent.keypress.hack." + "use_legacy_keycode_and_charcode") || + principal->IsURIInPrefList( + "dom.keyboardevent.keypress.hack." + "use_legacy_keycode_and_charcode.addl"); } } if (mPresShell->mForceDispatchKeyPressEventsForNonPrintableKeys) { @@ -8699,11 +8683,9 @@ nsresult PresShell::EventHandler::DispatchEventToDOM( GetDocumentPrincipalToCompareWithBlacklist(*mPresShell); if (principal) { - bool isInPrefList = false; - principal->IsURIInPrefList( - "dom.mouseevent.click.hack.use_legacy_non-primary_dispatch", - &isInPrefList); - mPresShell->mForceUseLegacyNonPrimaryDispatch = isInPrefList; + mPresShell->mForceUseLegacyNonPrimaryDispatch = + principal->IsURIInPrefList( + "dom.mouseevent.click.hack.use_legacy_non-primary_dispatch"); } } if (mPresShell->mForceUseLegacyNonPrimaryDispatch) {