Bug 1271125 part 1 - wrap() only for non-chrome; r=jmaher

Checking window.Components is a heuristic already used at the top of the
file for initializing _EU_C*, and it seems to work on try.

MozReview-Commit-ID: 3nbFAEJMY7h
This commit is contained in:
Aryeh Gregor 2016-10-29 22:54:42 +03:00
Родитель 9fc7d0745c
Коммит 123bc81472
1 изменённых файлов: 4 добавлений и 1 удалений

Просмотреть файл

@ -1815,7 +1815,10 @@ function synthesizeDragStart(element, expectedDragData, aWindow, x, y)
var result = "trapDrag was not called";
var trapDrag = function(event) {
try {
var dataTransfer = event.dataTransfer;
// We must wrap only in plain mochitests, not chrome
var c = Object.getOwnPropertyDescriptor(window, 'Components');
var dataTransfer = c.value && !c.writable
? event.dataTransfer : SpecialPowers.wrap(event.dataTransfer);
result = null;
if (!dataTransfer)
throw "no dataTransfer";