diff --git a/dom/base/nsDOMWindowUtils.cpp b/dom/base/nsDOMWindowUtils.cpp index 744e6a7dac2e..16e2e358a5d6 100644 --- a/dom/base/nsDOMWindowUtils.cpp +++ b/dom/base/nsDOMWindowUtils.cpp @@ -1673,9 +1673,9 @@ nsDOMWindowUtils::GetFullZoom(float* aFullZoom) { NS_IMETHODIMP nsDOMWindowUtils::DispatchDOMEventViaPresShell(nsINode* aTarget, Event* aEvent, - bool aTrusted, bool* aRetVal) { + bool* aRetVal) { NS_ENSURE_STATE(aEvent); - aEvent->SetTrusted(aTrusted); + aEvent->SetTrusted(true); WidgetEvent* internalEvent = aEvent->WidgetEventPtr(); NS_ENSURE_STATE(internalEvent); nsCOMPtr content = do_QueryInterface(aTarget); diff --git a/dom/events/crashtests/1397711.html b/dom/events/crashtests/1397711.html index 481ecbeda274..3b22ec5c3a4d 100644 --- a/dom/events/crashtests/1397711.html +++ b/dom/events/crashtests/1397711.html @@ -7,5 +7,5 @@ bubbles: true }); let utils = SpecialPowers.getDOMWindowUtils(window); - utils.dispatchDOMEventViaPresShell(document.documentElement, e, false); + utils.dispatchDOMEventViaPresShell(document.documentElement, e); diff --git a/dom/events/test/test_bug508479.html b/dom/events/test/test_bug508479.html index 9cf9e22b8a1d..b191a984d9ab 100644 --- a/dom/events/test/test_bug508479.html +++ b/dom/events/test/test_bug508479.html @@ -13,7 +13,7 @@ var gGotNotHandlingDrop = false; SimpleTest.waitForExplicitFinish(); function fireEvent(target, event) { - SpecialPowers.DOMWindowUtils.dispatchDOMEventViaPresShell(target, event, true); + SpecialPowers.DOMWindowUtils.dispatchDOMEventViaPresShell(target, event); } function fireDrop(element, shouldAllowDrop, shouldAllowOnlyChromeDrop) { diff --git a/dom/events/test/test_bug591249.xul b/dom/events/test/test_bug591249.xul index 22e0ad4fc776..05d109b87bda 100644 --- a/dom/events/test/test_bug591249.xul +++ b/dom/events/test/test_bug591249.xul @@ -31,7 +31,7 @@ function completeTest(aBox) { function fireEvent(target, event) { var win = target.ownerGlobal; var utils = win.windowUtils; - utils.dispatchDOMEventViaPresShell(target, event, true); + utils.dispatchDOMEventViaPresShell(target, event); } function RunTest() { diff --git a/dom/events/test/test_bug593959.html b/dom/events/test/test_bug593959.html index 9336167447b1..76008440349d 100644 --- a/dom/events/test/test_bug593959.html +++ b/dom/events/test/test_bug593959.html @@ -30,7 +30,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=593959 var e = document.createEvent("MouseEvent"); e.initEvent("mousedown", false, false, window, 0, 1, 1, 1, 1, false, false, false, false, 0, null); - utils.dispatchDOMEventViaPresShell(document.body, e, true); + utils.dispatchDOMEventViaPresShell(document.body, e); is(document.querySelector("body:active"), document.body, "body should be active!") @@ -41,7 +41,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=593959 var e2 = ifrwindow.document.createEvent("MouseEvent"); e2.initEvent("mouseup", false, false, ifrwindow, 0, 1, 1, 1, 1, false, false, false, false, 0, null); - utils2.dispatchDOMEventViaPresShell(ifrwindow.document.body, e2, true); + utils2.dispatchDOMEventViaPresShell(ifrwindow.document.body, e2); isnot(document.querySelector("body:active"), document.body, "body shouldn't be active!") diff --git a/dom/interfaces/base/nsIDOMWindowUtils.idl b/dom/interfaces/base/nsIDOMWindowUtils.idl index ad8468bf1695..4da15bd001e8 100644 --- a/dom/interfaces/base/nsIDOMWindowUtils.idl +++ b/dom/interfaces/base/nsIDOMWindowUtils.idl @@ -937,7 +937,8 @@ interface nsIDOMWindowUtils : nsISupports { readonly attribute float fullZoom; /** - * Dispatches aEvent via the nsIPresShell object of the window's document. + * Dispatches aEvent as a trusted event via the nsIPresShell object of the + * window's document. * The event is dispatched to aTarget, which should be an object * which implements nsIContent interface (#element, #text, etc). * @@ -948,9 +949,9 @@ interface nsIDOMWindowUtils : nsISupports { * @note Event handlers won't get aEvent as parameter, but a similar event. * Also, aEvent should not be reused. */ + [can_run_script] boolean dispatchDOMEventViaPresShell(in Node aTarget, - in Event aEvent, - in boolean aTrusted); + in Event aEvent); /** * Sets WidgetEvent::mFlags::mOnlyChromeDispatch to true to ensure that diff --git a/layout/base/tests/test_bug603550.html b/layout/base/tests/test_bug603550.html index 0df24f28b68c..79bfe22724d2 100644 --- a/layout/base/tests/test_bug603550.html +++ b/layout/base/tests/test_bug603550.html @@ -49,7 +49,7 @@ function sendMouseUp(el) { function fireEvent(target, event) { var utils = SpecialPowers.getDOMWindowUtils(window); - utils.dispatchDOMEventViaPresShell(target, event, true); + utils.dispatchDOMEventViaPresShell(target, event); } function fireDrop(element) { diff --git a/testing/mochitest/tests/SimpleTest/EventUtils.js b/testing/mochitest/tests/SimpleTest/EventUtils.js index aebb67fe8850..5387708f5288 100644 --- a/testing/mochitest/tests/SimpleTest/EventUtils.js +++ b/testing/mochitest/tests/SimpleTest/EventUtils.js @@ -260,7 +260,7 @@ function sendDragEvent(aEvent, aTarget, aWindow = window) { } var utils = _getDOMWindowUtils(aWindow); - return utils.dispatchDOMEventViaPresShell(aTarget, event, true); + return utils.dispatchDOMEventViaPresShell(aTarget, event); } /** diff --git a/toolkit/components/prompts/test/test_bug620145.html b/toolkit/components/prompts/test/test_bug620145.html index d8da1847e23e..75e21e4a0c86 100644 --- a/toolkit/components/prompts/test/test_bug620145.html +++ b/toolkit/components/prompts/test/test_bug620145.html @@ -85,7 +85,7 @@ function dispatchMouseEvent(target, type) { e.initEvent(type, false, false, win, 0, 1, 1, 1, 1, false, false, false, false, 0, null); var utils = SpecialPowers.getDOMWindowUtils(win); - utils.dispatchDOMEventViaPresShell(target, e, true); + utils.dispatchDOMEventViaPresShell(target, e); ok(true, type + " sent to " + target.id); } diff --git a/toolkit/components/prompts/test/test_subresources_prompts.html b/toolkit/components/prompts/test/test_subresources_prompts.html index 69ced062b65e..07f91735a827 100644 --- a/toolkit/components/prompts/test/test_subresources_prompts.html +++ b/toolkit/components/prompts/test/test_subresources_prompts.html @@ -193,7 +193,7 @@ function dispatchMouseEvent(target, type) { e.initEvent(type, false, false, win, 0, 1, 1, 1, 1, false, false, false, false, 0, null); var utils = SpecialPowers.getDOMWindowUtils(win); - utils.dispatchDOMEventViaPresShell(SpecialPowers.unwrap(target), e, true); + utils.dispatchDOMEventViaPresShell(SpecialPowers.unwrap(target), e); }