Bug 1300769 - call ConstructPrototype only if mType is NS_HANDLER_TYPE_XUL. r=mrbkap

MozReview-Commit-ID: H7vS03mVj4s

--HG--
extra : rebase_source : 045747d04c04ba589f5b1e7c4a371bc727613fb4
This commit is contained in:
Andi-Bogdan Postelnicu 2016-09-07 11:01:51 +03:00
Родитель edc428d2f0
Коммит d8fd5713a3
1 изменённых файлов: 6 добавлений и 3 удалений

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

@ -737,6 +737,7 @@ nsXBLPrototypeHandler::ConstructPrototype(nsIContent* aKeyElement,
if (aKeyElement) { if (aKeyElement) {
mType |= NS_HANDLER_TYPE_XUL; mType |= NS_HANDLER_TYPE_XUL;
MOZ_ASSERT(!mPrototypeBinding);
nsCOMPtr<nsIWeakReference> weak = do_GetWeakReference(aKeyElement); nsCOMPtr<nsIWeakReference> weak = do_GetWeakReference(aKeyElement);
if (!weak) { if (!weak) {
return; return;
@ -836,12 +837,14 @@ nsXBLPrototypeHandler::ConstructPrototype(nsIContent* aKeyElement,
mMisc = 1; mMisc = 1;
mDetail = key[0]; mDetail = key[0];
const uint8_t GTK2Modifiers = cShift | cControl | cShiftMask | cControlMask; const uint8_t GTK2Modifiers = cShift | cControl | cShiftMask | cControlMask;
if ((mKeyMask & GTK2Modifiers) == GTK2Modifiers && if ((mType & NS_HANDLER_TYPE_XUL) &&
(mKeyMask & GTK2Modifiers) == GTK2Modifiers &&
modifiers.First() != char16_t(',') && modifiers.First() != char16_t(',') &&
(mDetail == 'u' || mDetail == 'U')) (mDetail == 'u' || mDetail == 'U'))
ReportKeyConflict(key.get(), modifiers.get(), aKeyElement, "GTK2Conflict2"); ReportKeyConflict(key.get(), modifiers.get(), aKeyElement, "GTK2Conflict2");
const uint8_t WinModifiers = cControl | cAlt | cControlMask | cAltMask; const uint8_t WinModifiers = cControl | cAlt | cControlMask | cAltMask;
if ((mKeyMask & WinModifiers) == WinModifiers && if ((mType & NS_HANDLER_TYPE_XUL) &&
(mKeyMask & WinModifiers) == WinModifiers &&
modifiers.First() != char16_t(',') && modifiers.First() != char16_t(',') &&
(('A' <= mDetail && mDetail <= 'Z') || (('A' <= mDetail && mDetail <= 'Z') ||
('a' <= mDetail && mDetail <= 'z'))) ('a' <= mDetail && mDetail <= 'z')))
@ -885,7 +888,7 @@ nsXBLPrototypeHandler::ReportKeyConflict(const char16_t* aKey, const char16_t* a
if (docInfo) { if (docInfo) {
doc = docInfo->GetDocument(); doc = docInfo->GetDocument();
} }
} else if (aKeyElement) { } else {
doc = aKeyElement->OwnerDoc(); doc = aKeyElement->OwnerDoc();
} }