mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge m-c to s-c.
This commit is contained in:
commit
25d5f8fd55
@ -80,7 +80,7 @@ default alldep all:: $(topsrcdir)/configure config.status
|
||||
$(RM) -r $(DIST)/include
|
||||
$(RM) -r $(DIST)/private
|
||||
$(RM) -r $(DIST)/public
|
||||
$(RM) $(DIST)/chrome.manifest
|
||||
$(RM) $(DIST)/bin/chrome.manifest $(DIST)/bin/components/components.manifest
|
||||
$(RM) -r _tests
|
||||
|
||||
$(topsrcdir)/configure: $(topsrcdir)/configure.in
|
||||
|
@ -62,7 +62,7 @@ public:
|
||||
AccEvent(uint32_t aEventType, Accessible* aAccessible,
|
||||
EIsFromUserInput aIsFromUserInput = eAutoDetect,
|
||||
EEventRule aEventRule = eRemoveDupes);
|
||||
// Initialize with an nsIDOMNode
|
||||
// Initialize with an nsINode
|
||||
AccEvent(uint32_t aEventType, nsINode* aNode,
|
||||
EIsFromUserInput aIsFromUserInput = eAutoDetect,
|
||||
EEventRule aEventRule = eRemoveDupes);
|
||||
|
44
accessible/src/base/AccTypes.h
Normal file
44
accessible/src/base/AccTypes.h
Normal file
@ -0,0 +1,44 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
/**
|
||||
* Accessible object types used when creating an accessible based on the frame.
|
||||
*/
|
||||
enum AccType {
|
||||
eNoAccessible,
|
||||
eHTMLBRAccessible,
|
||||
eHTMLButtonAccessible,
|
||||
eHTMLCanvasAccessible,
|
||||
eHTMLCaptionAccessible,
|
||||
eHTMLCheckboxAccessible,
|
||||
eHTMLComboboxAccessible,
|
||||
eHTMLFileInputAccessible,
|
||||
eHTMLGroupboxAccessible,
|
||||
eHTMLHRAccessible,
|
||||
eHTMLImageMapAccessible,
|
||||
eHTMLLabelAccessible,
|
||||
eHTMLLiAccessible,
|
||||
eHTMLSelectListAccessible,
|
||||
eHTMLMediaAccessible,
|
||||
eHTMLObjectFrameAccessible,
|
||||
eHTMLRadioButtonAccessible,
|
||||
eHTMLTableAccessible,
|
||||
eHTMLTableCellAccessible,
|
||||
eHTMLTableRowAccessible,
|
||||
eHTMLTextFieldAccessible,
|
||||
eHyperTextAccessible,
|
||||
eImageAccessible,
|
||||
eOuterDocAccessible,
|
||||
eTextLeafAccessible
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -58,6 +58,7 @@ EXPORTS_NAMESPACES = mozilla/a11y
|
||||
|
||||
EXPORTS_mozilla/a11y = \
|
||||
FocusManager.h \
|
||||
AccTypes.h \
|
||||
States.h \
|
||||
Role.h \
|
||||
$(NULL)
|
||||
|
@ -40,7 +40,14 @@ public:
|
||||
*/
|
||||
DocAccessible* GetDocAccessible(const nsIPresShell* aPresShell)
|
||||
{
|
||||
return aPresShell ? GetDocAccessible(aPresShell->GetDocument()) : nullptr;
|
||||
if (!aPresShell)
|
||||
return nullptr;
|
||||
|
||||
DocAccessible* doc = aPresShell->GetDocAccessible();
|
||||
if (doc)
|
||||
return doc;
|
||||
|
||||
return GetDocAccessible(aPresShell->GetDocument());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIPersistentProperties2.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsPoint.h"
|
||||
|
@ -167,141 +167,10 @@ nsAccessibilityService::GetRootDocumentAccessible(nsIPresShell* aPresShell,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
already_AddRefed<Accessible>
|
||||
nsAccessibilityService::CreateOuterDocAccessible(nsIContent* aContent,
|
||||
nsIPresShell* aPresShell)
|
||||
{
|
||||
Accessible* accessible =
|
||||
new OuterDocAccessible(aContent, GetDocAccessible(aPresShell));
|
||||
NS_ADDREF(accessible);
|
||||
return accessible;
|
||||
}
|
||||
|
||||
already_AddRefed<Accessible>
|
||||
nsAccessibilityService::CreateHTMLButtonAccessible(nsIContent* aContent,
|
||||
nsIPresShell* aPresShell)
|
||||
{
|
||||
Accessible* accessible =
|
||||
new HTMLButtonAccessible(aContent, GetDocAccessible(aPresShell));
|
||||
NS_ADDREF(accessible);
|
||||
return accessible;
|
||||
}
|
||||
|
||||
already_AddRefed<Accessible>
|
||||
nsAccessibilityService::CreateHTMLLIAccessible(nsIContent* aContent,
|
||||
nsIPresShell* aPresShell)
|
||||
{
|
||||
Accessible* accessible =
|
||||
new HTMLLIAccessible(aContent, GetDocAccessible(aPresShell));
|
||||
NS_ADDREF(accessible);
|
||||
return accessible;
|
||||
}
|
||||
|
||||
already_AddRefed<Accessible>
|
||||
nsAccessibilityService::CreateHyperTextAccessible(nsIContent* aContent,
|
||||
nsIPresShell* aPresShell)
|
||||
{
|
||||
Accessible* accessible =
|
||||
new HyperTextAccessibleWrap(aContent, GetDocAccessible(aPresShell));
|
||||
NS_ADDREF(accessible);
|
||||
return accessible;
|
||||
}
|
||||
|
||||
already_AddRefed<Accessible>
|
||||
nsAccessibilityService::CreateHTMLCheckboxAccessible(nsIContent* aContent,
|
||||
nsIPresShell* aPresShell)
|
||||
{
|
||||
Accessible* accessible =
|
||||
new HTMLCheckboxAccessible(aContent, GetDocAccessible(aPresShell));
|
||||
NS_ADDREF(accessible);
|
||||
return accessible;
|
||||
}
|
||||
|
||||
already_AddRefed<Accessible>
|
||||
nsAccessibilityService::CreateHTMLComboboxAccessible(nsIContent* aContent,
|
||||
nsIPresShell* aPresShell)
|
||||
{
|
||||
Accessible* accessible =
|
||||
new HTMLComboboxAccessible(aContent, GetDocAccessible(aPresShell));
|
||||
NS_ADDREF(accessible);
|
||||
return accessible;
|
||||
}
|
||||
|
||||
already_AddRefed<Accessible>
|
||||
nsAccessibilityService::CreateHTMLCanvasAccessible(nsIContent* aContent,
|
||||
nsIPresShell* aPresShell)
|
||||
{
|
||||
Accessible* accessible =
|
||||
new HTMLCanvasAccessible(aContent, GetDocAccessible(aPresShell));
|
||||
NS_ADDREF(accessible);
|
||||
return accessible;
|
||||
}
|
||||
|
||||
already_AddRefed<Accessible>
|
||||
nsAccessibilityService::CreateHTMLFileInputAccessible(nsIContent* aContent,
|
||||
nsIPresShell* aPresShell)
|
||||
{
|
||||
Accessible* accessible =
|
||||
new HTMLFileInputAccessible(aContent, GetDocAccessible(aPresShell));
|
||||
NS_ADDREF(accessible);
|
||||
return accessible;
|
||||
}
|
||||
|
||||
already_AddRefed<Accessible>
|
||||
nsAccessibilityService::CreateHTMLImageAccessible(nsIContent* aContent,
|
||||
nsIPresShell* aPresShell)
|
||||
{
|
||||
Accessible* accessible =
|
||||
new ImageAccessibleWrap(aContent, GetDocAccessible(aPresShell));
|
||||
NS_ADDREF(accessible);
|
||||
return accessible;
|
||||
}
|
||||
|
||||
already_AddRefed<Accessible>
|
||||
nsAccessibilityService::CreateHTMLImageMapAccessible(nsIContent* aContent,
|
||||
nsIPresShell* aPresShell)
|
||||
{
|
||||
Accessible* accessible =
|
||||
new HTMLImageMapAccessible(aContent, GetDocAccessible(aPresShell));
|
||||
NS_ADDREF(accessible);
|
||||
return accessible;
|
||||
}
|
||||
|
||||
already_AddRefed<Accessible>
|
||||
nsAccessibilityService::CreateHTMLGroupboxAccessible(nsIContent* aContent,
|
||||
nsIPresShell* aPresShell)
|
||||
{
|
||||
Accessible* accessible =
|
||||
new HTMLGroupboxAccessible(aContent, GetDocAccessible(aPresShell));
|
||||
NS_ADDREF(accessible);
|
||||
return accessible;
|
||||
}
|
||||
|
||||
already_AddRefed<Accessible>
|
||||
nsAccessibilityService::CreateHTMLListboxAccessible(nsIContent* aContent,
|
||||
nsIPresShell* aPresShell)
|
||||
{
|
||||
Accessible* accessible =
|
||||
new HTMLSelectListAccessible(aContent, GetDocAccessible(aPresShell));
|
||||
NS_ADDREF(accessible);
|
||||
return accessible;
|
||||
}
|
||||
|
||||
already_AddRefed<Accessible>
|
||||
nsAccessibilityService::CreateHTMLMediaAccessible(nsIContent* aContent,
|
||||
nsIPresShell* aPresShell)
|
||||
{
|
||||
Accessible* accessible =
|
||||
new EnumRoleAccessible(aContent, GetDocAccessible(aPresShell),
|
||||
roles::GROUPING);
|
||||
NS_ADDREF(accessible);
|
||||
return accessible;
|
||||
}
|
||||
|
||||
already_AddRefed<Accessible>
|
||||
nsAccessibilityService::CreateHTMLObjectFrameAccessible(nsObjectFrame* aFrame,
|
||||
nsIContent* aContent,
|
||||
nsIPresShell* aPresShell)
|
||||
DocAccessible* aDoc)
|
||||
{
|
||||
// We can have several cases here:
|
||||
// 1) a text or html embedded document where the contentDocument variable in
|
||||
@ -314,14 +183,16 @@ nsAccessibilityService::CreateHTMLObjectFrameAccessible(nsObjectFrame* aFrame,
|
||||
if (aFrame->GetRect().IsEmpty())
|
||||
return nullptr;
|
||||
|
||||
|
||||
// 1) for object elements containing either HTML or TXT documents
|
||||
nsCOMPtr<nsIDOMHTMLObjectElement> obj(do_QueryInterface(aContent));
|
||||
if (obj) {
|
||||
nsCOMPtr<nsIDOMDocument> domDoc;
|
||||
obj->GetContentDocument(getter_AddRefs(domDoc));
|
||||
if (domDoc)
|
||||
return CreateOuterDocAccessible(aContent, aPresShell);
|
||||
if (domDoc) {
|
||||
Accessible* newAcc = new OuterDocAccessible(aContent, aDoc);
|
||||
NS_ADDREF(newAcc);
|
||||
return newAcc;
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(XP_WIN) || defined(MOZ_ACCESSIBILITY_ATK)
|
||||
@ -335,8 +206,7 @@ nsAccessibilityService::CreateHTMLObjectFrameAccessible(nsObjectFrame* aFrame,
|
||||
aFrame->GetPluginPort(&pluginPort);
|
||||
|
||||
Accessible* accessible =
|
||||
new HTMLWin32ObjectOwnerAccessible(aContent, GetDocAccessible(aPresShell),
|
||||
pluginPort);
|
||||
new HTMLWin32ObjectOwnerAccessible(aContent, aDoc, pluginPort);
|
||||
NS_ADDREF(accessible);
|
||||
return accessible;
|
||||
|
||||
@ -349,8 +219,7 @@ nsAccessibilityService::CreateHTMLObjectFrameAccessible(nsObjectFrame* aFrame,
|
||||
NPPVpluginNativeAccessibleAtkPlugId, &plugId);
|
||||
if (NS_SUCCEEDED(rv) && !plugId.IsEmpty()) {
|
||||
AtkSocketAccessible* socketAccessible =
|
||||
new AtkSocketAccessible(aContent, GetDocAccessible(aPresShell),
|
||||
plugId);
|
||||
new AtkSocketAccessible(aContent, aDoc, plugId);
|
||||
|
||||
NS_ADDREF(socketAccessible);
|
||||
return socketAccessible;
|
||||
@ -361,108 +230,9 @@ nsAccessibilityService::CreateHTMLObjectFrameAccessible(nsObjectFrame* aFrame,
|
||||
|
||||
// 3) for images and imagemaps, or anything else with a child frame
|
||||
// we have the object frame, get the image frame
|
||||
nsIFrame* frame = aFrame->GetFirstPrincipalChild();
|
||||
return frame ? frame->CreateAccessible() : nullptr;
|
||||
}
|
||||
|
||||
already_AddRefed<Accessible>
|
||||
nsAccessibilityService::CreateHTMLRadioButtonAccessible(nsIContent* aContent,
|
||||
nsIPresShell* aPresShell)
|
||||
{
|
||||
Accessible* accessible =
|
||||
new HTMLRadioButtonAccessible(aContent, GetDocAccessible(aPresShell));
|
||||
NS_ADDREF(accessible);
|
||||
return accessible;
|
||||
}
|
||||
|
||||
already_AddRefed<Accessible>
|
||||
nsAccessibilityService::CreateHTMLTableAccessible(nsIContent* aContent,
|
||||
nsIPresShell* aPresShell)
|
||||
{
|
||||
Accessible* accessible =
|
||||
new HTMLTableAccessibleWrap(aContent, GetDocAccessible(aPresShell));
|
||||
NS_ADDREF(accessible);
|
||||
return accessible;
|
||||
}
|
||||
|
||||
already_AddRefed<Accessible>
|
||||
nsAccessibilityService::CreateHTMLTableCellAccessible(nsIContent* aContent,
|
||||
nsIPresShell* aPresShell)
|
||||
{
|
||||
Accessible* accessible =
|
||||
new HTMLTableCellAccessibleWrap(aContent, GetDocAccessible(aPresShell));
|
||||
NS_ADDREF(accessible);
|
||||
return accessible;
|
||||
}
|
||||
|
||||
already_AddRefed<Accessible>
|
||||
nsAccessibilityService::CreateHTMLTableRowAccessible(nsIContent* aContent,
|
||||
nsIPresShell* aPresShell)
|
||||
{
|
||||
Accessible* accessible =
|
||||
new EnumRoleAccessible(aContent, GetDocAccessible(aPresShell), roles::ROW);
|
||||
NS_ADDREF(accessible);
|
||||
return accessible;
|
||||
}
|
||||
|
||||
already_AddRefed<Accessible>
|
||||
nsAccessibilityService::CreateTextLeafAccessible(nsIContent* aContent,
|
||||
nsIPresShell* aPresShell)
|
||||
{
|
||||
Accessible* accessible =
|
||||
new TextLeafAccessibleWrap(aContent, GetDocAccessible(aPresShell));
|
||||
NS_ADDREF(accessible);
|
||||
return accessible;
|
||||
}
|
||||
|
||||
already_AddRefed<Accessible>
|
||||
nsAccessibilityService::CreateHTMLTextFieldAccessible(nsIContent* aContent,
|
||||
nsIPresShell* aPresShell)
|
||||
{
|
||||
Accessible* accessible =
|
||||
new HTMLTextFieldAccessible(aContent, GetDocAccessible(aPresShell));
|
||||
NS_ADDREF(accessible);
|
||||
return accessible;
|
||||
}
|
||||
|
||||
already_AddRefed<Accessible>
|
||||
nsAccessibilityService::CreateHTMLLabelAccessible(nsIContent* aContent,
|
||||
nsIPresShell* aPresShell)
|
||||
{
|
||||
Accessible* accessible =
|
||||
new HTMLLabelAccessible(aContent, GetDocAccessible(aPresShell));
|
||||
NS_ADDREF(accessible);
|
||||
return accessible;
|
||||
}
|
||||
|
||||
already_AddRefed<Accessible>
|
||||
nsAccessibilityService::CreateHTMLHRAccessible(nsIContent* aContent,
|
||||
nsIPresShell* aPresShell)
|
||||
{
|
||||
Accessible* accessible =
|
||||
new HTMLHRAccessible(aContent, GetDocAccessible(aPresShell));
|
||||
NS_ADDREF(accessible);
|
||||
return accessible;
|
||||
}
|
||||
|
||||
already_AddRefed<Accessible>
|
||||
nsAccessibilityService::CreateHTMLBRAccessible(nsIContent* aContent,
|
||||
nsIPresShell* aPresShell)
|
||||
{
|
||||
Accessible* accessible =
|
||||
new HTMLBRAccessible(aContent, GetDocAccessible(aPresShell));
|
||||
NS_ADDREF(accessible);
|
||||
return accessible;
|
||||
}
|
||||
|
||||
already_AddRefed<Accessible>
|
||||
nsAccessibilityService::CreateHTMLCaptionAccessible(nsIContent* aContent,
|
||||
nsIPresShell* aPresShell)
|
||||
{
|
||||
Accessible* accessible =
|
||||
new HTMLCaptionAccessible(aContent, GetDocAccessible(aPresShell));
|
||||
NS_ADDREF(accessible);
|
||||
return accessible;
|
||||
nsIFrame* childFrame = aFrame->GetFirstPrincipalChild();
|
||||
return childFrame ? CreateAccessibleByFrameType(childFrame, aContent, aDoc) :
|
||||
nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
@ -953,7 +723,7 @@ nsAccessibilityService::GetOrCreateAccessible(nsINode* aNode,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
newAcc = frame->CreateAccessible();
|
||||
newAcc = CreateAccessibleByFrameType(frame, content, aDoc);
|
||||
if (aDoc->BindToDocument(newAcc, nullptr)) {
|
||||
newAcc->AsTextLeaf()->SetText(text);
|
||||
return newAcc;
|
||||
@ -1110,7 +880,7 @@ nsAccessibilityService::GetOrCreateAccessible(nsINode* aNode,
|
||||
}
|
||||
|
||||
// Try using frame to do it.
|
||||
newAcc = frame->CreateAccessible();
|
||||
newAcc = CreateAccessibleByFrameType(frame, content, aDoc);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1659,6 +1429,95 @@ nsAccessibilityService::CreateHTMLAccessibleByMarkup(nsIFrame* aFrame,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
already_AddRefed<Accessible>
|
||||
nsAccessibilityService::CreateAccessibleByFrameType(nsIFrame* aFrame,
|
||||
nsIContent* aContent,
|
||||
DocAccessible* aDoc)
|
||||
{
|
||||
nsRefPtr<Accessible> newAcc;
|
||||
switch (aFrame->AccessibleType()) {
|
||||
case eNoAccessible:
|
||||
return nullptr;
|
||||
case eHTMLBRAccessible:
|
||||
newAcc = new HTMLBRAccessible(aContent, aDoc);
|
||||
break;
|
||||
case eHTMLButtonAccessible:
|
||||
newAcc = new HTMLButtonAccessible(aContent, aDoc);
|
||||
break;
|
||||
case eHTMLCanvasAccessible:
|
||||
newAcc = new HTMLCanvasAccessible(aContent, aDoc);
|
||||
break;
|
||||
case eHTMLCaptionAccessible:
|
||||
newAcc = new HTMLCaptionAccessible(aContent, aDoc);
|
||||
break;
|
||||
case eHTMLCheckboxAccessible:
|
||||
newAcc = new HTMLCheckboxAccessible(aContent, aDoc);
|
||||
break;
|
||||
case eHTMLComboboxAccessible:
|
||||
newAcc = new HTMLComboboxAccessible(aContent, aDoc);
|
||||
break;
|
||||
case eHTMLFileInputAccessible:
|
||||
newAcc = new HTMLFileInputAccessible(aContent, aDoc);
|
||||
break;
|
||||
case eHTMLGroupboxAccessible:
|
||||
newAcc = new HTMLGroupboxAccessible(aContent, aDoc);
|
||||
break;
|
||||
case eHTMLHRAccessible:
|
||||
newAcc = new HTMLHRAccessible(aContent, aDoc);
|
||||
break;
|
||||
case eHTMLImageMapAccessible:
|
||||
newAcc = new HTMLImageMapAccessible(aContent, aDoc);
|
||||
break;
|
||||
case eHTMLLabelAccessible:
|
||||
newAcc = new HTMLLabelAccessible(aContent, aDoc);
|
||||
break;
|
||||
case eHTMLLiAccessible:
|
||||
newAcc = new HTMLLIAccessible(aContent, aDoc);
|
||||
break;
|
||||
case eHTMLSelectListAccessible:
|
||||
newAcc = new HTMLSelectListAccessible(aContent, aDoc);
|
||||
break;
|
||||
case eHTMLMediaAccessible:
|
||||
newAcc = new EnumRoleAccessible(aContent, aDoc, roles::GROUPING);
|
||||
break;
|
||||
case eHTMLObjectFrameAccessible: {
|
||||
nsObjectFrame* objectFrame = do_QueryFrame(aFrame);
|
||||
newAcc = CreateHTMLObjectFrameAccessible(objectFrame, aContent, aDoc);
|
||||
break;
|
||||
}
|
||||
|
||||
case eHTMLRadioButtonAccessible:
|
||||
newAcc = new HTMLRadioButtonAccessible(aContent, aDoc);
|
||||
break;
|
||||
case eHTMLTableAccessible:
|
||||
newAcc = new HTMLTableAccessibleWrap(aContent, aDoc);
|
||||
break;
|
||||
case eHTMLTableCellAccessible:
|
||||
newAcc = new HTMLTableCellAccessibleWrap(aContent, aDoc);
|
||||
break;
|
||||
case eHTMLTableRowAccessible:
|
||||
newAcc = new EnumRoleAccessible(aContent, aDoc, roles::ROW);
|
||||
break;
|
||||
case eHTMLTextFieldAccessible:
|
||||
newAcc = new HTMLTextFieldAccessible(aContent, aDoc);
|
||||
break;
|
||||
case eHyperTextAccessible:
|
||||
newAcc = new HyperTextAccessibleWrap(aContent, aDoc);
|
||||
break;
|
||||
case eImageAccessible:
|
||||
newAcc = new ImageAccessibleWrap(aContent, aDoc);
|
||||
break;
|
||||
case eOuterDocAccessible:
|
||||
newAcc = new OuterDocAccessible(aContent, aDoc);
|
||||
break;
|
||||
case eTextLeafAccessible:
|
||||
newAcc = new TextLeafAccessibleWrap(aContent, aDoc);
|
||||
break;
|
||||
}
|
||||
|
||||
return newAcc.forget();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIAccessibilityService (DON'T put methods here)
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "nsIObserver.h"
|
||||
|
||||
class nsImageFrame;
|
||||
class nsObjectFrame;
|
||||
class nsITreeView;
|
||||
|
||||
namespace mozilla {
|
||||
@ -79,55 +80,9 @@ public:
|
||||
// nsIAccessibilityService
|
||||
virtual Accessible* GetRootDocumentAccessible(nsIPresShell* aPresShell,
|
||||
bool aCanCreate);
|
||||
already_AddRefed<Accessible>
|
||||
CreateHTMLButtonAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
|
||||
already_AddRefed<Accessible>
|
||||
CreateHTMLBRAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
|
||||
already_AddRefed<Accessible>
|
||||
CreateHTMLCanvasAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
|
||||
already_AddRefed<Accessible>
|
||||
CreateHTMLCaptionAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
|
||||
already_AddRefed<Accessible>
|
||||
CreateHTMLCheckboxAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
|
||||
already_AddRefed<Accessible>
|
||||
CreateHTMLComboboxAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
|
||||
already_AddRefed<Accessible>
|
||||
CreateHTMLFileInputAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
|
||||
already_AddRefed<Accessible>
|
||||
CreateHTMLGroupboxAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
|
||||
already_AddRefed<Accessible>
|
||||
CreateHTMLHRAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
|
||||
already_AddRefed<Accessible>
|
||||
CreateHTMLImageAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
|
||||
already_AddRefed<Accessible>
|
||||
CreateHTMLImageMapAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
|
||||
already_AddRefed<Accessible>
|
||||
CreateHTMLLabelAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
|
||||
already_AddRefed<Accessible>
|
||||
CreateHTMLLIAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
|
||||
already_AddRefed<Accessible>
|
||||
CreateHTMLListboxAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
|
||||
already_AddRefed<Accessible>
|
||||
CreateHTMLMediaAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
|
||||
already_AddRefed<Accessible>
|
||||
CreateHTMLObjectFrameAccessible(nsObjectFrame* aFrame, nsIContent* aContent,
|
||||
nsIPresShell* aPresShell);
|
||||
already_AddRefed<Accessible>
|
||||
CreateHTMLRadioButtonAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
|
||||
already_AddRefed<Accessible>
|
||||
CreateHTMLTableAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
|
||||
already_AddRefed<Accessible>
|
||||
CreateHTMLTableCellAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
|
||||
already_AddRefed<Accessible>
|
||||
CreateHTMLTableRowAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
|
||||
already_AddRefed<Accessible>
|
||||
CreateTextLeafAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
|
||||
already_AddRefed<Accessible>
|
||||
CreateHTMLTextFieldAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
|
||||
already_AddRefed<Accessible>
|
||||
CreateHyperTextAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
|
||||
already_AddRefed<Accessible>
|
||||
CreateOuterDocAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
|
||||
DocAccessible* aDoc);
|
||||
|
||||
/**
|
||||
* Adds/remove ATK root accessible for gtk+ native window to/from children
|
||||
@ -239,6 +194,13 @@ private:
|
||||
DocAccessible* aDoc,
|
||||
bool aIsLegalPartOfHTMLTable);
|
||||
|
||||
/**
|
||||
* Create an accessible whose type depends on the given frame.
|
||||
*/
|
||||
already_AddRefed<Accessible>
|
||||
CreateAccessibleByFrameType(nsIFrame* aFrame, nsIContent* aContent,
|
||||
DocAccessible* aDoc);
|
||||
|
||||
/**
|
||||
* Create accessible if parent is a deck frame.
|
||||
*/
|
||||
|
@ -481,26 +481,6 @@ nsCoreUtils::IsErrorPage(nsIDocument *aDocument)
|
||||
return StringBeginsWith(path, neterror) || StringBeginsWith(path, certerror);
|
||||
}
|
||||
|
||||
already_AddRefed<nsIDOMNode>
|
||||
nsCoreUtils::GetDOMNodeForContainer(nsIDocShellTreeItem *aContainer)
|
||||
{
|
||||
nsCOMPtr<nsIDocShell> shell = do_QueryInterface(aContainer);
|
||||
|
||||
nsCOMPtr<nsIContentViewer> cv;
|
||||
shell->GetContentViewer(getter_AddRefs(cv));
|
||||
|
||||
if (!cv)
|
||||
return nullptr;
|
||||
|
||||
nsIDocument* doc = cv->GetDocument();
|
||||
if (!doc)
|
||||
return nullptr;
|
||||
|
||||
nsIDOMNode* node = nullptr;
|
||||
CallQueryInterface(doc, &node);
|
||||
return node;
|
||||
}
|
||||
|
||||
bool
|
||||
nsCoreUtils::GetID(nsIContent *aContent, nsAString& aID)
|
||||
{
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include "nsTArray.h"
|
||||
|
||||
class nsRange;
|
||||
class nsIDOMNode;
|
||||
class nsIFrame;
|
||||
class nsIDocShellTreeItem;
|
||||
class nsITreeColumn;
|
||||
@ -209,12 +208,6 @@ public:
|
||||
return aNode->OwnerDoc()->GetShell();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return document node for the given document shell tree item.
|
||||
*/
|
||||
static already_AddRefed<nsIDOMNode>
|
||||
GetDOMNodeForContainer(nsIDocShellTreeItem *aContainer);
|
||||
|
||||
/**
|
||||
* Get the ID for an element, in some types of XML this may not be the ID attribute
|
||||
* @param aContent Node to get the ID for
|
||||
|
@ -505,6 +505,8 @@ public:
|
||||
|
||||
inline bool IsMenuPopup() const { return mFlags & eMenuPopupAccessible; }
|
||||
|
||||
inline bool IsProgress() const { return mFlags & eProgressAccessible; }
|
||||
|
||||
inline bool IsRoot() const { return mFlags & eRootAccessible; }
|
||||
mozilla::a11y::RootAccessible* AsRoot();
|
||||
|
||||
@ -776,10 +778,11 @@ protected:
|
||||
eListControlAccessible = 1 << 17,
|
||||
eMenuButtonAccessible = 1 << 18,
|
||||
eMenuPopupAccessible = 1 << 19,
|
||||
eRootAccessible = 1 << 20,
|
||||
eTextLeafAccessible = 1 << 21,
|
||||
eXULDeckAccessible = 1 << 22,
|
||||
eXULTreeAccessible = 1 << 23
|
||||
eProgressAccessible = 1 << 20,
|
||||
eRootAccessible = 1 << 21,
|
||||
eTextLeafAccessible = 1 << 22,
|
||||
eXULDeckAccessible = 1 << 23,
|
||||
eXULTreeAccessible = 1 << 24
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include "nsIURI.h"
|
||||
#include "nsIWebNavigation.h"
|
||||
#include "nsFocusManager.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
|
||||
#ifdef A11Y_LOG
|
||||
@ -85,8 +86,8 @@ DocAccessible::
|
||||
mPresShell(aPresShell)
|
||||
{
|
||||
mFlags |= eDocAccessible | eNotNodeMapEntry;
|
||||
if (mPresShell)
|
||||
mPresShell->SetAccDocument(this);
|
||||
MOZ_ASSERT(mPresShell, "should have been given a pres shell");
|
||||
mPresShell->SetDocAccessible(this);
|
||||
|
||||
mDependentIDsHash.Init();
|
||||
// XXX aaronl should we use an algorithm for the initial cache size?
|
||||
@ -636,7 +637,7 @@ DocAccessible::Shutdown()
|
||||
logging::DocDestroy("document shutdown", mDocument, this);
|
||||
#endif
|
||||
|
||||
mPresShell->SetAccDocument(nullptr);
|
||||
mPresShell->SetDocAccessible(nullptr);
|
||||
|
||||
if (mNotificationController) {
|
||||
mNotificationController->Shutdown();
|
||||
@ -1121,6 +1122,14 @@ DocAccessible::AttributeChangedImpl(nsIContent* aContent, int32_t aNameSpaceID,
|
||||
FireDelayedAccessibleEvent(editableChangeEvent);
|
||||
return;
|
||||
}
|
||||
|
||||
if (aAttribute == nsGkAtoms::value) {
|
||||
Accessible* accessible = GetAccessible(aContent);
|
||||
if(accessible && accessible->IsProgress()) {
|
||||
FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_VALUE_CHANGE,
|
||||
aContent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DocAccessible protected member
|
||||
|
@ -21,7 +21,7 @@ public:
|
||||
ProgressMeterAccessible(nsIContent* aContent, DocAccessible* aDoc) :
|
||||
LeafAccessible(aContent, aDoc)
|
||||
{
|
||||
mFlags = mFlags | eHasNumericValue;
|
||||
mFlags |= eHasNumericValue | eProgressAccessible;
|
||||
}
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
@ -475,9 +475,13 @@ RootAccessible::ProcessDOMEvent(nsIDOMEvent* aDOMEvent)
|
||||
#endif
|
||||
}
|
||||
else if (eventType.EqualsLiteral("ValueChange")) {
|
||||
targetDocument->
|
||||
FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_VALUE_CHANGE,
|
||||
targetNode, AccEvent::eRemoveDupes);
|
||||
|
||||
//We don't process 'ValueChange' events for progress meters since we listen
|
||||
//@value attribute change for them.
|
||||
if (!accessible->IsProgress())
|
||||
targetDocument->
|
||||
FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_VALUE_CHANGE,
|
||||
targetNode);
|
||||
}
|
||||
#ifdef DEBUG_DRAGDROPSTART
|
||||
else if (eventType.EqualsLiteral("mouseover")) {
|
||||
|
@ -99,6 +99,7 @@ var AccessFu = {
|
||||
Services.obs.addObserver(this, 'Accessibility:NextObject', false);
|
||||
Services.obs.addObserver(this, 'Accessibility:PreviousObject', false);
|
||||
Services.obs.addObserver(this, 'Accessibility:CurrentObject', false);
|
||||
this.chromeWin.addEventListener('TabOpen', this);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -118,6 +119,8 @@ var AccessFu = {
|
||||
|
||||
Input.detach();
|
||||
|
||||
this.chromeWin.removeEventListener('TabOpen', this);
|
||||
|
||||
Services.obs.removeObserver(this, 'remote-browser-frame-shown');
|
||||
Services.obs.removeObserver(this, 'Accessibility:NextObject');
|
||||
Services.obs.removeObserver(this, 'Accessibility:PreviousObject');
|
||||
@ -205,10 +208,20 @@ var AccessFu = {
|
||||
},
|
||||
|
||||
handleEvent: function handleEvent(aEvent) {
|
||||
if (aEvent.type == 'mozContentEvent' &&
|
||||
aEvent.detail.type == 'accessibility-screenreader') {
|
||||
this._systemPref = aEvent.detail.enabled;
|
||||
this._enableOrDisable();
|
||||
switch (aEvent.type) {
|
||||
case 'mozContentEvent':
|
||||
{
|
||||
if (aEvent.detail.type == 'accessibility-screenreader') {
|
||||
this._systemPref = aEvent.detail.enabled;
|
||||
this._enableOrDisable();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'TabOpen':
|
||||
{
|
||||
this._loadFrameScript(Utils.getMessageManager(aEvent.target));
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -47,7 +47,7 @@ nsAccessNodeWrap::~nsAccessNodeWrap()
|
||||
// nsISupports methods
|
||||
//-----------------------------------------------------
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED1(nsAccessNodeWrap, nsAccessNode, nsIWinAccessNode);
|
||||
NS_IMPL_ISUPPORTS_INHERITED1(nsAccessNodeWrap, nsAccessNode, nsIWinAccessNode)
|
||||
|
||||
//-----------------------------------------------------
|
||||
// nsIWinAccessNode methods
|
||||
@ -92,7 +92,7 @@ nsAccessNodeWrap::QueryService(REFGUID guidService, REFIID iid, void** ppv)
|
||||
// A use case for this is for screen readers that need to switch context or
|
||||
// 'virtual buffer' when focus moves from one browser tab area to another.
|
||||
static const GUID SID_IAccessibleContentDocument =
|
||||
{ 0xa5d8e1f3,0x3571,0x4d8f,0x95,0x21,0x07,0xed,0x28,0xfb,0x07,0x2e };
|
||||
{ 0xa5d8e1f3,0x3571,0x4d8f,{0x95,0x21,0x07,0xed,0x28,0xfb,0x07,0x2e} };
|
||||
if (guidService == SID_IAccessibleContentDocument) {
|
||||
if (iid != IID_IAccessible)
|
||||
return E_NOINTERFACE;
|
||||
@ -125,7 +125,7 @@ nsAccessNodeWrap::QueryService(REFGUID guidService, REFIID iid, void** ppv)
|
||||
*ppv = static_cast<IAccessible*>(docAcc);
|
||||
|
||||
(reinterpret_cast<IUnknown*>(*ppv))->AddRef();
|
||||
return NS_OK;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// Can get to IAccessibleApplication from any node via QS
|
||||
@ -153,7 +153,7 @@ nsAccessNodeWrap::QueryService(REFGUID guidService, REFIID iid, void** ppv)
|
||||
*/
|
||||
|
||||
static const GUID IID_SimpleDOMDeprecated =
|
||||
{ 0x0c539790,0x12e4,0x11cf,0xb6,0x61,0x00,0xaa,0x00,0x4c,0xd6,0xd8 };
|
||||
{ 0x0c539790,0x12e4,0x11cf,{0xb6,0x61,0x00,0xaa,0x00,0x4c,0xd6,0xd8} };
|
||||
if (guidService == IID_ISimpleDOMNode ||
|
||||
guidService == IID_SimpleDOMDeprecated ||
|
||||
guidService == IID_IAccessible || guidService == IID_IAccessible2)
|
||||
|
@ -26,11 +26,11 @@
|
||||
var gQueue = null;
|
||||
|
||||
// Value change invoker
|
||||
function changeValue(aNodeOrID, aValuenow, aValuetext)
|
||||
function changeARIAValue(aNodeOrID, aValuenow, aValuetext)
|
||||
{
|
||||
this.DOMNode = getNode(aNodeOrID);
|
||||
|
||||
this.invoke = function changeValue_invoke() {
|
||||
this.invoke = function changeARIAValue_invoke() {
|
||||
|
||||
// Note: this should not fire an EVENT_VALUE_CHANGE when aria-valuetext
|
||||
// is not empty
|
||||
@ -42,7 +42,7 @@
|
||||
this.DOMNode.setAttribute("aria-valuetext", aValuetext);
|
||||
}
|
||||
|
||||
this.check = function changeValue_check() {
|
||||
this.check = function changeARIAValue_check() {
|
||||
var acc = getAccessible(aNodeOrID, [nsIAccessibleValue]);
|
||||
if (!acc)
|
||||
return;
|
||||
@ -53,32 +53,49 @@
|
||||
"Wrong value of " + prettyName(aNodeOrID));
|
||||
}
|
||||
|
||||
this.getID = function changeValue_getID() {
|
||||
this.getID = function changeARIAValue_getID() {
|
||||
return prettyName(aNodeOrID) + " value changed";
|
||||
}
|
||||
}
|
||||
|
||||
function changeInputValue(aID, aValue)
|
||||
function changeValue(aID, aValue)
|
||||
{
|
||||
this.DOMNode = getNode(aID);
|
||||
|
||||
this.invoke = function changeInputValue_invoke()
|
||||
this.invoke = function changeValue_invoke()
|
||||
{
|
||||
this.DOMNode.value = aValue;
|
||||
}
|
||||
|
||||
this.check = function changeInputValue_check()
|
||||
this.check = function changeValue_check()
|
||||
{
|
||||
var acc = getAccessible(this.DOMNode);
|
||||
is(acc.value, aValue, "Wrong value for " + prettyName(aID));
|
||||
}
|
||||
|
||||
this.getID = function changeInputValue_getID()
|
||||
this.getID = function changeValue_getID()
|
||||
{
|
||||
return prettyName(aID) + " value changed";
|
||||
}
|
||||
}
|
||||
|
||||
function changeProcessValue(aID, aValue) {
|
||||
this.DOMNode = getNode(aID);
|
||||
|
||||
this.invoke = function changeProcessValue_invoke() {
|
||||
this.DOMNode.value = aValue;
|
||||
}
|
||||
|
||||
this.check = function changeProcessValue_check() {
|
||||
var acc = getAccessible(this.DOMNode);
|
||||
is(acc.value, aValue+"%", "Wrong value for " + prettyName(aID));
|
||||
}
|
||||
|
||||
this.getID = function changeProcessValue_getID() {
|
||||
return prettyName(aID) + " value changed";
|
||||
}
|
||||
}
|
||||
|
||||
function doTests()
|
||||
{
|
||||
// Test initial values
|
||||
@ -86,16 +103,19 @@
|
||||
testValue("slider_vnvt", "plain", 0, 0, 5, 0);
|
||||
testValue("slider_vt", "hi", 0, 0, 3, 0);
|
||||
testValue("scrollbar", "5", 5, 0, 1000, 0);
|
||||
testValue("progress", "22%", 22, 0, 100, 0);
|
||||
|
||||
// Test value change events
|
||||
gQueue = new eventQueue(nsIAccessibleEvent.EVENT_VALUE_CHANGE);
|
||||
|
||||
gQueue.push(new changeValue("slider_vn", "6", undefined));
|
||||
gQueue.push(new changeValue("slider_vt", undefined, "hey!"));
|
||||
gQueue.push(new changeValue("slider_vnvt", "3", "sweet"));
|
||||
gQueue.push(new changeValue("scrollbar", "6", undefined));
|
||||
gQueue.push(new changeARIAValue("slider_vn", "6", undefined));
|
||||
gQueue.push(new changeARIAValue("slider_vt", undefined, "hey!"));
|
||||
gQueue.push(new changeARIAValue("slider_vnvt", "3", "sweet"));
|
||||
gQueue.push(new changeARIAValue("scrollbar", "6", undefined));
|
||||
|
||||
gQueue.push(new changeInputValue("combobox", "hello"));
|
||||
gQueue.push(new changeValue("combobox", "hello"));
|
||||
|
||||
gQueue.push(new changeProcessValue("progress", "50"));
|
||||
|
||||
gQueue.invoke(); // Will call SimpleTest.finish();
|
||||
}
|
||||
@ -122,6 +142,12 @@
|
||||
title="ARIA comboboxes don't fire value change events">
|
||||
Mozilla Bug 703202
|
||||
</a>
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=761901"
|
||||
title=" HTML5 progress accessible should fire value change event">
|
||||
Mozilla Bug 761901
|
||||
</a>
|
||||
|
||||
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
@ -145,5 +171,9 @@
|
||||
|
||||
<!-- ARIA combobox -->
|
||||
<input id="combobox" role="combobox" aria-autocomplete="inline">
|
||||
|
||||
<!-- progress bar -->
|
||||
<progress id="progress" value="22" max="100"></progress>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
@ -66,6 +66,10 @@ function closePaymentFlowDialog(aCallback) {
|
||||
|
||||
content.removeEventListener("mozContentEvent",
|
||||
closePaymentFlowReturn);
|
||||
|
||||
let glue = Cc["@mozilla.org/payment/ui-glue;1"]
|
||||
.createInstance(Ci.nsIPaymentUIGlue);
|
||||
glue.cleanup();
|
||||
});
|
||||
|
||||
browser.shell.sendChromeEvent(detail);
|
||||
|
@ -855,3 +855,13 @@ window.addEventListener('ContentStart', function update_onContentStart() {
|
||||
});
|
||||
}, 'volume-state-changed', false);
|
||||
})();
|
||||
|
||||
Services.obs.addObserver(function(aSubject, aTopic, aData) {
|
||||
let data = JSON.parse(aData);
|
||||
shell.sendChromeEvent({
|
||||
type: "activity-done",
|
||||
success: data.success,
|
||||
manifestURL: data.manifestURL,
|
||||
pageURL: data.pageURL
|
||||
});
|
||||
}, "activity-done", false);
|
||||
|
@ -33,10 +33,16 @@ PaymentUI.prototype = {
|
||||
confirmPaymentRequest: function confirmPaymentRequest(aRequests,
|
||||
aSuccessCb,
|
||||
aErrorCb) {
|
||||
let _error = function _error(errorMsg) {
|
||||
if (aErrorCb) {
|
||||
aErrorCb.onresult(errorMsg);
|
||||
}
|
||||
};
|
||||
|
||||
let browser = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
let content = browser.getContentWindow();
|
||||
if (!content && aErrorCb) {
|
||||
aErrorCb.onresult("NO_CONTENT_WINDOW");
|
||||
if (!content) {
|
||||
_error("NO_CONTENT_WINDOW");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -56,15 +62,13 @@ PaymentUI.prototype = {
|
||||
content.addEventListener("mozContentEvent", function handleSelection(evt) {
|
||||
let msg = evt.detail;
|
||||
if (msg.id != id) {
|
||||
debug("mozContentEvent. evt.detail.id != " + id);
|
||||
content.removeEventListener("mozContentEvent", handleSelection);
|
||||
return;
|
||||
}
|
||||
|
||||
if (msg.userSelection && aSuccessCb) {
|
||||
aSuccessCb.onresult(msg.userSelection);
|
||||
} else if (msg.errorMsg && aErrorCb) {
|
||||
aErrorCb.onresult(msg.errorMsg);
|
||||
} else if (msg.errorMsg) {
|
||||
_error(msg.errorMsg);
|
||||
}
|
||||
|
||||
content.removeEventListener("mozContentEvent", handleSelection);
|
||||
@ -75,11 +79,18 @@ PaymentUI.prototype = {
|
||||
|
||||
showPaymentFlow: function showPaymentFlow(aPaymentFlowInfo, aErrorCb) {
|
||||
debug("showPaymentFlow. uri " + aPaymentFlowInfo.uri);
|
||||
|
||||
let _error = function _error(errorMsg) {
|
||||
if (aErrorCb) {
|
||||
aErrorCb.onresult(errorMsg);
|
||||
}
|
||||
};
|
||||
|
||||
// We ask the UI to browse to the selected payment flow.
|
||||
let browser = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
let content = browser.getContentWindow();
|
||||
if (!content && aErrorCb) {
|
||||
aErrorCb.onresult("NO_CONTENT_WINDOW");
|
||||
if (!content) {
|
||||
_error("NO_CONTENT_WINDOW");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -95,14 +106,18 @@ PaymentUI.prototype = {
|
||||
// At some point the UI would send the created iframe back so the
|
||||
// callbacks for firing DOMRequest events can be loaded on its
|
||||
// content.
|
||||
content.addEventListener("mozContentEvent", function loadPaymentShim(evt) {
|
||||
if (evt.detail.id != id || !evt.detail.frame) {
|
||||
content.addEventListener("mozContentEvent", (function loadPaymentShim(evt) {
|
||||
if (evt.detail.id != id) {
|
||||
content.removeEventListener("mozContentEvent", loadPaymentShim);
|
||||
return;
|
||||
}
|
||||
|
||||
// Try to load the payment shim file containing the payment callbacks
|
||||
// in the content script.
|
||||
if (!evt.detail.frame && !evt.detail.errorMsg) {
|
||||
_error("ERROR_LOADING_PAYMENT_SHIM");
|
||||
return;
|
||||
}
|
||||
let frame = evt.detail.frame;
|
||||
let frameLoader = frame.QueryInterface(Ci.nsIFrameLoaderOwner)
|
||||
.frameLoader;
|
||||
@ -111,17 +126,40 @@ PaymentUI.prototype = {
|
||||
mm.loadFrameScript(kPaymentShimFile, true);
|
||||
} catch (e) {
|
||||
debug("Error loading " + kPaymentShimFile + " as a frame script: " + e);
|
||||
if (aErrorCb) {
|
||||
aErrorCb.onresult("ERROR_LOADING_PAYMENT_SHIM");
|
||||
}
|
||||
_error("ERROR_LOADING_PAYMENT_SHIM");
|
||||
} finally {
|
||||
content.removeEventListener("mozContentEvent", loadPaymentShim);
|
||||
}
|
||||
});
|
||||
}).bind(this));
|
||||
|
||||
// We also listen for UI notifications about a closed payment flow. The UI
|
||||
// should provide the reason of the closure within the 'errorMsg' parameter
|
||||
this._notifyPayFlowClosed = function _notifyPayFlowClosed (evt) {
|
||||
if (evt.detail.id != id) {
|
||||
return;
|
||||
}
|
||||
if (evt.detail.errorMsg) {
|
||||
_error(evt.detail.errorMsg);
|
||||
content.removeEventListener("mozContentEvent",
|
||||
this._notifyPayFlowClosed);
|
||||
return;
|
||||
}
|
||||
};
|
||||
content.addEventListener("mozContentEvent",
|
||||
this._notifyPayFlowClosed.bind(this));
|
||||
|
||||
browser.shell.sendChromeEvent(detail);
|
||||
},
|
||||
|
||||
cleanup: function cleanup() {
|
||||
let browser = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
let content = browser.getContentWindow();
|
||||
if (!content) {
|
||||
return;
|
||||
}
|
||||
content.removeEventListener("mozContentEvent", this._notifyPayFlowClosed);
|
||||
},
|
||||
|
||||
getRandomId: function getRandomId() {
|
||||
return uuidgen.generateUUID().toString();
|
||||
},
|
||||
|
@ -5,7 +5,7 @@ mk_add_options MOZ_MAKE_FLAGS="-j8"
|
||||
ac_add_options --enable-application=b2g
|
||||
ac_add_options --enable-b2g-camera
|
||||
|
||||
ac_add_options --target=arm-android-eabi
|
||||
ac_add_options --target=arm-linux-androideabi
|
||||
ac_add_options --with-gonk="$topsrcdir/gonk-toolchain"
|
||||
export TOOLCHAIN_HOST=linux-x86
|
||||
export GONK_PRODUCT=generic
|
||||
|
@ -7,7 +7,7 @@ mk_add_options MOZ_MAKE_FLAGS="-j8"
|
||||
ac_add_options --enable-application=b2g
|
||||
ac_add_options --enable-b2g-camera
|
||||
|
||||
ac_add_options --target=arm-android-eabi
|
||||
ac_add_options --target=arm-linux-androideabi
|
||||
ac_add_options --with-gonk="$topsrcdir/gonk-toolchain"
|
||||
export TOOLCHAIN_HOST=linux-x86
|
||||
export GONK_PRODUCT=generic
|
||||
|
@ -2,7 +2,7 @@
|
||||
; License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
; file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
; Package file for the B2G build.
|
||||
; Package file for the B2G build.
|
||||
;
|
||||
; File format:
|
||||
;
|
||||
@ -380,11 +380,13 @@
|
||||
@BINPATH@/components/GPSDGeolocationProvider.js
|
||||
@BINPATH@/components/nsSidebar.manifest
|
||||
@BINPATH@/components/nsSidebar.js
|
||||
#ifndef MOZ_WIDGET_GONK
|
||||
@BINPATH@/components/extensions.manifest
|
||||
@BINPATH@/components/addonManager.js
|
||||
@BINPATH@/components/amContentHandler.js
|
||||
@BINPATH@/components/amWebInstallListener.js
|
||||
@BINPATH@/components/nsBlocklistService.js
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_UPDATER
|
||||
@BINPATH@/components/nsUpdateService.manifest
|
||||
|
@ -115,8 +115,10 @@ pref("app.update.cert.maxErrors", 5);
|
||||
// the value for the name must be the same as the value for the attribute name
|
||||
// on the certificate.
|
||||
// If these conditions aren't met it will be treated the same as when there is
|
||||
// no update available. This validation will not be performed when using the
|
||||
// |app.update.url.override| preference for update checking.
|
||||
// no update available. This validation will not be performed when the
|
||||
// |app.update.url.override| user preference has been set for testing updates or
|
||||
// when the |app.update.cert.checkAttributes| preference is set to false. Also,
|
||||
// the |app.update.url.override| preference should ONLY be used for testing.
|
||||
pref("app.update.certs.1.issuerName", "OU=Equifax Secure Certificate Authority,O=Equifax,C=US");
|
||||
pref("app.update.certs.1.commonName", "aus3.mozilla.org");
|
||||
|
||||
@ -1170,10 +1172,10 @@ pref("pdfjs.previousHandler.alwaysAskBeforeHandling", false);
|
||||
pref("image.mem.max_decoded_image_kb", 256000);
|
||||
|
||||
// Example social provider
|
||||
pref("social.manifest.motown", "{\"origin\":\"https://motown-dev.mozillalabs.com\",\"name\":\"MoTown\",\"workerURL\":\"https://motown-dev.mozillalabs.com/social/worker.js\",\"iconURL\":\"https://motown-dev.mozillalabs.com/images/motown-icon.png\",\"sidebarURL\":\"https://motown-dev.mozillalabs.com/social/sidebar\"}");
|
||||
pref("social.manifest.facebook", "{\"origin\":\"https://www.facebook.com\",\"name\":\"Facebook Messenger\",\"workerURL\":\"https://www.facebook.com/desktop/fbdesktop2/socialfox/fbworker.js.php\",\"iconURL\":\"data:image/x-icon;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8%2F9hAAAAX0lEQVQ4jWP4%2F%2F8%2FAyUYTFhHzjgDxP9JxGeQDSBVMxgTbUBCxer%2Fr999%2BQ8DJBuArJksA9A10s8AXIBoA0B%2BR%2FY%2FjD%2BEwoBoA1yT5v3PbdmCE8MAshhID%2FUMoDgzUYIBj0Cgi7ar4coAAAAASUVORK5CYII%3D\",\"sidebarURL\":\"https://www.facebook.com/desktop/fbdesktop2/?socialfox=true\"}");
|
||||
// Comma-separated list of nsIURI::prePaths that are allowed to activate
|
||||
// built-in social functionality.
|
||||
pref("social.activation.whitelist", "https://motown-dev.mozillalabs.com");
|
||||
pref("social.activation.whitelist", "https://www.facebook.com");
|
||||
pref("social.sidebar.open", true);
|
||||
pref("social.active", false);
|
||||
pref("social.toast-notifications.enabled", true);
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.7 KiB |
@ -325,7 +325,7 @@
|
||||
}
|
||||
cb = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", "chatbox");
|
||||
if (aMode == "minimized")
|
||||
cb.minimized = true;
|
||||
cb.setAttribute("minimized", "true");
|
||||
this.selectedChat = cb;
|
||||
this.insertBefore(cb, this.firstChild);
|
||||
cb.init(aProvider, aURL, aCallback);
|
||||
|
@ -104,6 +104,7 @@ var tests = {
|
||||
case "got-chatbox-message":
|
||||
ok(true, "got a chat window opened");
|
||||
let chats = document.getElementById("pinnedchats");
|
||||
ok(chats.selectedChat.minimized, "chatbox from worker opened as minimized");
|
||||
while (chats.selectedChat) {
|
||||
chats.selectedChat.close();
|
||||
}
|
||||
|
@ -78,6 +78,15 @@ var tests = {
|
||||
},
|
||||
|
||||
testCloseSelf: function(next) {
|
||||
// window.close is affected by the pref dom.allow_scripts_to_close_windows,
|
||||
// which defaults to false, but is set to true by the test harness.
|
||||
// so temporarily set it back.
|
||||
const ALLOW_SCRIPTS_TO_CLOSE_PREF = "dom.allow_scripts_to_close_windows";
|
||||
// note clearUserPref doesn't do what we expect, as the test harness itself
|
||||
// changes the pref value - so clearUserPref resets it to false rather than
|
||||
// the true setup by the test harness.
|
||||
let oldAllowScriptsToClose = Services.prefs.getBoolPref(ALLOW_SCRIPTS_TO_CLOSE_PREF);
|
||||
Services.prefs.setBoolPref(ALLOW_SCRIPTS_TO_CLOSE_PREF, false);
|
||||
let panel = document.getElementById("social-flyout-panel");
|
||||
let port = Social.provider.getWorkerPort();
|
||||
ok(port, "provider has a port");
|
||||
@ -92,6 +101,7 @@ var tests = {
|
||||
iframe.contentDocument.addEventListener("SocialTest-DoneCloseSelf", function _doneHandler() {
|
||||
iframe.contentDocument.removeEventListener("SocialTest-DoneCloseSelf", _doneHandler, false);
|
||||
is(panel.state, "closed", "flyout should have closed itself");
|
||||
Services.prefs.setBoolPref(ALLOW_SCRIPTS_TO_CLOSE_PREF, oldAllowScriptsToClose);
|
||||
next();
|
||||
}, false);
|
||||
is(panel.state, "open", "flyout should be open");
|
||||
|
@ -52,22 +52,15 @@ function test() {
|
||||
Services.ww.unregisterNotification(observer);
|
||||
|
||||
step2();
|
||||
}
|
||||
else if (aTopic == "domwindowopened")
|
||||
} else if (aTopic == "domwindowopened") {
|
||||
ok(false, "Entering the private browsing mode should not open any view source window");
|
||||
} else if (aTopic == "private-browsing-transition-complete") {
|
||||
Services.obs.removeObserver(observer, "private-browsing-transition-complete");
|
||||
step3();
|
||||
}
|
||||
}
|
||||
Services.ww.registerNotification(observer);
|
||||
|
||||
gBrowser.addTabsProgressListener({
|
||||
onStateChange: function(aBrowser, aWebProgress, aRequest, aStateFlags, aStatus) {
|
||||
if (aStateFlags & (Ci.nsIWebProgressListener.STATE_STOP |
|
||||
Ci.nsIWebProgressListener.STATE_IS_WINDOW)) {
|
||||
gBrowser.removeTabsProgressListener(this);
|
||||
|
||||
step3();
|
||||
}
|
||||
}
|
||||
});
|
||||
Services.obs.addObserver(observer, "private-browsing-transition-complete", false);
|
||||
|
||||
// enter private browsing mode
|
||||
pb.privateBrowsingEnabled = true;
|
||||
|
@ -622,6 +622,20 @@
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<!--
|
||||
This overrides the searchParam property in autocomplete.xml. We're
|
||||
hijacking this property as a vehicle for delivering the privacy
|
||||
information about the window into the guys of nsSearchSuggestions.
|
||||
|
||||
Note that the setter is the same as the parent. We were not sure whether
|
||||
we can override just the getter. If that proves to be the case, the setter
|
||||
can be removed.
|
||||
-->
|
||||
<property name="searchParam"
|
||||
onget="return this.getAttribute('autocompletesearchparam') +
|
||||
(PrivateBrowsingUtils.isWindowPrivate(window) ? '|private' : '');"
|
||||
onset="this.setAttribute('autocompletesearchparam', val); return val;"/>
|
||||
|
||||
<!--
|
||||
This method overrides the autocomplete binding's openPopup (essentially
|
||||
duplicating the logic from the autocomplete popup binding's
|
||||
|
@ -193,7 +193,7 @@ function test() {
|
||||
function testSearchHistory() {
|
||||
var textbox = searchBar._textbox;
|
||||
for (var i = 0; i < searchEntries.length; i++) {
|
||||
let exists = textbox._formHistSvc.entryExists(textbox.searchParam, searchEntries[i]);
|
||||
let exists = textbox._formHistSvc.entryExists(textbox.getAttribute("autocompletesearchparam"), searchEntries[i]);
|
||||
ok(exists, "form history entry '" + searchEntries[i] + "' should exist");
|
||||
}
|
||||
testAutocomplete();
|
||||
|
@ -3,6 +3,9 @@ ac_add_options --enable-official-branding
|
||||
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
|
||||
ac_add_options --enable-update-packaging
|
||||
|
||||
# Avoid dependency on libstdc++ 4.5
|
||||
ac_add_options --enable-stdcxx-compat
|
||||
|
||||
. $topsrcdir/build/unix/mozconfig.linux
|
||||
|
||||
|
||||
|
@ -3,6 +3,9 @@ ac_add_options --enable-official-branding
|
||||
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
|
||||
ac_add_options --enable-update-packaging
|
||||
|
||||
# Avoid dependency on libstdc++ 4.5
|
||||
ac_add_options --enable-stdcxx-compat
|
||||
|
||||
. $topsrcdir/build/unix/mozconfig.linux
|
||||
|
||||
|
||||
|
13
browser/config/mozconfigs/macosx-universal/l10n-mozconfig
Normal file
13
browser/config/mozconfigs/macosx-universal/l10n-mozconfig
Normal file
@ -0,0 +1,13 @@
|
||||
. "$topsrcdir/browser/config/mozconfigs/common"
|
||||
|
||||
ac_add_options --with-l10n-base=../../l10n-central
|
||||
|
||||
if [ "${MOZ_UPDATE_CHANNEL}" = "release" -o "${MOZ_UPDATE_CHANNEL}" = "beta" ]; then
|
||||
ac_add_options --enable-official-branding
|
||||
fi
|
||||
|
||||
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
|
||||
ac_add_options --enable-update-packaging
|
||||
ac_add_options --with-ccache
|
||||
|
||||
. "$topsrcdir/build/mozconfig.common.override"
|
@ -688,18 +688,6 @@ var Scratchpad = {
|
||||
file.initWithPath(filePath);
|
||||
}
|
||||
|
||||
if (!file.exists()) {
|
||||
this.notificationBox.appendNotification(
|
||||
this.strings.GetStringFromName("fileNoLongerExists.notification"),
|
||||
"file-no-longer-exists",
|
||||
null,
|
||||
this.notificationBox.PRIORITY_WARNING_HIGH,
|
||||
null);
|
||||
|
||||
this.clearFiles(aIndex, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
this.setFilename(file.path);
|
||||
this.importFromFile(file, false);
|
||||
this.setRecentFile(file);
|
||||
@ -841,23 +829,6 @@ var Scratchpad = {
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Clear a range of files from the list.
|
||||
*
|
||||
* @param integer aIndex
|
||||
* Index of file in menu to remove.
|
||||
* @param integer aLength
|
||||
* Number of files from the index 'aIndex' to remove.
|
||||
*/
|
||||
clearFiles: function SP_clearFile(aIndex, aLength)
|
||||
{
|
||||
let filePaths = this.getRecentFiles();
|
||||
let branch = Services.prefs.
|
||||
getBranch("devtools.scratchpad.");
|
||||
filePaths.splice(aIndex, aLength);
|
||||
branch.setCharPref("recentFilePaths", JSON.stringify(filePaths));
|
||||
},
|
||||
|
||||
/**
|
||||
* Clear all recent files.
|
||||
*/
|
||||
@ -888,8 +859,11 @@ var Scratchpad = {
|
||||
|
||||
let filePaths = this.getRecentFiles();
|
||||
if (maxRecent < filePaths.length) {
|
||||
let branch = Services.prefs.
|
||||
getBranch("devtools.scratchpad.");
|
||||
let diff = filePaths.length - maxRecent;
|
||||
this.clearFiles(0, diff);
|
||||
filePaths.splice(0, diff);
|
||||
branch.setCharPref("recentFilePaths", JSON.stringify(filePaths));
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -101,7 +101,7 @@ function testHideMenu()
|
||||
let menu = gScratchpadWindow.document.getElementById("sp-open_recent-menu");
|
||||
ok(menu.hasAttribute("hidden"), "The menu was hidden successfully.");
|
||||
|
||||
Services.prefs.setIntPref("devtools.scratchpad.recentFilesMax", 2);
|
||||
Services.prefs.setIntPref("devtools.scratchpad.recentFilesMax", 1);
|
||||
}
|
||||
|
||||
// We have set the recentFilesMax-pref to one (1), this enables the feature,
|
||||
@ -114,7 +114,7 @@ function testChangedMaxRecent()
|
||||
|
||||
lists.recentFiles04 = gScratchpad.getRecentFiles();
|
||||
|
||||
is(lists.recentFiles04.length, 2,
|
||||
is(lists.recentFiles04.length, 1,
|
||||
"Two recent files were successfully removed from the 'recent files'-list");
|
||||
|
||||
let doc = gScratchpadWindow.document;
|
||||
@ -123,39 +123,13 @@ function testChangedMaxRecent()
|
||||
let menuitemLabel = popup.children[0].getAttribute("label");
|
||||
let correctMenuItem = false;
|
||||
if (menuitemLabel === lists.recentFiles03[2] &&
|
||||
menuitemLabel === lists.recentFiles04[1]) {
|
||||
menuitemLabel === lists.recentFiles04[0]) {
|
||||
correctMenuItem = true;
|
||||
}
|
||||
|
||||
is(correctMenuItem, true,
|
||||
"Two recent files were successfully removed from the 'Open Recent'-menu");
|
||||
|
||||
// We now remove one file from the harddrive and use the recent-menuitem for
|
||||
// it to make sure the user is notified that the file no longer exists.
|
||||
// This is tested in testOpenDeletedFile().
|
||||
gFile02.remove(false);
|
||||
gFile02 = null;
|
||||
gScratchpad.openFile(1);
|
||||
}
|
||||
|
||||
// By now we should have two recent files stored in the list but one of the
|
||||
// files should be missing on the harddrive.
|
||||
function testOpenDeletedFile() {
|
||||
let doc = gScratchpadWindow.document;
|
||||
let popup = doc.getElementById("sp-menu-open_recentPopup");
|
||||
|
||||
is(gScratchpad.getRecentFiles().length, 1,
|
||||
"The missing file was successfully removed from the list.");
|
||||
// The number of recent files stored, plus the separator and the
|
||||
// clearRecentMenuItems-item.
|
||||
is(popup.children.length, 3,
|
||||
"The missing file was successfully removed from the menu.");
|
||||
ok(gScratchpad.notificationBox.currentNotification,
|
||||
"The notification was successfully displayed.");
|
||||
is(gScratchpad.notificationBox.currentNotification.label,
|
||||
gScratchpad.strings.GetStringFromName("fileNoLongerExists.notification"),
|
||||
"The notification label is correct.");
|
||||
|
||||
gScratchpad.clearRecentFiles();
|
||||
}
|
||||
|
||||
@ -286,10 +260,6 @@ var PreferenceObserver = {
|
||||
break;
|
||||
case 7:
|
||||
this.timesFired = 8;
|
||||
testOpenDeletedFile();
|
||||
break;
|
||||
case 8:
|
||||
this.timesFired = 9;
|
||||
testClearedAll();
|
||||
break;
|
||||
}
|
||||
@ -307,7 +277,8 @@ function test()
|
||||
registerCleanupFunction(function () {
|
||||
gFile01.remove(false);
|
||||
gFile01 = null;
|
||||
// gFile02 was removed earlier.
|
||||
gFile02.remove(false);
|
||||
gFile02 = null;
|
||||
gFile03.remove(false);
|
||||
gFile03 = null;
|
||||
gFile04.remove(false);
|
||||
|
@ -724,11 +724,12 @@ Function CheckExistingInstall
|
||||
FunctionEnd
|
||||
|
||||
Function LaunchApp
|
||||
${ManualCloseAppPrompt} "${WindowClass}" "$(WARN_MANUALLY_CLOSE_APP_LAUNCH)"
|
||||
|
||||
ClearErrors
|
||||
${GetParameters} $0
|
||||
${GetOptions} "$0" "/UAC:" $1
|
||||
${If} ${Errors}
|
||||
${ManualCloseAppPrompt} "${WindowClass}" "$(WARN_MANUALLY_CLOSE_APP_LAUNCH)"
|
||||
Exec "$\"$INSTDIR\${FileMainEXE}$\""
|
||||
${Else}
|
||||
GetFunctionAddress $0 LaunchAppFromElevatedProcess
|
||||
@ -737,8 +738,6 @@ Function LaunchApp
|
||||
FunctionEnd
|
||||
|
||||
Function LaunchAppFromElevatedProcess
|
||||
${ManualCloseAppPrompt} "${WindowClass}" "$(WARN_MANUALLY_CLOSE_APP_LAUNCH)"
|
||||
|
||||
; Find the installation directory when launching using GetFunctionAddress
|
||||
; from an elevated installer since $INSTDIR will not be set in this installer
|
||||
${StrFilter} "${FileMainEXE}" "+" "" "" $R9
|
||||
|
@ -331,6 +331,7 @@ Function .onUserAbort
|
||||
${NSD_KillTimer} StartInstall
|
||||
${NSD_KillTimer} CheckInstall
|
||||
${NSD_KillTimer} FinishInstall
|
||||
${NSD_KillTimer} DisplayDownloadError
|
||||
|
||||
Delete "$PLUGINSDIR\download.exe"
|
||||
Delete "$PLUGINSDIR\${CONFIG_INI}"
|
||||
@ -927,12 +928,8 @@ Function OnDownload
|
||||
|
||||
${If} $0 == 0
|
||||
${OrIf} $1 == 0
|
||||
MessageBox MB_OKCANCEL|MB_ICONSTOP "$(ERROR_DOWNLOAD)" IDCANCEL +2 IDOK 0
|
||||
ExecShell "open" "${URLManualDownload}"
|
||||
; The following will exit the installer
|
||||
SetAutoClose true
|
||||
StrCpy $R9 2
|
||||
Call RelativeGotoPage
|
||||
; Use a timer so the UI has a chance to update
|
||||
${NSD_CreateTimer} DisplayDownloadError ${InstallIntervalMS}
|
||||
Return
|
||||
${EndIf}
|
||||
|
||||
@ -1020,12 +1017,8 @@ Function CheckInstall
|
||||
${NSD_KillTimer} CheckInstall
|
||||
; Close the handle that prevents modification of the full installer
|
||||
System::Call 'kernel32::CloseHandle(i $HandleDownload)'
|
||||
MessageBox MB_OKCANCEL|MB_ICONSTOP "$(ERROR_DOWNLOAD)" IDCANCEL +2 IDOK 0
|
||||
ExecShell "open" "${URLManualDownload}"
|
||||
; The following will exit the installer
|
||||
SetAutoClose true
|
||||
StrCpy $R9 2
|
||||
Call RelativeGotoPage
|
||||
; Use a timer so the UI has a chance to update
|
||||
${NSD_CreateTimer} DisplayDownloadError ${InstallIntervalMS}
|
||||
Return
|
||||
${EndIf}
|
||||
|
||||
@ -1336,5 +1329,32 @@ Function LaunchAppFromElevatedProcess
|
||||
Exec "$\"$0$\""
|
||||
FunctionEnd
|
||||
|
||||
Function DisplayDownloadError
|
||||
${NSD_KillTimer} DisplayDownloadError
|
||||
StrCpy $R9 "false"
|
||||
MessageBox MB_OKCANCEL|MB_ICONSTOP "$(ERROR_DOWNLOAD)" IDCANCEL +2 IDOK 0
|
||||
StrCpy $R9 "true"
|
||||
|
||||
${If} "$R9" == "true"
|
||||
ClearErrors
|
||||
${GetParameters} $0
|
||||
${GetOptions} "$0" "/UAC:" $1
|
||||
${If} ${Errors}
|
||||
Call OpenManualDownloadURL
|
||||
${Else}
|
||||
GetFunctionAddress $0 OpenManualDownloadURL
|
||||
UAC::ExecCodeSegment $0
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
|
||||
SetAutoClose true
|
||||
StrCpy $R9 2
|
||||
Call RelativeGotoPage
|
||||
FunctionEnd
|
||||
|
||||
Function OpenManualDownloadURL
|
||||
ExecShell "open" "${URLManualDownload}"
|
||||
FunctionEnd
|
||||
|
||||
Section
|
||||
SectionEnd
|
||||
|
@ -78,7 +78,3 @@ browserContext.notification=This scratchpad executes in the Browser context.
|
||||
# LOCALIZATION NOTE (help.openDocumentationPage): This returns a localized link with
|
||||
# documentation for Scratchpad on MDN.
|
||||
help.openDocumentationPage=https://developer.mozilla.org/en/Tools/Scratchpad
|
||||
|
||||
# LOCALIZATION NOTE (fileExists.notification): This is the message displayed
|
||||
# over the top of the the editor when a file does not exist.
|
||||
fileNoLongerExists.notification=This file no longer exists.
|
||||
|
BIN
browser/themes/pinstripe/downloads/buttons.png
Executable file → Normal file
BIN
browser/themes/pinstripe/downloads/buttons.png
Executable file → Normal file
Binary file not shown.
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 2.0 KiB |
@ -133,32 +133,23 @@ richlistitem[type="download"][state="1"]:hover {
|
||||
.downloadButton.downloadCancel {
|
||||
-moz-image-region: rect(0px, 16px, 16px, 0px);
|
||||
}
|
||||
.downloadButton.downloadCancel:hover {
|
||||
-moz-image-region: rect(0px, 32px, 16px, 16px);
|
||||
}
|
||||
.downloadButton.downloadCancel:active {
|
||||
-moz-image-region: rect(0px, 48px, 16px, 28px);
|
||||
}
|
||||
|
||||
.downloadButton.downloadShow {
|
||||
-moz-image-region: rect(16px, 16px, 32px, 0px);
|
||||
}
|
||||
.downloadButton.downloadShow:hover {
|
||||
richlistitem[type="download"][state="1"]:hover > .downloadButton.downloadShow {
|
||||
-moz-image-region: rect(16px, 32px, 32px, 16px);
|
||||
}
|
||||
.downloadButton.downloadShow:active {
|
||||
richlistitem[type="download"][state="1"]:hover > .downloadButton.downloadShow:hover {
|
||||
-moz-image-region: rect(16px, 48px, 32px, 32px);
|
||||
}
|
||||
richlistitem[type="download"][state="1"]:hover > .downloadButton.downloadShow:active {
|
||||
-moz-image-region: rect(16px, 64px, 32px, 48px);
|
||||
}
|
||||
|
||||
.downloadButton.downloadRetry {
|
||||
-moz-image-region: rect(32px, 16px, 48px, 0px);
|
||||
}
|
||||
.downloadButton.downloadRetry:hover {
|
||||
-moz-image-region: rect(32px, 32px, 48px, 16px);
|
||||
}
|
||||
.downloadButton.downloadRetry:active {
|
||||
-moz-image-region: rect(32px, 48px, 48px, 32px);
|
||||
}
|
||||
|
||||
/*** Status and progress indicator ***/
|
||||
|
||||
|
@ -74,13 +74,22 @@ class RemoteAutomation(Automation):
|
||||
return status
|
||||
|
||||
def checkForCrashes(self, directory, symbolsPath):
|
||||
dumpDir = tempfile.mkdtemp()
|
||||
self._devicemanager.getDirectory(self._remoteProfile + '/minidumps/', dumpDir)
|
||||
automationutils.checkForCrashes(dumpDir, symbolsPath, self.lastTestSeen)
|
||||
try:
|
||||
shutil.rmtree(dumpDir)
|
||||
except:
|
||||
print "WARNING: unable to remove directory: %s" % (dumpDir)
|
||||
remoteCrashDir = self._remoteProfile + '/minidumps/'
|
||||
if self._devicemanager.dirExists(remoteCrashDir):
|
||||
dumpDir = tempfile.mkdtemp()
|
||||
self._devicemanager.getDirectory(remoteCrashDir, dumpDir)
|
||||
automationutils.checkForCrashes(dumpDir, symbolsPath,
|
||||
self.lastTestSeen)
|
||||
try:
|
||||
shutil.rmtree(dumpDir)
|
||||
except:
|
||||
print "WARNING: unable to remove directory: %s" % dumpDir
|
||||
else:
|
||||
# As of this writing, the minidumps directory is automatically
|
||||
# created when fennec (first) starts, so its lack of presence
|
||||
# is a hint that something went wrong.
|
||||
print "WARNING: No crash directory (%s) on remote " \
|
||||
"device" % remoteCrashDir
|
||||
|
||||
def buildCommandLine(self, app, debuggerInfo, profileDir, testURL, extraArgs):
|
||||
# If remote profile is specified, use that instead
|
||||
|
@ -393,7 +393,7 @@ public class FennecNativeDriver implements Driver {
|
||||
|
||||
String[] lines = data.split("\n");
|
||||
for (int i = 0; i < lines.length; i++) {
|
||||
String[] parts = lines[i].split("=");
|
||||
String[] parts = lines[i].split("=", 2);
|
||||
retVal.put(parts[0].trim(), parts[1].trim());
|
||||
}
|
||||
return retVal;
|
||||
|
@ -124,14 +124,8 @@ MOZ_UNICHARUTIL_LIBS = $(LIBXUL_DIST)/lib/$(LIB_PREFIX)unicharutil_s.$(LIB_SUFFI
|
||||
MOZ_WIDGET_SUPPORT_LIBS = $(DIST)/lib/$(LIB_PREFIX)widgetsupport_s.$(LIB_SUFFIX)
|
||||
|
||||
ifdef _MSC_VER
|
||||
ifdef .PYMAKE
|
||||
PYCOMMANDPATH += $(topsrcdir)/build
|
||||
CC_WRAPPER ?= %cl InvokeClWithDependencyGeneration
|
||||
CXX_WRAPPER ?= %cl InvokeClWithDependencyGeneration
|
||||
else
|
||||
CC_WRAPPER ?= $(PYTHON) -O $(topsrcdir)/build/cl.py
|
||||
CXX_WRAPPER ?= $(PYTHON) -O $(topsrcdir)/build/cl.py
|
||||
endif # .PYMAKE
|
||||
endif # _MSC_VER
|
||||
|
||||
CC := $(CC_WRAPPER) $(CC)
|
||||
|
32
configure.in
32
configure.in
@ -1675,18 +1675,19 @@ fi
|
||||
AC_SUBST(MOZ_VALGRIND)
|
||||
|
||||
dnl ========================================================
|
||||
dnl = Use DMD
|
||||
dnl = Enable DMDV
|
||||
dnl ========================================================
|
||||
MOZ_ARG_ENABLE_BOOL(dmd,
|
||||
[ --enable-dmd Enable DMD; also disables jemalloc (default=no)],
|
||||
MOZ_DMD=1,
|
||||
MOZ_DMD= )
|
||||
if test -n "$MOZ_DMD"; then
|
||||
MOZ_ARG_ENABLE_BOOL(dmdv,
|
||||
[ --enable-dmdv Enable DMDV; also disables jemalloc (default=no)],
|
||||
MOZ_DMDV=1,
|
||||
MOZ_DMDV= )
|
||||
if test -n "$MOZ_DMDV"; then
|
||||
MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
|
||||
AC_MSG_ERROR(
|
||||
[--enable-dmd specified but Valgrind is not installed]))
|
||||
AC_DEFINE(MOZ_DMD)
|
||||
[--enable-dmdv specified but Valgrind is not installed]))
|
||||
AC_DEFINE(MOZ_DMDV)
|
||||
fi
|
||||
AC_SUBST(MOZ_DMDV)
|
||||
|
||||
dnl ========================================================
|
||||
dnl jprof
|
||||
@ -3784,6 +3785,13 @@ AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
|
||||
|
||||
dnl See if compiler supports some gcc-style attributes
|
||||
|
||||
AC_CACHE_CHECK(for __attribute__((always_inline)),
|
||||
ac_cv_attribute_always_inline,
|
||||
[AC_TRY_COMPILE([inline void f(void) __attribute__((always_inline));],
|
||||
[],
|
||||
ac_cv_attribute_always_inline=yes,
|
||||
ac_cv_attribute_always_inline=no)])
|
||||
|
||||
AC_CACHE_CHECK(for __attribute__((malloc)),
|
||||
ac_cv_attribute_malloc,
|
||||
[AC_TRY_COMPILE([void* f(int) __attribute__((malloc));],
|
||||
@ -3835,6 +3843,12 @@ dnl are defined in build/autoconf/altoptions.m4.
|
||||
|
||||
dnl If the compiler supports these attributes, define them as
|
||||
dnl convenience macros.
|
||||
if test "$ac_cv_attribute_always_inline" = yes ; then
|
||||
AC_DEFINE(NS_ALWAYS_INLINE, [__attribute__((always_inline))])
|
||||
else
|
||||
AC_DEFINE(NS_ALWAYS_INLINE,)
|
||||
fi
|
||||
|
||||
if test "$ac_cv_attribute_malloc" = yes ; then
|
||||
AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
|
||||
else
|
||||
@ -6978,7 +6992,7 @@ MOZ_ARG_ENABLE_BOOL(jemalloc,
|
||||
if test "$NS_TRACE_MALLOC"; then
|
||||
MOZ_MEMORY=
|
||||
fi
|
||||
if test "$MOZ_DMD"; then
|
||||
if test "$MOZ_DMDV"; then
|
||||
MOZ_MEMORY=
|
||||
fi
|
||||
|
||||
|
@ -200,14 +200,6 @@ public:
|
||||
*/
|
||||
static JSContext* GetContextFromDocument(nsIDocument *aDocument);
|
||||
|
||||
/**
|
||||
* When a document's scope changes (e.g., from document.open(), call this
|
||||
* function to move all content wrappers from the old scope to the new one.
|
||||
*/
|
||||
static nsresult ReparentContentWrappersInScope(JSContext *cx,
|
||||
nsIScriptGlobalObject *aOldScope,
|
||||
nsIScriptGlobalObject *aNewScope);
|
||||
|
||||
static bool IsCallerChrome();
|
||||
|
||||
static bool IsCallerTrustedForRead();
|
||||
@ -1822,12 +1814,23 @@ public:
|
||||
const nsAString& aClasses,
|
||||
nsIDOMNodeList** aReturn);
|
||||
|
||||
/**
|
||||
* Returns a presshell for this document, if there is one. This will be
|
||||
* aDoc's direct presshell if there is one, otherwise we'll look at all
|
||||
* ancestor documents to try to find a presshell, so for example this can
|
||||
* still find a presshell for documents in display:none frames that have
|
||||
* no presentation. So you have to be careful how you use this presshell ---
|
||||
* getting generic data like a device context or widget from it is OK, but it
|
||||
* might not be this document's actual presentation.
|
||||
*/
|
||||
static nsIPresShell* FindPresShellForDocument(nsIDocument* aDoc);
|
||||
|
||||
/**
|
||||
* Returns the widget for this document if there is one. Looks at all ancestor
|
||||
* documents to try to find a widget, so for example this can still find a
|
||||
* widget for documents in display:none frames that have no presentation.
|
||||
*/
|
||||
static nsIWidget *WidgetForDocument(nsIDocument *aDoc);
|
||||
static nsIWidget* WidgetForDocument(nsIDocument* aDoc);
|
||||
|
||||
/**
|
||||
* Returns a layer manager to use for the given document. Basically we
|
||||
|
@ -1165,9 +1165,6 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(FragmentOrElement)
|
||||
tmp->DeleteProperty(nsGkAtoms::itemtype);
|
||||
tmp->DeleteProperty(nsGkAtoms::itemref);
|
||||
tmp->DeleteProperty(nsGkAtoms::itemprop);
|
||||
} else if (tmp->IsXUL()) {
|
||||
tmp->DeleteProperty(nsGkAtoms::contextmenulistener);
|
||||
tmp->DeleteProperty(nsGkAtoms::popuplistener);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1708,13 +1705,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(FragmentOrElement)
|
||||
cb.NoteXPCOMChild(property);
|
||||
property = static_cast<nsISupports*>(tmp->GetProperty(nsGkAtoms::itemtype));
|
||||
cb.NoteXPCOMChild(property);
|
||||
} else if (tmp->IsXUL()) {
|
||||
nsISupports* property = static_cast<nsISupports*>
|
||||
(tmp->GetProperty(nsGkAtoms::contextmenulistener));
|
||||
cb.NoteXPCOMChild(property);
|
||||
property = static_cast<nsISupports*>
|
||||
(tmp->GetProperty(nsGkAtoms::popuplistener));
|
||||
cb.NoteXPCOMChild(property);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1721,23 +1721,6 @@ nsContentUtils::TraceSafeJSContext(JSTracer* aTrc)
|
||||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsContentUtils::ReparentContentWrappersInScope(JSContext *cx,
|
||||
nsIScriptGlobalObject *aOldScope,
|
||||
nsIScriptGlobalObject *aNewScope)
|
||||
{
|
||||
JSObject *oldScopeObj = aOldScope->GetGlobalJSObject();
|
||||
JSObject *newScopeObj = aNewScope->GetGlobalJSObject();
|
||||
|
||||
if (!newScopeObj || !oldScopeObj) {
|
||||
// We can't really do anything without the JSObjects.
|
||||
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
return sXPConnect->MoveWrappers(cx, oldScopeObj, newScopeObj);
|
||||
}
|
||||
|
||||
nsPIDOMWindow *
|
||||
nsContentUtils::GetWindowFromCaller()
|
||||
{
|
||||
@ -6525,8 +6508,8 @@ nsContentUtils::PlatformToDOMLineBreaks(nsString &aString)
|
||||
}
|
||||
}
|
||||
|
||||
nsIWidget *
|
||||
nsContentUtils::WidgetForDocument(nsIDocument *aDoc)
|
||||
nsIPresShell*
|
||||
nsContentUtils::FindPresShellForDocument(nsIDocument* aDoc)
|
||||
{
|
||||
nsIDocument* doc = aDoc;
|
||||
nsIDocument* displayDoc = doc->GetDisplayDocument();
|
||||
@ -6535,25 +6518,35 @@ nsContentUtils::WidgetForDocument(nsIDocument *aDoc)
|
||||
}
|
||||
|
||||
nsIPresShell* shell = doc->GetShell();
|
||||
if (shell) {
|
||||
return shell;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsISupports> container = doc->GetContainer();
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem = do_QueryInterface(container);
|
||||
while (!shell && docShellTreeItem) {
|
||||
while (docShellTreeItem) {
|
||||
// We may be in a display:none subdocument, or we may not have a presshell
|
||||
// created yet.
|
||||
// Walk the docshell tree to find the nearest container that has a presshell,
|
||||
// and find the root widget from that.
|
||||
// and return that.
|
||||
nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(docShellTreeItem);
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
docShell->GetPresShell(getter_AddRefs(presShell));
|
||||
if (presShell) {
|
||||
shell = presShell;
|
||||
} else {
|
||||
nsCOMPtr<nsIDocShellTreeItem> parent;
|
||||
docShellTreeItem->GetParent(getter_AddRefs(parent));
|
||||
docShellTreeItem = parent;
|
||||
return presShell;
|
||||
}
|
||||
nsCOMPtr<nsIDocShellTreeItem> parent;
|
||||
docShellTreeItem->GetParent(getter_AddRefs(parent));
|
||||
docShellTreeItem = parent;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsIWidget*
|
||||
nsContentUtils::WidgetForDocument(nsIDocument* aDoc)
|
||||
{
|
||||
nsIPresShell* shell = FindPresShellForDocument(aDoc);
|
||||
if (shell) {
|
||||
nsIViewManager* VM = shell->GetViewManager();
|
||||
if (VM) {
|
||||
|
@ -2008,11 +2008,11 @@ nsHTMLCopyEncoder::GetImmediateContextCount(const nsTArray<nsINode*>& aAncestorA
|
||||
break;
|
||||
}
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(node));
|
||||
if (!content || !content->IsHTML() || content->Tag() != nsGkAtoms::tr &&
|
||||
content->Tag() != nsGkAtoms::thead &&
|
||||
content->Tag() != nsGkAtoms::tbody &&
|
||||
content->Tag() != nsGkAtoms::tfoot &&
|
||||
content->Tag() != nsGkAtoms::table) {
|
||||
if (!content || !content->IsHTML() || (content->Tag() != nsGkAtoms::tr &&
|
||||
content->Tag() != nsGkAtoms::thead &&
|
||||
content->Tag() != nsGkAtoms::tbody &&
|
||||
content->Tag() != nsGkAtoms::tfoot &&
|
||||
content->Tag() != nsGkAtoms::table)) {
|
||||
break;
|
||||
}
|
||||
++j;
|
||||
|
@ -226,7 +226,6 @@ GK_ATOM(headerContentStyleType, "content-style-type")
|
||||
GK_ATOM(headerContentType, "content-type")
|
||||
GK_ATOM(context, "context")
|
||||
GK_ATOM(contextmenu, "contextmenu")
|
||||
GK_ATOM(contextmenulistener, "contextmenulistener")
|
||||
GK_ATOM(control, "control")
|
||||
GK_ATOM(controls, "controls")
|
||||
GK_ATOM(coords, "coords")
|
||||
@ -833,7 +832,6 @@ GK_ATOM(popupanchor, "popupanchor")
|
||||
GK_ATOM(popupgroup, "popupgroup")
|
||||
GK_ATOM(popuphidden, "popuphidden")
|
||||
GK_ATOM(popuphiding, "popuphiding")
|
||||
GK_ATOM(popuplistener, "popuplistener")
|
||||
GK_ATOM(popupset, "popupset")
|
||||
GK_ATOM(popupshowing, "popupshowing")
|
||||
GK_ATOM(popupshown, "popupshown")
|
||||
|
@ -3903,7 +3903,7 @@ nsXMLHttpRequest::GetInterface(const nsIID & aIID, void **aResult)
|
||||
}
|
||||
|
||||
JS::Value
|
||||
nsXMLHttpRequest::GetInterface(JSContext* aCx, nsIJSIID* aIID, ErrorResult& aRv)
|
||||
nsXMLHttpRequest::GetInterface(JSContext* aCx, nsIJSID* aIID, ErrorResult& aRv)
|
||||
{
|
||||
const nsID* iid = aIID->GetID();
|
||||
nsCOMPtr<nsISupports> result;
|
||||
|
@ -448,7 +448,7 @@ public:
|
||||
}
|
||||
|
||||
// We need a GetInterface callable from JS for chrome JS
|
||||
JS::Value GetInterface(JSContext* aCx, nsIJSIID* aIID, ErrorResult& aRv);
|
||||
JS::Value GetInterface(JSContext* aCx, nsIJSID* aIID, ErrorResult& aRv);
|
||||
|
||||
// This creates a trusted readystatechange event, which is not cancelable and
|
||||
// doesn't bubble.
|
||||
|
@ -47,6 +47,7 @@ MOCHITEST_CHROME_FILES = \
|
||||
test_bug780199.xul \
|
||||
test_bug780529.xul \
|
||||
test_csp_bug768029.html \
|
||||
test_bug800386.xul \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
66
content/base/test/chrome/test_bug800386.xul
Normal file
66
content/base/test/chrome/test_bug800386.xul
Normal file
@ -0,0 +1,66 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
|
||||
<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=800386
|
||||
-->
|
||||
<window title="Mozilla Bug 800386"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
|
||||
|
||||
<!-- test results are displayed in the html:body -->
|
||||
<body xmlns="http://www.w3.org/1999/xhtml">
|
||||
<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=800386"
|
||||
target="_blank">Mozilla Bug 800386</a>
|
||||
</body>
|
||||
|
||||
<!-- test code goes here -->
|
||||
<script type="application/javascript">
|
||||
<![CDATA[
|
||||
/** Test for Bug 800386 **/
|
||||
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var triedForwarding = false;
|
||||
var forwardFailed = false;
|
||||
|
||||
var xhr = new XMLHttpRequest;
|
||||
var eventSink = xhr.getInterface(Components.interfaces.nsIProgressEventSink);
|
||||
isnot(eventSink, null, "Should get event sink directly!");
|
||||
|
||||
// Now jump through some hoops to get us a getInterface call from C++
|
||||
|
||||
var requestor = {
|
||||
getInterface: function(aIID) {
|
||||
if (aIID.equals(Components.interfaces.nsIProgressEventSink)) {
|
||||
triedForwarding = true;
|
||||
try {
|
||||
return xhr.getInterface(aIID);
|
||||
} catch (e) {
|
||||
forwardFailed = true;
|
||||
}
|
||||
}
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
},
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsISupports,
|
||||
Components.interfaces.nsIInterfaceRequestor])
|
||||
};
|
||||
|
||||
// HTTP URI so that we get progress callbacks
|
||||
xhr.open("GET", "http://mochi.test:8888/", false);
|
||||
xhr.channel.notificationCallbacks = requestor;
|
||||
xhr.onreadystatechange = function() {
|
||||
if (xhr.readyState == 4) {
|
||||
ok(triedForwarding,
|
||||
"Should have had an attempt to treat us as a progress event sink");
|
||||
ok(!forwardFailed,
|
||||
"Should have been able to forward getInterface on to the XHR");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}
|
||||
xhr.send();
|
||||
]]>
|
||||
</script>
|
||||
</window>
|
@ -61,17 +61,17 @@
|
||||
#define MINVALUE_GL_MAX_RENDERBUFFER_SIZE 1024 // Different from the spec, which sets it to 1 on page 164
|
||||
#define MINVALUE_GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 8 // Page 164
|
||||
|
||||
#define DECL_WEBGL_TYPEDEF(type) typedef type Web##type;
|
||||
DECL_WEBGL_TYPEDEF(GLenum)
|
||||
DECL_WEBGL_TYPEDEF(GLbitfield)
|
||||
DECL_WEBGL_TYPEDEF(GLint)
|
||||
DECL_WEBGL_TYPEDEF(GLsizei)
|
||||
DECL_WEBGL_TYPEDEF(GLsizeiptr)
|
||||
DECL_WEBGL_TYPEDEF(GLintptr)
|
||||
DECL_WEBGL_TYPEDEF(GLuint)
|
||||
DECL_WEBGL_TYPEDEF(GLfloat)
|
||||
DECL_WEBGL_TYPEDEF(GLclampf)
|
||||
typedef realGLboolean WebGLboolean;
|
||||
// Manual reflection of WebIDL typedefs
|
||||
typedef uint32_t WebGLenum;
|
||||
typedef uint32_t WebGLbitfield;
|
||||
typedef int32_t WebGLint;
|
||||
typedef int32_t WebGLsizei;
|
||||
typedef int64_t WebGLsizeiptr;
|
||||
typedef int64_t WebGLintptr;
|
||||
typedef uint32_t WebGLuint;
|
||||
typedef float WebGLfloat;
|
||||
typedef float WebGLclampf;
|
||||
typedef bool WebGLboolean;
|
||||
|
||||
class nsIPropertyBag;
|
||||
|
||||
@ -1041,7 +1041,15 @@ public:
|
||||
const float* data);
|
||||
|
||||
void UseProgram(WebGLProgram *prog);
|
||||
bool ValidateAttribArraySetter(const char* name, uint32_t cnt, uint32_t arrayLength);
|
||||
bool ValidateUniformArraySetter(const char* name, uint32_t expectedElemSize, WebGLUniformLocation *location_object,
|
||||
GLint& location, uint32_t& numElementsToUpload, uint32_t arrayLength);
|
||||
bool ValidateUniformMatrixArraySetter(const char* name, int dim, WebGLUniformLocation *location_object,
|
||||
GLint& location, uint32_t& numElementsToUpload, uint32_t arrayLength,
|
||||
WebGLboolean aTranspose);
|
||||
bool ValidateUniformSetter(const char* name, WebGLUniformLocation *location_object, GLint& location);
|
||||
void ValidateProgram(WebGLProgram *prog);
|
||||
bool ValidateUniformLocation(const char* info, WebGLUniformLocation *location_object);
|
||||
|
||||
void VertexAttrib1f(WebGLuint index, WebGLfloat x0);
|
||||
void VertexAttrib2f(WebGLuint index, WebGLfloat x0, WebGLfloat x1);
|
||||
|
@ -3610,170 +3610,249 @@ WebGLContext::SurfaceFromElementResultToImageSurface(nsLayoutUtils::SurfaceFromE
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#define OBTAIN_UNIFORM_LOCATION(info) \
|
||||
if (!ValidateObjectAllowNull(info, location_object)) \
|
||||
return; \
|
||||
if (!location_object) \
|
||||
return; \
|
||||
/* the need to check specifically for !mCurrentProgram here is explained in bug 657556 */ \
|
||||
if (!mCurrentProgram) \
|
||||
return ErrorInvalidOperation("%s: no program is currently bound", info); \
|
||||
if (mCurrentProgram != location_object->Program()) \
|
||||
return ErrorInvalidOperation("%s: this uniform location doesn't correspond to the current program", info); \
|
||||
if (mCurrentProgram->Generation() != location_object->ProgramGeneration()) \
|
||||
return ErrorInvalidOperation("%s: This uniform location is obsolete since the program has been relinked", info); \
|
||||
GLint location = location_object->Location();
|
||||
|
||||
#define SIMPLE_ARRAY_METHOD_UNIFORM(name, expectedElemSize, arrayType, ptrType) \
|
||||
void \
|
||||
WebGLContext::name##_base(WebGLUniformLocation *location_object, \
|
||||
uint32_t arrayLength, const ptrType* data) { \
|
||||
if (!IsContextStable()) { \
|
||||
return; \
|
||||
} \
|
||||
\
|
||||
OBTAIN_UNIFORM_LOCATION(#name ": location") \
|
||||
int uniformElemSize = location_object->ElementSize(); \
|
||||
if (expectedElemSize != uniformElemSize) { \
|
||||
return ErrorInvalidOperation( \
|
||||
#name ": this function expected a uniform of element size %d," \
|
||||
" got a uniform of element size %d", \
|
||||
expectedElemSize, \
|
||||
uniformElemSize); \
|
||||
} \
|
||||
const WebGLUniformInfo& info = location_object->Info(); \
|
||||
if (arrayLength == 0 || \
|
||||
arrayLength % expectedElemSize) \
|
||||
{ \
|
||||
return ErrorInvalidValue("%s: expected an array of length a multiple" \
|
||||
" of %d, got an array of length %d", \
|
||||
#name, \
|
||||
expectedElemSize, \
|
||||
arrayLength); \
|
||||
} \
|
||||
if (!info.isArray && \
|
||||
arrayLength != expectedElemSize) { \
|
||||
return ErrorInvalidOperation("%s: expected an array of length exactly" \
|
||||
" %d (since this uniform is not an array" \
|
||||
" uniform), got an array of length %d", \
|
||||
#name, \
|
||||
expectedElemSize, \
|
||||
arrayLength); \
|
||||
} \
|
||||
\
|
||||
uint32_t numElementsToUpload = \
|
||||
NS_MIN(info.arraySize, arrayLength / expectedElemSize); \
|
||||
MakeContextCurrent(); \
|
||||
gl->f##name(location, numElementsToUpload, data); \
|
||||
void
|
||||
WebGLContext::Uniform1i(WebGLUniformLocation *location_object, WebGLint a1)
|
||||
{
|
||||
GLint location;
|
||||
if (!ValidateUniformSetter("Uniform1i", location_object, location))
|
||||
return;
|
||||
MakeContextCurrent();
|
||||
gl->fUniform1i(location, a1);
|
||||
}
|
||||
|
||||
#define SIMPLE_MATRIX_METHOD_UNIFORM(name, dim) \
|
||||
void \
|
||||
WebGLContext::name##_base(WebGLUniformLocation* location_object, \
|
||||
WebGLboolean aTranspose, uint32_t arrayLength, \
|
||||
const float* data) \
|
||||
{ \
|
||||
uint32_t expectedElemSize = (dim)*(dim); \
|
||||
if (!IsContextStable()) { \
|
||||
return; \
|
||||
} \
|
||||
\
|
||||
OBTAIN_UNIFORM_LOCATION(#name ": location") \
|
||||
uint32_t uniformElemSize = location_object->ElementSize(); \
|
||||
if (expectedElemSize != uniformElemSize) { \
|
||||
return ErrorInvalidOperation( \
|
||||
#name ": this function expected a uniform of element size %d," \
|
||||
" got a uniform of element size %d", \
|
||||
expectedElemSize, \
|
||||
uniformElemSize); \
|
||||
} \
|
||||
const WebGLUniformInfo& info = location_object->Info(); \
|
||||
if (arrayLength == 0 || \
|
||||
arrayLength % expectedElemSize) \
|
||||
{ \
|
||||
return ErrorInvalidValue("%s: expected an array of length a multiple" \
|
||||
" of %d, got an array of length %d", \
|
||||
#name, \
|
||||
expectedElemSize, \
|
||||
arrayLength); \
|
||||
} \
|
||||
if (!info.isArray && \
|
||||
arrayLength != expectedElemSize) { \
|
||||
return ErrorInvalidOperation("%s: expected an array of length exactly" \
|
||||
" %d (since this uniform is not an array" \
|
||||
" uniform), got an array of length %d", \
|
||||
#name, \
|
||||
expectedElemSize, \
|
||||
arrayLength); \
|
||||
} \
|
||||
if (aTranspose) { \
|
||||
return ErrorInvalidValue(#name ": transpose must be FALSE as per the " \
|
||||
"OpenGL ES 2.0 spec"); \
|
||||
} \
|
||||
\
|
||||
MakeContextCurrent(); \
|
||||
uint32_t numElementsToUpload = \
|
||||
NS_MIN(info.arraySize, arrayLength / (expectedElemSize)); \
|
||||
gl->f##name(location, numElementsToUpload, false, data); \
|
||||
void
|
||||
WebGLContext::Uniform2i(WebGLUniformLocation *location_object, WebGLint a1,
|
||||
WebGLint a2)
|
||||
{
|
||||
GLint location;
|
||||
if (!ValidateUniformSetter("Uniform2i", location_object, location))
|
||||
return;
|
||||
MakeContextCurrent();
|
||||
gl->fUniform2i(location, a1, a2);
|
||||
}
|
||||
|
||||
#define SIMPLE_METHOD_UNIFORM_1(glname, name, t1) \
|
||||
void WebGLContext::name(WebGLUniformLocation *location_object, t1 a1) { \
|
||||
if (!IsContextStable()) \
|
||||
return; \
|
||||
OBTAIN_UNIFORM_LOCATION(#name ": location") \
|
||||
MakeContextCurrent(); gl->f##glname(location, a1); \
|
||||
void
|
||||
WebGLContext::Uniform3i(WebGLUniformLocation *location_object, WebGLint a1,
|
||||
WebGLint a2, WebGLint a3)
|
||||
{
|
||||
GLint location;
|
||||
if (!ValidateUniformSetter("Uniform3i", location_object, location))
|
||||
return;
|
||||
MakeContextCurrent();
|
||||
gl->fUniform3i(location, a1, a2, a3);
|
||||
}
|
||||
|
||||
#define SIMPLE_METHOD_UNIFORM_2(glname, name, t1, t2) \
|
||||
void WebGLContext::name(WebGLUniformLocation *location_object, t1 a1, t2 a2) { \
|
||||
if (!IsContextStable()) \
|
||||
return; \
|
||||
OBTAIN_UNIFORM_LOCATION(#name ": location") \
|
||||
MakeContextCurrent(); gl->f##glname(location, a1, a2); \
|
||||
void
|
||||
WebGLContext::Uniform4i(WebGLUniformLocation *location_object, WebGLint a1,
|
||||
WebGLint a2, WebGLint a3, WebGLint a4)
|
||||
{
|
||||
GLint location;
|
||||
if (!ValidateUniformSetter("Uniform4i", location_object, location))
|
||||
return;
|
||||
MakeContextCurrent();
|
||||
gl->fUniform4i(location, a1, a2, a3, a4);
|
||||
}
|
||||
|
||||
#define SIMPLE_METHOD_UNIFORM_3(glname, name, t1, t2, t3) \
|
||||
void WebGLContext::name(WebGLUniformLocation *location_object, \
|
||||
t1 a1, t2 a2, t3 a3) { \
|
||||
if (!IsContextStable()) \
|
||||
return; \
|
||||
OBTAIN_UNIFORM_LOCATION(#name ": location") \
|
||||
MakeContextCurrent(); gl->f##glname(location, a1, a2, a3); \
|
||||
void
|
||||
WebGLContext::Uniform1f(WebGLUniformLocation *location_object, WebGLfloat a1)
|
||||
{
|
||||
GLint location;
|
||||
if (!ValidateUniformSetter("Uniform1f", location_object, location))
|
||||
return;
|
||||
MakeContextCurrent();
|
||||
gl->fUniform1f(location, a1);
|
||||
}
|
||||
|
||||
#define SIMPLE_METHOD_UNIFORM_4(glname, name, t1, t2, t3, t4) \
|
||||
void WebGLContext::name(WebGLUniformLocation *location_object, \
|
||||
t1 a1, t2 a2, t3 a3, t4 a4) { \
|
||||
if (!IsContextStable()) \
|
||||
return; \
|
||||
OBTAIN_UNIFORM_LOCATION(#name ": location") \
|
||||
MakeContextCurrent(); gl->f##glname(location, a1, a2, a3, a4); \
|
||||
void
|
||||
WebGLContext::Uniform2f(WebGLUniformLocation *location_object, WebGLfloat a1,
|
||||
WebGLfloat a2)
|
||||
{
|
||||
GLint location;
|
||||
if (!ValidateUniformSetter("Uniform2f", location_object, location))
|
||||
return;
|
||||
MakeContextCurrent();
|
||||
gl->fUniform2f(location, a1, a2);
|
||||
}
|
||||
|
||||
SIMPLE_METHOD_UNIFORM_1(Uniform1i, Uniform1i, WebGLint)
|
||||
SIMPLE_METHOD_UNIFORM_2(Uniform2i, Uniform2i, WebGLint, WebGLint)
|
||||
SIMPLE_METHOD_UNIFORM_3(Uniform3i, Uniform3i, WebGLint, WebGLint, WebGLint)
|
||||
SIMPLE_METHOD_UNIFORM_4(Uniform4i, Uniform4i, WebGLint, WebGLint, WebGLint, WebGLint)
|
||||
void
|
||||
WebGLContext::Uniform3f(WebGLUniformLocation *location_object, WebGLfloat a1,
|
||||
WebGLfloat a2, WebGLfloat a3)
|
||||
{
|
||||
GLint location;
|
||||
if (!ValidateUniformSetter("Uniform3f", location_object, location))
|
||||
return;
|
||||
MakeContextCurrent();
|
||||
gl->fUniform3f(location, a1, a2, a3);
|
||||
}
|
||||
|
||||
SIMPLE_METHOD_UNIFORM_1(Uniform1f, Uniform1f, WebGLfloat)
|
||||
SIMPLE_METHOD_UNIFORM_2(Uniform2f, Uniform2f, WebGLfloat, WebGLfloat)
|
||||
SIMPLE_METHOD_UNIFORM_3(Uniform3f, Uniform3f, WebGLfloat, WebGLfloat, WebGLfloat)
|
||||
SIMPLE_METHOD_UNIFORM_4(Uniform4f, Uniform4f, WebGLfloat, WebGLfloat, WebGLfloat, WebGLfloat)
|
||||
void
|
||||
WebGLContext::Uniform4f(WebGLUniformLocation *location_object, WebGLfloat a1,
|
||||
WebGLfloat a2, WebGLfloat a3, WebGLfloat a4)
|
||||
{
|
||||
GLint location;
|
||||
if (!ValidateUniformSetter("Uniform4f", location_object, location))
|
||||
return;
|
||||
MakeContextCurrent();
|
||||
gl->fUniform4f(location, a1, a2, a3, a4);
|
||||
}
|
||||
|
||||
SIMPLE_ARRAY_METHOD_UNIFORM(Uniform1iv, 1, Int32, WebGLint)
|
||||
SIMPLE_ARRAY_METHOD_UNIFORM(Uniform2iv, 2, Int32, WebGLint)
|
||||
SIMPLE_ARRAY_METHOD_UNIFORM(Uniform3iv, 3, Int32, WebGLint)
|
||||
SIMPLE_ARRAY_METHOD_UNIFORM(Uniform4iv, 4, Int32, WebGLint)
|
||||
void
|
||||
WebGLContext::Uniform1iv_base(WebGLUniformLocation *location_object,
|
||||
uint32_t arrayLength, const WebGLint* data)
|
||||
{
|
||||
uint32_t numElementsToUpload;
|
||||
GLint location;
|
||||
if (!ValidateUniformArraySetter("Uniform1iv", 1, location_object, location,
|
||||
numElementsToUpload, arrayLength)) {
|
||||
return;
|
||||
}
|
||||
MakeContextCurrent();
|
||||
gl->fUniform1iv(location, numElementsToUpload, data);
|
||||
}
|
||||
|
||||
SIMPLE_ARRAY_METHOD_UNIFORM(Uniform1fv, 1, Float32, WebGLfloat)
|
||||
SIMPLE_ARRAY_METHOD_UNIFORM(Uniform2fv, 2, Float32, WebGLfloat)
|
||||
SIMPLE_ARRAY_METHOD_UNIFORM(Uniform3fv, 3, Float32, WebGLfloat)
|
||||
SIMPLE_ARRAY_METHOD_UNIFORM(Uniform4fv, 4, Float32, WebGLfloat)
|
||||
void
|
||||
WebGLContext::Uniform2iv_base(WebGLUniformLocation *location_object,
|
||||
uint32_t arrayLength, const WebGLint* data)
|
||||
{
|
||||
uint32_t numElementsToUpload;
|
||||
GLint location;
|
||||
if (!ValidateUniformArraySetter("Uniform2iv", 2, location_object, location,
|
||||
numElementsToUpload, arrayLength)) {
|
||||
return;
|
||||
}
|
||||
MakeContextCurrent();
|
||||
gl->fUniform2iv(location, numElementsToUpload, data);
|
||||
}
|
||||
|
||||
SIMPLE_MATRIX_METHOD_UNIFORM(UniformMatrix2fv, 2)
|
||||
SIMPLE_MATRIX_METHOD_UNIFORM(UniformMatrix3fv, 3)
|
||||
SIMPLE_MATRIX_METHOD_UNIFORM(UniformMatrix4fv, 4)
|
||||
void
|
||||
WebGLContext::Uniform3iv_base(WebGLUniformLocation *location_object,
|
||||
uint32_t arrayLength, const WebGLint* data)
|
||||
{
|
||||
uint32_t numElementsToUpload;
|
||||
GLint location;
|
||||
if (!ValidateUniformArraySetter("Uniform3iv", 3, location_object, location,
|
||||
numElementsToUpload, arrayLength)) {
|
||||
return;
|
||||
}
|
||||
MakeContextCurrent();
|
||||
gl->fUniform3iv(location, numElementsToUpload, data);
|
||||
}
|
||||
|
||||
void
|
||||
WebGLContext::Uniform4iv_base(WebGLUniformLocation *location_object,
|
||||
uint32_t arrayLength, const WebGLint* data)
|
||||
{
|
||||
uint32_t numElementsToUpload;
|
||||
GLint location;
|
||||
if (!ValidateUniformArraySetter("Uniform4iv", 4, location_object, location,
|
||||
numElementsToUpload, arrayLength)) {
|
||||
return;
|
||||
}
|
||||
MakeContextCurrent();
|
||||
gl->fUniform4iv(location, numElementsToUpload, data);
|
||||
}
|
||||
|
||||
void
|
||||
WebGLContext::Uniform1fv_base(WebGLUniformLocation *location_object,
|
||||
uint32_t arrayLength, const WebGLfloat* data)
|
||||
{
|
||||
uint32_t numElementsToUpload;
|
||||
GLint location;
|
||||
if (!ValidateUniformArraySetter("Uniform1fv", 1, location_object, location,
|
||||
numElementsToUpload, arrayLength)) {
|
||||
return;
|
||||
}
|
||||
MakeContextCurrent();
|
||||
gl->fUniform1fv(location, numElementsToUpload, data);
|
||||
}
|
||||
|
||||
void
|
||||
WebGLContext::Uniform2fv_base(WebGLUniformLocation *location_object,
|
||||
uint32_t arrayLength, const WebGLfloat* data)
|
||||
{
|
||||
uint32_t numElementsToUpload;
|
||||
GLint location;
|
||||
if (!ValidateUniformArraySetter("Uniform2fv", 2, location_object, location,
|
||||
numElementsToUpload, arrayLength)) {
|
||||
return;
|
||||
}
|
||||
MakeContextCurrent();
|
||||
gl->fUniform2fv(location, numElementsToUpload, data);
|
||||
}
|
||||
|
||||
void
|
||||
WebGLContext::Uniform3fv_base(WebGLUniformLocation *location_object,
|
||||
uint32_t arrayLength, const WebGLfloat* data)
|
||||
{
|
||||
uint32_t numElementsToUpload;
|
||||
GLint location;
|
||||
if (!ValidateUniformArraySetter("Uniform3fv", 3, location_object, location,
|
||||
numElementsToUpload, arrayLength)) {
|
||||
return;
|
||||
}
|
||||
MakeContextCurrent();
|
||||
gl->fUniform3fv(location, numElementsToUpload, data);
|
||||
}
|
||||
|
||||
void
|
||||
WebGLContext::Uniform4fv_base(WebGLUniformLocation *location_object,
|
||||
uint32_t arrayLength, const WebGLfloat* data)
|
||||
{
|
||||
uint32_t numElementsToUpload;
|
||||
GLint location;
|
||||
if (!ValidateUniformArraySetter("Uniform4fv", 4, location_object, location,
|
||||
numElementsToUpload, arrayLength)) {
|
||||
return;
|
||||
}
|
||||
MakeContextCurrent();
|
||||
gl->fUniform4fv(location, numElementsToUpload, data);
|
||||
}
|
||||
|
||||
void
|
||||
WebGLContext::UniformMatrix2fv_base(WebGLUniformLocation* location_object,
|
||||
WebGLboolean aTranspose, uint32_t arrayLength,
|
||||
const float* data)
|
||||
{
|
||||
uint32_t numElementsToUpload;
|
||||
GLint location;
|
||||
if (!ValidateUniformMatrixArraySetter("UniformMatrix2fv", 2, location_object, location,
|
||||
numElementsToUpload, arrayLength, aTranspose)) {
|
||||
return;
|
||||
}
|
||||
MakeContextCurrent();
|
||||
gl->fUniformMatrix2fv(location, numElementsToUpload, false, data);
|
||||
}
|
||||
|
||||
void
|
||||
WebGLContext::UniformMatrix3fv_base(WebGLUniformLocation* location_object,
|
||||
WebGLboolean aTranspose, uint32_t arrayLength,
|
||||
const float* data)
|
||||
{
|
||||
uint32_t numElementsToUpload;
|
||||
GLint location;
|
||||
if (!ValidateUniformMatrixArraySetter("UniformMatrix3fv", 3, location_object, location,
|
||||
numElementsToUpload, arrayLength, aTranspose)) {
|
||||
return;
|
||||
}
|
||||
MakeContextCurrent();
|
||||
gl->fUniformMatrix3fv(location, numElementsToUpload, false, data);
|
||||
}
|
||||
|
||||
void
|
||||
WebGLContext::UniformMatrix4fv_base(WebGLUniformLocation* location_object,
|
||||
WebGLboolean aTranspose, uint32_t arrayLength,
|
||||
const float* data)
|
||||
{
|
||||
uint32_t numElementsToUpload;
|
||||
GLint location;
|
||||
if (!ValidateUniformMatrixArraySetter("UniformMatrix4fv", 4, location_object, location,
|
||||
numElementsToUpload, arrayLength, aTranspose)) {
|
||||
return;
|
||||
}
|
||||
MakeContextCurrent();
|
||||
gl->fUniformMatrix4fv(location, numElementsToUpload, false, data);
|
||||
}
|
||||
|
||||
void
|
||||
WebGLContext::VertexAttrib1f(WebGLuint index, WebGLfloat x0)
|
||||
@ -3856,36 +3935,86 @@ WebGLContext::VertexAttrib4f(WebGLuint index, WebGLfloat x0, WebGLfloat x1,
|
||||
}
|
||||
}
|
||||
|
||||
#define SIMPLE_ARRAY_METHOD_NO_COUNT(name, cnt, ptrType) \
|
||||
void \
|
||||
WebGLContext::name##_base(WebGLuint idx, uint32_t arrayLength, \
|
||||
const WebGLfloat* ptr) \
|
||||
{ \
|
||||
if (!IsContextStable()) { \
|
||||
return; \
|
||||
} \
|
||||
if (arrayLength < cnt) { \
|
||||
return ErrorInvalidOperation(#name ": array must be >= %d elements", \
|
||||
cnt); \
|
||||
} \
|
||||
\
|
||||
MakeContextCurrent(); \
|
||||
if (idx) { \
|
||||
gl->f##name(idx, ptr); \
|
||||
} else { \
|
||||
mVertexAttrib0Vector[0] = ptr[0]; \
|
||||
mVertexAttrib0Vector[1] = cnt > 1 ? ptr[1] : ptrType(0); \
|
||||
mVertexAttrib0Vector[2] = cnt > 2 ? ptr[2] : ptrType(0); \
|
||||
mVertexAttrib0Vector[3] = cnt > 3 ? ptr[3] : ptrType(1); \
|
||||
if (gl->IsGLES2()) \
|
||||
gl->f##name(idx, ptr); \
|
||||
} \
|
||||
|
||||
void
|
||||
WebGLContext::VertexAttrib1fv_base(WebGLuint idx, uint32_t arrayLength,
|
||||
const WebGLfloat* ptr)
|
||||
{
|
||||
if (!ValidateAttribArraySetter("VertexAttrib1fv", 1, arrayLength))
|
||||
return;
|
||||
|
||||
MakeContextCurrent();
|
||||
if (idx) {
|
||||
gl->fVertexAttrib1fv(idx, ptr);
|
||||
} else {
|
||||
mVertexAttrib0Vector[0] = ptr[0];
|
||||
mVertexAttrib0Vector[1] = WebGLfloat(0);
|
||||
mVertexAttrib0Vector[2] = WebGLfloat(0);
|
||||
mVertexAttrib0Vector[3] = WebGLfloat(1);
|
||||
if (gl->IsGLES2())
|
||||
gl->fVertexAttrib1fv(idx, ptr);
|
||||
}
|
||||
}
|
||||
|
||||
SIMPLE_ARRAY_METHOD_NO_COUNT(VertexAttrib1fv, 1, WebGLfloat)
|
||||
SIMPLE_ARRAY_METHOD_NO_COUNT(VertexAttrib2fv, 2, WebGLfloat)
|
||||
SIMPLE_ARRAY_METHOD_NO_COUNT(VertexAttrib3fv, 3, WebGLfloat)
|
||||
SIMPLE_ARRAY_METHOD_NO_COUNT(VertexAttrib4fv, 4, WebGLfloat)
|
||||
void
|
||||
WebGLContext::VertexAttrib2fv_base(WebGLuint idx, uint32_t arrayLength,
|
||||
const WebGLfloat* ptr)
|
||||
{
|
||||
if (!ValidateAttribArraySetter("VertexAttrib2fv", 2, arrayLength))
|
||||
return;
|
||||
|
||||
MakeContextCurrent();
|
||||
if (idx) {
|
||||
gl->fVertexAttrib2fv(idx, ptr);
|
||||
} else {
|
||||
mVertexAttrib0Vector[0] = ptr[0];
|
||||
mVertexAttrib0Vector[1] = ptr[1];
|
||||
mVertexAttrib0Vector[2] = WebGLfloat(0);
|
||||
mVertexAttrib0Vector[3] = WebGLfloat(1);
|
||||
if (gl->IsGLES2())
|
||||
gl->fVertexAttrib2fv(idx, ptr);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
WebGLContext::VertexAttrib3fv_base(WebGLuint idx, uint32_t arrayLength,
|
||||
const WebGLfloat* ptr)
|
||||
{
|
||||
if (!ValidateAttribArraySetter("VertexAttrib3fv", 3, arrayLength))
|
||||
return;
|
||||
|
||||
MakeContextCurrent();
|
||||
if (idx) {
|
||||
gl->fVertexAttrib3fv(idx, ptr);
|
||||
} else {
|
||||
mVertexAttrib0Vector[0] = ptr[0];
|
||||
mVertexAttrib0Vector[1] = ptr[1];
|
||||
mVertexAttrib0Vector[2] = ptr[2];
|
||||
mVertexAttrib0Vector[3] = WebGLfloat(1);
|
||||
if (gl->IsGLES2())
|
||||
gl->fVertexAttrib3fv(idx, ptr);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
WebGLContext::VertexAttrib4fv_base(WebGLuint idx, uint32_t arrayLength,
|
||||
const WebGLfloat* ptr)
|
||||
{
|
||||
if (!ValidateAttribArraySetter("VertexAttrib4fv", 4, arrayLength))
|
||||
return;
|
||||
|
||||
MakeContextCurrent();
|
||||
if (idx) {
|
||||
gl->fVertexAttrib4fv(idx, ptr);
|
||||
} else {
|
||||
mVertexAttrib0Vector[0] = ptr[0];
|
||||
mVertexAttrib0Vector[1] = ptr[1];
|
||||
mVertexAttrib0Vector[2] = ptr[2];
|
||||
mVertexAttrib0Vector[3] = ptr[3];
|
||||
if (gl->IsGLES2())
|
||||
gl->fVertexAttrib4fv(idx, ptr);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
WebGLContext::UseProgram(WebGLProgram *prog)
|
||||
|
@ -657,6 +657,151 @@ bool WebGLContext::ValidateTexFormatAndType(WebGLenum format, WebGLenum type, in
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
WebGLContext::ValidateUniformLocation(const char* info, WebGLUniformLocation *location_object)
|
||||
{
|
||||
if (!ValidateObjectAllowNull(info, location_object))
|
||||
return false;
|
||||
if (!location_object)
|
||||
return false;
|
||||
/* the need to check specifically for !mCurrentProgram here is explained in bug 657556 */
|
||||
if (!mCurrentProgram) {
|
||||
ErrorInvalidOperation("%s: no program is currently bound", info);
|
||||
return false;
|
||||
}
|
||||
if (mCurrentProgram != location_object->Program()) {
|
||||
ErrorInvalidOperation("%s: this uniform location doesn't correspond to the current program", info);
|
||||
return false;
|
||||
}
|
||||
if (mCurrentProgram->Generation() != location_object->ProgramGeneration()) {
|
||||
ErrorInvalidOperation("%s: This uniform location is obsolete since the program has been relinked", info);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
WebGLContext::ValidateAttribArraySetter(const char* name, uint32_t cnt, uint32_t arrayLength)
|
||||
{
|
||||
if (!IsContextStable()) {
|
||||
return false;
|
||||
}
|
||||
if (arrayLength < cnt) {
|
||||
ErrorInvalidOperation("%s: array must be >= %d elements", name, cnt);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
WebGLContext::ValidateUniformArraySetter(const char* name, uint32_t expectedElemSize, WebGLUniformLocation *location_object,
|
||||
GLint& location, uint32_t& numElementsToUpload, uint32_t arrayLength)
|
||||
{
|
||||
if (!IsContextStable())
|
||||
return false;
|
||||
nsCString nameString(name);
|
||||
nsCString suffix = NS_LITERAL_CSTRING(": location");
|
||||
nsCString concatenated = nameString + suffix;
|
||||
if (!ValidateUniformLocation(concatenated.get(), location_object))
|
||||
return false;
|
||||
location = location_object->Location();
|
||||
uint32_t uniformElemSize = location_object->ElementSize();
|
||||
if (expectedElemSize != uniformElemSize) {
|
||||
ErrorInvalidOperation("%s: this function expected a uniform of element size %d,"
|
||||
" got a uniform of element size %d", name,
|
||||
expectedElemSize,
|
||||
uniformElemSize);
|
||||
return false;
|
||||
}
|
||||
const WebGLUniformInfo& info = location_object->Info();
|
||||
if (arrayLength == 0 ||
|
||||
arrayLength % expectedElemSize)
|
||||
{
|
||||
ErrorInvalidValue("%s: expected an array of length a multiple"
|
||||
" of %d, got an array of length %d", name,
|
||||
expectedElemSize,
|
||||
arrayLength);
|
||||
return false;
|
||||
}
|
||||
if (!info.isArray &&
|
||||
arrayLength != expectedElemSize) {
|
||||
ErrorInvalidOperation("%s: expected an array of length exactly"
|
||||
" %d (since this uniform is not an array"
|
||||
" uniform), got an array of length %d", name,
|
||||
expectedElemSize,
|
||||
arrayLength);
|
||||
return false;
|
||||
}
|
||||
numElementsToUpload =
|
||||
NS_MIN(info.arraySize, arrayLength / expectedElemSize);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
WebGLContext::ValidateUniformMatrixArraySetter(const char* name, int dim, WebGLUniformLocation *location_object,
|
||||
GLint& location, uint32_t& numElementsToUpload, uint32_t arrayLength,
|
||||
WebGLboolean aTranspose)
|
||||
{
|
||||
uint32_t expectedElemSize = (dim)*(dim);
|
||||
if (!IsContextStable())
|
||||
return false;
|
||||
nsCString nameString(name);
|
||||
nsCString suffix = NS_LITERAL_CSTRING(": location");
|
||||
nsCString concatenated = nameString + suffix;
|
||||
if (!ValidateUniformLocation(concatenated.get(), location_object))
|
||||
return false;
|
||||
location = location_object->Location();
|
||||
uint32_t uniformElemSize = location_object->ElementSize();
|
||||
if (expectedElemSize != uniformElemSize) {
|
||||
ErrorInvalidOperation("%s: this function expected a uniform of element size %d,"
|
||||
" got a uniform of element size %d", name,
|
||||
expectedElemSize,
|
||||
uniformElemSize);
|
||||
return false;
|
||||
}
|
||||
const WebGLUniformInfo& info = location_object->Info();
|
||||
if (arrayLength == 0 ||
|
||||
arrayLength % expectedElemSize)
|
||||
{
|
||||
ErrorInvalidValue("%s: expected an array of length a multiple"
|
||||
" of %d, got an array of length %d", name,
|
||||
expectedElemSize,
|
||||
arrayLength);
|
||||
return false;
|
||||
}
|
||||
if (!info.isArray &&
|
||||
arrayLength != expectedElemSize) {
|
||||
ErrorInvalidOperation("%s: expected an array of length exactly"
|
||||
" %d (since this uniform is not an array"
|
||||
" uniform), got an array of length %d", name,
|
||||
expectedElemSize,
|
||||
arrayLength);
|
||||
return false;
|
||||
}
|
||||
if (aTranspose) {
|
||||
ErrorInvalidValue("%s: transpose must be FALSE as per the "
|
||||
"OpenGL ES 2.0 spec", name);
|
||||
return false;
|
||||
}
|
||||
numElementsToUpload =
|
||||
NS_MIN(info.arraySize, arrayLength / (expectedElemSize));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
WebGLContext::ValidateUniformSetter(const char* name, WebGLUniformLocation *location_object, GLint& location)
|
||||
{
|
||||
if (!IsContextStable())
|
||||
return false;
|
||||
nsCString nameString(name);
|
||||
nsCString suffix = NS_LITERAL_CSTRING(": location");
|
||||
nsCString concatenated = nameString + suffix;
|
||||
if (!ValidateUniformLocation(concatenated.get(), location_object))
|
||||
return false;
|
||||
location = location_object->Location();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WebGLContext::ValidateAttribIndex(WebGLuint index, const char *info)
|
||||
{
|
||||
if (index >= mAttribBuffers.Length()) {
|
||||
|
@ -50,6 +50,7 @@ MOCHITEST_FILES = \
|
||||
test_2d.composite.uncovered.image.source-out.html \
|
||||
test_2d.drawImage.zerocanvas.html \
|
||||
test_2d.strokeRect.zero.5.html \
|
||||
test_toBlob.html \
|
||||
test_toDataURL_alpha.html \
|
||||
test_toDataURL_lowercase_ascii.html \
|
||||
test_toDataURL_parameters.html \
|
||||
|
42
content/canvas/test/test_toBlob.html
Normal file
42
content/canvas/test/test_toBlob.html
Normal file
@ -0,0 +1,42 @@
|
||||
<!DOCTYPE HTML>
|
||||
<title>Canvas test: mozGetAsFile</title>
|
||||
<script src="/MochiKit/MochiKit.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<body>
|
||||
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
|
||||
var gCompares = 2;
|
||||
|
||||
function BlobListener(type, canvas, file)
|
||||
{
|
||||
is(file.type, type,
|
||||
"When a valid type is specified that should be returned");
|
||||
var reader = new FileReader();
|
||||
reader.onload =
|
||||
function(e) {
|
||||
is(e.target.result, canvas.toDataURL(type),
|
||||
"<canvas>.mozGetAsFile().getAsDataURL() should equal <canvas>.toDataURL()");
|
||||
if (--gCompares == 0) {
|
||||
SimpleTest.finish();
|
||||
}
|
||||
};
|
||||
reader.readAsDataURL(file);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addLoadEvent(function () {
|
||||
|
||||
var canvas = document.getElementById('c');
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
ctx.drawImage(document.getElementById('yellow75.png'), 0, 0);
|
||||
|
||||
canvas.toBlob(BlobListener.bind(undefined, "image/png", canvas));
|
||||
canvas.toBlob(BlobListener.bind(undefined, "image/jpeg", canvas), "image/jpeg");
|
||||
|
||||
});
|
||||
</script>
|
||||
<img src="image_yellow75.png" id="yellow75.png" class="resource">
|
||||
|
@ -65,6 +65,7 @@
|
||||
#include "nsCaret.h"
|
||||
|
||||
#include "nsSubDocumentFrame.h"
|
||||
#include "nsIFrameTraversal.h"
|
||||
#include "nsLayoutCID.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
@ -113,6 +114,8 @@ using namespace mozilla::dom;
|
||||
|
||||
static const nsIntPoint kInvalidRefPoint = nsIntPoint(-1,-1);
|
||||
|
||||
static NS_DEFINE_CID(kFrameTraversalCID, NS_FRAMETRAVERSAL_CID);
|
||||
|
||||
static bool sLeftClickOnly = true;
|
||||
static bool sKeyCausesActivation = true;
|
||||
static uint32_t sESMInstanceCount = 0;
|
||||
|
@ -40,6 +40,32 @@ using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
using namespace mozilla::layers;
|
||||
|
||||
namespace {
|
||||
|
||||
class ToBlobRunnable : public nsRunnable
|
||||
{
|
||||
public:
|
||||
ToBlobRunnable(nsIFileCallback* aCallback,
|
||||
nsIDOMBlob* aBlob)
|
||||
: mCallback(aCallback),
|
||||
mBlob(aBlob)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
}
|
||||
|
||||
NS_IMETHOD Run()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
mCallback->Receive(mBlob);
|
||||
return NS_OK;
|
||||
}
|
||||
private:
|
||||
nsCOMPtr<nsIFileCallback> mCallback;
|
||||
nsCOMPtr<nsIDOMBlob> mBlob;
|
||||
};
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
class nsHTMLCanvasPrintState : public nsIDOMMozCanvasPrintState
|
||||
{
|
||||
public:
|
||||
@ -550,6 +576,51 @@ nsHTMLCanvasElement::ToDataURLImpl(const nsAString& aMimeType,
|
||||
return Base64EncodeInputStream(stream, aDataURL, (uint32_t)count, aDataURL.Length());
|
||||
}
|
||||
|
||||
// XXXkhuey the encoding should be off the main thread, but we're lazy.
|
||||
NS_IMETHODIMP
|
||||
nsHTMLCanvasElement::ToBlob(nsIFileCallback* aCallback,
|
||||
const nsAString& aType,
|
||||
nsIVariant* aParams,
|
||||
uint8_t optional_argc)
|
||||
{
|
||||
// do a trust check if this is a write-only canvas
|
||||
if (mWriteOnly && !nsContentUtils::IsCallerTrustedForRead()) {
|
||||
return NS_ERROR_DOM_SECURITY_ERR;
|
||||
}
|
||||
|
||||
nsAutoString type;
|
||||
nsresult rv = nsContentUtils::ASCIIToLower(aType, type);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
bool fallbackToPNG = false;
|
||||
|
||||
nsCOMPtr<nsIInputStream> stream;
|
||||
rv = ExtractData(type, EmptyString(), getter_AddRefs(stream), fallbackToPNG);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (fallbackToPNG) {
|
||||
type.AssignLiteral("image/png");
|
||||
}
|
||||
|
||||
uint64_t imgSize;
|
||||
rv = stream->Available(&imgSize);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_TRUE(imgSize <= UINT32_MAX, NS_ERROR_FILE_TOO_BIG);
|
||||
|
||||
void* imgData = nullptr;
|
||||
rv = NS_ReadInputStreamToBuffer(stream, &imgData, imgSize);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// The DOMFile takes ownership of the buffer
|
||||
nsRefPtr<nsDOMMemoryFile> blob =
|
||||
new nsDOMMemoryFile(imgData, imgSize, type);
|
||||
|
||||
nsRefPtr<ToBlobRunnable> runnable = new ToBlobRunnable(aCallback, blob);
|
||||
return NS_DispatchToCurrentThread(runnable);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLCanvasElement::MozGetAsFile(const nsAString& aName,
|
||||
const nsAString& aType,
|
||||
|
@ -1492,7 +1492,14 @@ nsHTMLDocument::Open(const nsAString& aContentTypeOrUrl,
|
||||
|
||||
nsCOMPtr<nsIScriptGlobalObject> newScope(do_QueryReferent(mScopeObject));
|
||||
if (oldScope && newScope != oldScope) {
|
||||
rv = nsContentUtils::ReparentContentWrappersInScope(cx, oldScope, newScope);
|
||||
nsIXPConnect *xpc = nsContentUtils::XPConnect();
|
||||
nsCOMPtr<nsIXPConnectJSObjectHolder> ignored;
|
||||
rv = xpc->ReparentWrappedNativeIfFound(cx, oldScope->GetGlobalJSObject(),
|
||||
newScope->GetGlobalJSObject(),
|
||||
static_cast<nsINode*>(this),
|
||||
getter_AddRefs(ignored));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = xpc->RescueOrphansInScope(cx, oldScope->GetGlobalJSObject());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
}
|
||||
|
@ -525,7 +525,6 @@ MediaStreamGraphImpl::FinishStream(MediaStream* aStream)
|
||||
{
|
||||
if (aStream->mFinished)
|
||||
return;
|
||||
printf("MediaStreamGraphImpl::FinishStream\n");
|
||||
LOG(PR_LOG_DEBUG, ("MediaStream %p will finish", aStream));
|
||||
aStream->mFinished = true;
|
||||
// Force at least one more iteration of the control loop, since we rely
|
||||
|
@ -959,7 +959,6 @@ void nsBuiltinDecoder::SeekingStoppedAtEnd()
|
||||
seekWasAborted = true;
|
||||
} else {
|
||||
UnpinForSeek();
|
||||
printf("nsBuiltinDecoder::SeekingStoppedAtEnd, next state=PLAY_STATE_ENDED\n");
|
||||
fireEnded = true;
|
||||
ChangeState(PLAY_STATE_ENDED);
|
||||
}
|
||||
@ -1049,9 +1048,6 @@ void nsBuiltinDecoder::PlaybackPositionChanged()
|
||||
// current time after the seek has started but before it has
|
||||
// completed.
|
||||
mCurrentTime = mDecoderStateMachine->GetCurrentTime();
|
||||
} else {
|
||||
printf("Suppressed timeupdate during seeking: currentTime=%f, new time=%f\n",
|
||||
mCurrentTime, mDecoderStateMachine->GetCurrentTime());
|
||||
}
|
||||
mDecoderStateMachine->ClearPositionChangeFlag();
|
||||
}
|
||||
|
@ -2138,7 +2138,6 @@ nsresult nsBuiltinDecoderStateMachine::RunStateMachine()
|
||||
int64_t videoTime = HasVideo() ? mVideoFrameEndTime : 0;
|
||||
int64_t clockTime = NS_MAX(mEndTime, NS_MAX(videoTime, GetAudioClock()));
|
||||
UpdatePlaybackPosition(clockTime);
|
||||
printf("nsBuiltinDecoderStateMachine::RunStateMachine queuing nsBuiltinDecoder::PlaybackEnded\n");
|
||||
nsCOMPtr<nsIRunnable> event =
|
||||
NS_NewRunnableMethod(mDecoder, &nsBuiltinDecoder::PlaybackEnded);
|
||||
NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
|
||||
|
8
content/media/test/crashtests/789075-1.html
Normal file
8
content/media/test/crashtests/789075-1.html
Normal file
@ -0,0 +1,8 @@
|
||||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<head>
|
||||
</head>
|
||||
<body>
|
||||
<video src="789075.webm" onloadedmetadata="document.documentElement.className=undefined"></video>
|
||||
</body>
|
||||
</html>
|
BIN
content/media/test/crashtests/789075.webm
Normal file
BIN
content/media/test/crashtests/789075.webm
Normal file
Binary file not shown.
@ -11,3 +11,4 @@ load 576612-1.html
|
||||
skip-if(Android) load 691096-1.html # Android sound API can't handle playing large number of sounds at once.
|
||||
load 752784-1.html
|
||||
HTTP load 795892-1.html
|
||||
load 789075-1.html
|
||||
|
@ -705,14 +705,14 @@ bool nsWebMReader::DecodeVideoFrame(bool &aKeyframeSkip,
|
||||
|
||||
b.mPlanes[1].mData = img->planes[1];
|
||||
b.mPlanes[1].mStride = img->stride[1];
|
||||
b.mPlanes[1].mHeight = img->d_h >> img->y_chroma_shift;
|
||||
b.mPlanes[1].mWidth = img->d_w >> img->x_chroma_shift;
|
||||
b.mPlanes[1].mHeight = (img->d_h + 1) >> img->y_chroma_shift;
|
||||
b.mPlanes[1].mWidth = (img->d_w + 1) >> img->x_chroma_shift;
|
||||
b.mPlanes[1].mOffset = b.mPlanes[1].mSkip = 0;
|
||||
|
||||
b.mPlanes[2].mData = img->planes[2];
|
||||
b.mPlanes[2].mStride = img->stride[2];
|
||||
b.mPlanes[2].mHeight = img->d_h >> img->y_chroma_shift;
|
||||
b.mPlanes[2].mWidth = img->d_w >> img->x_chroma_shift;
|
||||
b.mPlanes[2].mHeight = (img->d_h + 1) >> img->y_chroma_shift;
|
||||
b.mPlanes[2].mWidth = (img->d_w + 1) >> img->x_chroma_shift;
|
||||
b.mPlanes[2].mOffset = b.mPlanes[2].mSkip = 0;
|
||||
|
||||
nsIntRect picture = mPicture;
|
||||
|
@ -14,6 +14,13 @@
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
extern PRLogModuleInfo* gMediaManagerLog;
|
||||
#define LOG(msg) PR_LOG(gMediaManagerLog, PR_LOG_DEBUG, msg)
|
||||
#else
|
||||
#define LOG(msg)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Webrtc audio source.
|
||||
*/
|
||||
@ -207,9 +214,7 @@ MediaEngineWebRTCAudioSource::Process(const int channel,
|
||||
nsRefPtr<SharedBuffer> buffer = SharedBuffer::Create(length * sizeof(sample));
|
||||
|
||||
sample* dest = static_cast<sample*>(buffer->Data());
|
||||
for (int i = 0; i < length; i++) {
|
||||
dest[i] = audio10ms[i];
|
||||
}
|
||||
memcpy(dest, audio10ms, length * sizeof(sample));
|
||||
|
||||
AudioSegment segment;
|
||||
segment.Init(CHANNELS);
|
||||
|
@ -9,6 +9,13 @@
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
extern PRLogModuleInfo* gMediaManagerLog;
|
||||
#define LOG(msg) PR_LOG(gMediaManagerLog, PR_LOG_DEBUG, msg)
|
||||
#else
|
||||
#define LOG(msg)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Webrtc video source.
|
||||
*/
|
||||
@ -65,6 +72,7 @@ MediaEngineWebRTCVideoSource::DeliverFrame(
|
||||
|
||||
// Check for proper state.
|
||||
if (mState != kStarted) {
|
||||
LOG(("DeliverFrame: video not started"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1554,58 +1554,26 @@ nsXULElement::IsNodeOfType(uint32_t aFlags) const
|
||||
return !(aFlags & ~eCONTENT);
|
||||
}
|
||||
|
||||
static void
|
||||
PopupListenerPropertyDtor(void* aObject, nsIAtom* aPropertyName,
|
||||
void* aPropertyValue, void* aData)
|
||||
{
|
||||
nsIDOMEventListener* listener =
|
||||
static_cast<nsIDOMEventListener*>(aPropertyValue);
|
||||
if (!listener) {
|
||||
return;
|
||||
}
|
||||
nsEventListenerManager* manager = static_cast<nsINode*>(aObject)->
|
||||
GetListenerManager(false);
|
||||
if (manager) {
|
||||
manager->RemoveEventListenerByType(listener,
|
||||
NS_LITERAL_STRING("mousedown"),
|
||||
NS_EVENT_FLAG_BUBBLE |
|
||||
NS_EVENT_FLAG_SYSTEM_EVENT);
|
||||
manager->RemoveEventListenerByType(listener,
|
||||
NS_LITERAL_STRING("contextmenu"),
|
||||
NS_EVENT_FLAG_BUBBLE |
|
||||
NS_EVENT_FLAG_SYSTEM_EVENT);
|
||||
}
|
||||
NS_RELEASE(listener);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXULElement::AddPopupListener(nsIAtom* aName)
|
||||
{
|
||||
// Add a popup listener to the element
|
||||
bool isContext = (aName == nsGkAtoms::context ||
|
||||
aName == nsGkAtoms::contextmenu);
|
||||
nsIAtom* listenerAtom = isContext ?
|
||||
nsGkAtoms::contextmenulistener :
|
||||
nsGkAtoms::popuplistener;
|
||||
uint32_t listenerFlag = isContext ?
|
||||
XUL_ELEMENT_HAS_CONTENTMENU_LISTENER :
|
||||
XUL_ELEMENT_HAS_POPUP_LISTENER;
|
||||
|
||||
nsCOMPtr<nsIDOMEventListener> popupListener =
|
||||
static_cast<nsIDOMEventListener*>(GetProperty(listenerAtom));
|
||||
if (popupListener) {
|
||||
// Popup listener is already installed.
|
||||
if (HasFlag(listenerFlag)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
popupListener = new nsXULPopupListener(this, isContext);
|
||||
nsCOMPtr<nsIDOMEventListener> listener =
|
||||
new nsXULPopupListener(this, isContext);
|
||||
|
||||
// Add the popup as a listener on this element.
|
||||
nsEventListenerManager* manager = GetListenerManager(true);
|
||||
NS_ENSURE_TRUE(manager, NS_ERROR_FAILURE);
|
||||
nsresult rv = SetProperty(listenerAtom, popupListener,
|
||||
PopupListenerPropertyDtor, true);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
// Want the property to have a reference to the listener.
|
||||
nsIDOMEventListener* listener = nullptr;
|
||||
popupListener.swap(listener);
|
||||
SetFlags(listenerFlag);
|
||||
|
||||
if (isContext) {
|
||||
manager->AddEventListenerByType(listener,
|
||||
|
@ -321,11 +321,13 @@ public:
|
||||
|
||||
// XUL element specific bits
|
||||
enum {
|
||||
XUL_ELEMENT_TEMPLATE_GENERATED = XUL_ELEMENT_FLAG_BIT(0)
|
||||
XUL_ELEMENT_TEMPLATE_GENERATED = XUL_ELEMENT_FLAG_BIT(0),
|
||||
XUL_ELEMENT_HAS_CONTENTMENU_LISTENER = XUL_ELEMENT_FLAG_BIT(1),
|
||||
XUL_ELEMENT_HAS_POPUP_LISTENER = XUL_ELEMENT_FLAG_BIT(2)
|
||||
};
|
||||
|
||||
// Make sure we have space for our bit
|
||||
PR_STATIC_ASSERT(ELEMENT_TYPE_SPECIFIC_BITS_OFFSET < 32);
|
||||
// Make sure we have space for our bits
|
||||
PR_STATIC_ASSERT((ELEMENT_TYPE_SPECIFIC_BITS_OFFSET + 2) < 32);
|
||||
|
||||
#undef XUL_ELEMENT_FLAG_BIT
|
||||
|
||||
|
@ -33,7 +33,7 @@
|
||||
#include "nsHTMLReflowState.h"
|
||||
#include "nsIObjectLoadingContent.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/FragmentOrElement.h"
|
||||
|
||||
// for event firing in context menus
|
||||
#include "nsPresContext.h"
|
||||
@ -52,7 +52,8 @@ using namespace mozilla;
|
||||
#define NS_CONTEXT_MENU_IS_MOUSEUP 1
|
||||
#endif
|
||||
|
||||
nsXULPopupListener::nsXULPopupListener(nsIDOMElement *aElement, bool aIsContext)
|
||||
nsXULPopupListener::nsXULPopupListener(mozilla::dom::Element* aElement,
|
||||
bool aIsContext)
|
||||
: mElement(aElement), mPopupContent(nullptr), mIsContext(aIsContext)
|
||||
{
|
||||
}
|
||||
@ -66,6 +67,25 @@ NS_IMPL_CYCLE_COLLECTION_2(nsXULPopupListener, mElement, mPopupContent)
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsXULPopupListener)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsXULPopupListener)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(nsXULPopupListener)
|
||||
// If the owner, mElement, can be skipped, so can we.
|
||||
if (tmp->mElement) {
|
||||
return mozilla::dom::FragmentOrElement::CanSkip(tmp->mElement, true);
|
||||
}
|
||||
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_BEGIN(nsXULPopupListener)
|
||||
if (tmp->mElement) {
|
||||
return mozilla::dom::FragmentOrElement::CanSkipInCC(tmp->mElement);
|
||||
}
|
||||
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_BEGIN(nsXULPopupListener)
|
||||
if (tmp->mElement) {
|
||||
return mozilla::dom::FragmentOrElement::CanSkipThis(tmp->mElement);
|
||||
}
|
||||
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_END
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsXULPopupListener)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMEventListener)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
@ -307,44 +327,37 @@ nsXULPopupListener::LaunchPopup(nsIDOMEvent* aEvent, nsIContent* aTargetContent)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
nsAutoString type(NS_LITERAL_STRING("popup"));
|
||||
if (mIsContext)
|
||||
type.AssignLiteral("context");
|
||||
nsIAtom* type = mIsContext ? nsGkAtoms::context : nsGkAtoms::popup;
|
||||
|
||||
nsAutoString identifier;
|
||||
mElement->GetAttribute(type, identifier);
|
||||
mElement->GetAttr(kNameSpaceID_None, type, identifier);
|
||||
|
||||
if (identifier.IsEmpty()) {
|
||||
if (type.EqualsLiteral("popup"))
|
||||
mElement->GetAttribute(NS_LITERAL_STRING("menu"), identifier);
|
||||
else if (type.EqualsLiteral("context"))
|
||||
mElement->GetAttribute(NS_LITERAL_STRING("contextmenu"), identifier);
|
||||
if (type == nsGkAtoms::popup) {
|
||||
mElement->GetAttr(kNameSpaceID_None, nsGkAtoms::menu, identifier);
|
||||
} else {
|
||||
mElement->GetAttr(kNameSpaceID_None, nsGkAtoms::contextmenu, identifier);
|
||||
}
|
||||
if (identifier.IsEmpty())
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Try to find the popup content and the document.
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(mElement);
|
||||
nsCOMPtr<nsIDocument> document = content->GetDocument();
|
||||
|
||||
// Turn the document into a DOM document so we can use getElementById
|
||||
nsCOMPtr<nsIDOMDocument> domDocument = do_QueryInterface(document);
|
||||
if (!domDocument) {
|
||||
NS_ERROR("Popup attached to an element that isn't in XUL!");
|
||||
nsCOMPtr<nsIDocument> document = mElement->GetDocument();
|
||||
if (!document) {
|
||||
NS_WARNING("No document!");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// Handle the _child case for popups and context menus
|
||||
nsCOMPtr<nsIDOMElement> popupElement;
|
||||
|
||||
nsCOMPtr<nsIContent> popup;
|
||||
if (identifier.EqualsLiteral("_child")) {
|
||||
nsCOMPtr<nsIContent> popup = GetImmediateChild(content, nsGkAtoms::menupopup);
|
||||
if (popup)
|
||||
popupElement = do_QueryInterface(popup);
|
||||
else {
|
||||
nsCOMPtr<nsIDOMDocumentXBL> nsDoc(do_QueryInterface(domDocument));
|
||||
popup = GetImmediateChild(mElement, nsGkAtoms::menupopup);
|
||||
if (!popup) {
|
||||
nsCOMPtr<nsIDOMDocumentXBL> nsDoc(do_QueryInterface(document));
|
||||
nsCOMPtr<nsIDOMNodeList> list;
|
||||
nsDoc->GetAnonymousNodes(mElement, getter_AddRefs(list));
|
||||
nsCOMPtr<nsIDOMElement> el = do_QueryInterface(mElement);
|
||||
nsDoc->GetAnonymousNodes(el, getter_AddRefs(list));
|
||||
if (list) {
|
||||
uint32_t ctr,listLength;
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
@ -355,15 +368,13 @@ nsXULPopupListener::LaunchPopup(nsIDOMEvent* aEvent, nsIContent* aTargetContent)
|
||||
|
||||
if (childContent->NodeInfo()->Equals(nsGkAtoms::menupopup,
|
||||
kNameSpaceID_XUL)) {
|
||||
popupElement = do_QueryInterface(childContent);
|
||||
popup.swap(childContent);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (NS_FAILED(rv = domDocument->GetElementById(identifier,
|
||||
getter_AddRefs(popupElement)))) {
|
||||
} else if (!(popup = document->GetElementById(identifier))) {
|
||||
// Use getElementById to obtain the popup content and gracefully fail if
|
||||
// we didn't find any popup content in the document.
|
||||
NS_ERROR("GetElementById had some kind of spasm.");
|
||||
@ -371,12 +382,11 @@ nsXULPopupListener::LaunchPopup(nsIDOMEvent* aEvent, nsIContent* aTargetContent)
|
||||
}
|
||||
|
||||
// return if no popup was found or the popup is the element itself.
|
||||
if ( !popupElement || popupElement == mElement)
|
||||
if (!popup || popup == mElement)
|
||||
return NS_OK;
|
||||
|
||||
// Submenus can't be used as context menus or popups, bug 288763.
|
||||
// Similar code also in nsXULTooltipListener::GetTooltipFor.
|
||||
nsCOMPtr<nsIContent> popup = do_QueryInterface(popupElement);
|
||||
nsIContent* parent = popup->GetParent();
|
||||
if (parent) {
|
||||
nsMenuFrame* menu = do_QueryFrame(parent->GetPrimaryFrame());
|
||||
@ -397,7 +407,7 @@ nsXULPopupListener::LaunchPopup(nsIDOMEvent* aEvent, nsIContent* aTargetContent)
|
||||
(mPopupContent->HasAttr(kNameSpaceID_None, nsGkAtoms::position) ||
|
||||
(mPopupContent->HasAttr(kNameSpaceID_None, nsGkAtoms::popupanchor) &&
|
||||
mPopupContent->HasAttr(kNameSpaceID_None, nsGkAtoms::popupalign)))) {
|
||||
pm->ShowPopup(mPopupContent, content, EmptyString(), 0, 0,
|
||||
pm->ShowPopup(mPopupContent, mElement, EmptyString(), 0, 0,
|
||||
false, true, false, aEvent);
|
||||
}
|
||||
else {
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
#include "nsIContent.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMMouseEvent.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
@ -25,12 +25,12 @@ public:
|
||||
// false, the popup opens on left click on aElement or a descendant. If
|
||||
// aIsContext is true, the popup is a context menu which opens on a
|
||||
// context menu event.
|
||||
nsXULPopupListener(nsIDOMElement *aElement, bool aIsContext);
|
||||
nsXULPopupListener(mozilla::dom::Element* aElement, bool aIsContext);
|
||||
virtual ~nsXULPopupListener(void);
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS(nsXULPopupListener)
|
||||
NS_DECL_CYCLE_COLLECTION_SKIPPABLE_CLASS(nsXULPopupListener)
|
||||
NS_DECL_NSIDOMEVENTLISTENER
|
||||
|
||||
protected:
|
||||
@ -48,7 +48,7 @@ private:
|
||||
#endif
|
||||
|
||||
// |mElement| is the node to which this listener is attached.
|
||||
nsCOMPtr<nsIDOMElement> mElement;
|
||||
nsCOMPtr<mozilla::dom::Element> mElement;
|
||||
|
||||
// The popup that is getting shown on top of mElement.
|
||||
nsCOMPtr<nsIContent> mPopupContent;
|
||||
|
@ -11110,8 +11110,8 @@ nsDocShell::AddURIVisit(nsIURI* aURI,
|
||||
// 408 is special cased, since may actually indicate a temporary
|
||||
// connection problem.
|
||||
else if (aResponseStatus != 408 &&
|
||||
(aResponseStatus >= 400 && aResponseStatus <= 501 ||
|
||||
aResponseStatus == 505)) {
|
||||
((aResponseStatus >= 400 && aResponseStatus <= 501) ||
|
||||
aResponseStatus == 505)) {
|
||||
visitURIFlags |= IHistory::UNRECOVERABLE_ERROR;
|
||||
}
|
||||
|
||||
|
@ -167,7 +167,7 @@ let Activities = {
|
||||
|
||||
this.db = new ActivitiesDb();
|
||||
this.db.init();
|
||||
this.mm = {};
|
||||
this.callers = {};
|
||||
},
|
||||
|
||||
observe: function activities_observe(aSubject, aTopic, aData) {
|
||||
@ -194,11 +194,11 @@ let Activities = {
|
||||
|
||||
// We have no matching activity registered, let's fire an error.
|
||||
if (aResults.options.length === 0) {
|
||||
Activities.mm[aMsg.id].sendAsyncMessage("Activity:FireError", {
|
||||
Activities.callers[aMsg.id].mm.sendAsyncMessage("Activity:FireError", {
|
||||
"id": aMsg.id,
|
||||
"error": "NO_PROVIDER"
|
||||
});
|
||||
delete Activities.mm[aMsg.id];
|
||||
delete Activities.callers[aMsg.id];
|
||||
return;
|
||||
}
|
||||
|
||||
@ -207,11 +207,11 @@ let Activities = {
|
||||
|
||||
// The user has cancelled the choice, fire an error.
|
||||
if (aChoice === -1) {
|
||||
Activities.mm[aMsg.id].sendAsyncMessage("Activity:FireError", {
|
||||
Activities.callers[aMsg.id].mm.sendAsyncMessage("Activity:FireError", {
|
||||
"id": aMsg.id,
|
||||
"error": "USER_ABORT"
|
||||
});
|
||||
delete Activities.mm[aMsg.id];
|
||||
delete Activities.callers[aMsg.id];
|
||||
return;
|
||||
}
|
||||
|
||||
@ -233,11 +233,13 @@ let Activities = {
|
||||
Services.io.newURI(result.manifest, null, null));
|
||||
|
||||
if (!result.description.returnValue) {
|
||||
Activities.mm[aMsg.id].sendAsyncMessage("Activity:FireSuccess", {
|
||||
Activities.callers[aMsg.id].mm.sendAsyncMessage("Activity:FireSuccess", {
|
||||
"id": aMsg.id,
|
||||
"result": null
|
||||
});
|
||||
delete Activities.mm[aMsg.id];
|
||||
// No need to notify observers, since we don't want the caller
|
||||
// to be raised on the foreground that quick.
|
||||
delete Activities.callers[aMsg.id];
|
||||
}
|
||||
};
|
||||
|
||||
@ -271,19 +273,37 @@ let Activities = {
|
||||
receiveMessage: function activities_receiveMessage(aMessage) {
|
||||
let mm = aMessage.target;
|
||||
let msg = aMessage.json;
|
||||
|
||||
let caller;
|
||||
let obsData;
|
||||
|
||||
if (aMessage.name == "Activity:FireSuccess" ||
|
||||
aMessage.name == "Activity:FireError") {
|
||||
caller = this.callers[msg.id];
|
||||
if (caller) {
|
||||
obsData = JSON.stringify({ manifestURL: caller.manifestURL,
|
||||
pageURL: caller.pageURL,
|
||||
success: aMessage.name == "Activity:FireSuccess" });
|
||||
}
|
||||
}
|
||||
|
||||
switch(aMessage.name) {
|
||||
case "Activity:Start":
|
||||
this.mm[msg.id] = aMessage.target;
|
||||
this.callers[msg.id] = { mm: aMessage.target,
|
||||
manifestURL: msg.manifestURL,
|
||||
pageURL: msg.pageURL };
|
||||
this.startActivity(msg);
|
||||
break;
|
||||
|
||||
case "Activity:PostResult":
|
||||
this.mm[msg.id].sendAsyncMessage("Activity:FireSuccess", msg);
|
||||
delete this.mm[msg.id];
|
||||
caller.mm.sendAsyncMessage("Activity:FireSuccess", msg);
|
||||
Services.obs.notifyObservers(null, "activity-done", obsData);
|
||||
delete this.callers[msg.id];
|
||||
break;
|
||||
case "Activity:PostError":
|
||||
this.mm[msg.id].sendAsyncMessage("Activity:FireError", msg);
|
||||
delete this.mm[msg.id];
|
||||
caller.mm.sendAsyncMessage("Activity:FireError", msg);
|
||||
Services.obs.notifyObservers(null, "activity-done", obsData);
|
||||
delete this.callers[msg.id];
|
||||
break;
|
||||
|
||||
case "Activities:Register":
|
||||
|
@ -11,6 +11,7 @@ const Cu = Components.utils;
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/ObjectWrapper.jsm");
|
||||
Cu.import("resource://gre/modules/Webapps.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "cpmm",
|
||||
"@mozilla.org/childprocessmessagemanager;1",
|
||||
@ -40,7 +41,18 @@ ActivityProxy.prototype = {
|
||||
this.id = Cc["@mozilla.org/uuid-generator;1"]
|
||||
.getService(Ci.nsIUUIDGenerator)
|
||||
.generateUUID().toString();
|
||||
cpmm.sendAsyncMessage("Activity:Start", { id: this.id, options: aOptions });
|
||||
// Retrieve the app's manifest url from the principal, so that we can
|
||||
// later notify when the activity handler called postResult or postError
|
||||
let principal = aWindow.document.nodePrincipal;
|
||||
let appId = principal.appId;
|
||||
let manifestURL = (appId != Ci.nsIScriptSecurityManager.NO_APP_ID &&
|
||||
appId != Ci.nsIScriptSecurityManager.UNKNOWN_APP_ID)
|
||||
? DOMApplicationRegistry.getManifestURLByLocalId(appId)
|
||||
: null;
|
||||
cpmm.sendAsyncMessage("Activity:Start", { id: this.id,
|
||||
options: aOptions,
|
||||
manifestURL: manifestURL,
|
||||
pageURL: aWindow.document.location.href });
|
||||
|
||||
cpmm.addMessageListener("Activity:FireSuccess", this);
|
||||
cpmm.addMessageListener("Activity:FireError", this);
|
||||
|
@ -66,6 +66,7 @@ EXPORTS = \
|
||||
nsIScriptObjectPrincipal.h \
|
||||
nsIScriptRuntime.h \
|
||||
nsIScriptTimeoutHandler.h \
|
||||
nsJSEnvironment.h \
|
||||
nsJSUtils.h \
|
||||
nsPIDOMWindow.h \
|
||||
nsPIWindowRoot.h \
|
||||
|
@ -554,8 +554,6 @@ using mozilla::dom::indexedDB::IDBWrapperCache;
|
||||
#include "nsIDOMDataChannel.h"
|
||||
#endif
|
||||
|
||||
#undef None // something included above defines this preprocessor symbol, maybe Xlib headers
|
||||
#include "WebGLContext.h"
|
||||
#include "nsICanvasRenderingContextInternal.h"
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
#include "mozilla/dom/HTMLCollectionBinding.h"
|
||||
@ -5345,10 +5343,9 @@ nsWindowSH::GlobalScopePolluterNewResolve(JSContext *cx, JSHandleObject obj,
|
||||
JSHandleId id, unsigned flags,
|
||||
JSMutableHandleObject objp)
|
||||
{
|
||||
if (flags & (JSRESOLVE_ASSIGNING | JSRESOLVE_QUALIFIED) ||
|
||||
!JSID_IS_STRING(id)) {
|
||||
// Nothing to do here if we're assigning, doing a qualified resolve, or
|
||||
// resolving a non-string property.
|
||||
if ((flags & JSRESOLVE_ASSIGNING) || !JSID_IS_STRING(id)) {
|
||||
// Nothing to do here if we're assigning or resolving a non-string
|
||||
// property.
|
||||
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
@ -31,7 +31,7 @@
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIContentViewer.h"
|
||||
#include "nsFrameIterator.h"
|
||||
#include "nsFrameTraversal.h"
|
||||
#include "nsObjectFrame.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsEventStateManager.h"
|
||||
@ -2270,8 +2270,15 @@ nsFocusManager::GetSelectionLocation(nsIDocument* aDocument,
|
||||
if (nodeValue.Length() == (uint32_t)startOffset && !isFormControl &&
|
||||
startContent != aDocument->GetRootElement()) {
|
||||
// Yes, indeed we were at the end of the last node
|
||||
nsFrameIterator frameTraversal(presContext, startFrame,
|
||||
eLeaf, nsFrameIterator::FLAG_FOLLOW_OUT_OF_FLOW);
|
||||
nsCOMPtr<nsIFrameEnumerator> frameTraversal;
|
||||
nsresult rv = NS_NewFrameTraversal(getter_AddRefs(frameTraversal),
|
||||
presContext, startFrame,
|
||||
eLeaf,
|
||||
false, // aVisual
|
||||
false, // aLockInScrollView
|
||||
true // aFollowOOFs
|
||||
);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsIFrame *newCaretFrame = nullptr;
|
||||
nsCOMPtr<nsIContent> newCaretContent = startContent;
|
||||
@ -2279,8 +2286,8 @@ nsFocusManager::GetSelectionLocation(nsIDocument* aDocument,
|
||||
do {
|
||||
// Continue getting the next frame until the primary content for the frame
|
||||
// we are on changes - we don't want to be stuck in the same place
|
||||
frameTraversal.Next();
|
||||
newCaretFrame = static_cast<nsIFrame*>(frameTraversal.CurrentItem());
|
||||
frameTraversal->Next();
|
||||
newCaretFrame = static_cast<nsIFrame*>(frameTraversal->CurrentItem());
|
||||
if (nullptr == newCaretFrame)
|
||||
break;
|
||||
newCaretContent = newCaretFrame->GetContent();
|
||||
@ -2696,14 +2703,21 @@ nsFocusManager::GetNextTabbableContent(nsIPresShell* aPresShell,
|
||||
continue;
|
||||
}
|
||||
|
||||
nsFrameIterator frameTraversal(presContext, startFrame,
|
||||
ePreOrder, nsFrameIterator::FLAG_FOLLOW_OUT_OF_FLOW);
|
||||
nsCOMPtr<nsIFrameEnumerator> frameTraversal;
|
||||
nsresult rv = NS_NewFrameTraversal(getter_AddRefs(frameTraversal),
|
||||
presContext, startFrame,
|
||||
ePreOrder,
|
||||
false, // aVisual
|
||||
false, // aLockInScrollView
|
||||
true // aFollowOOFs
|
||||
);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (iterStartContent == aRootContent) {
|
||||
if (!aForward) {
|
||||
frameTraversal.Last();
|
||||
frameTraversal->Last();
|
||||
} else if (aRootContent->IsFocusable()) {
|
||||
frameTraversal.Next();
|
||||
frameTraversal->Next();
|
||||
}
|
||||
}
|
||||
else if (getNextFrame &&
|
||||
@ -2712,13 +2726,13 @@ nsFocusManager::GetNextTabbableContent(nsIPresShell* aPresShell,
|
||||
// Need to do special check in case we're in an imagemap which has multiple
|
||||
// content nodes per frame, so don't skip over the starting frame.
|
||||
if (aForward)
|
||||
frameTraversal.Next();
|
||||
frameTraversal->Next();
|
||||
else
|
||||
frameTraversal.Prev();
|
||||
frameTraversal->Prev();
|
||||
}
|
||||
|
||||
// Walk frames to find something tabbable matching mCurrentTabIndex
|
||||
nsIFrame* frame = static_cast<nsIFrame*>(frameTraversal.CurrentItem());
|
||||
nsIFrame* frame = static_cast<nsIFrame*>(frameTraversal->CurrentItem());
|
||||
while (frame) {
|
||||
// TabIndex not set defaults to 0 for form elements, anchors and other
|
||||
// elements that are normally focusable. Tabindex defaults to -1
|
||||
@ -2788,10 +2802,10 @@ nsFocusManager::GetNextTabbableContent(nsIPresShell* aPresShell,
|
||||
Element* rootElement = subdoc->GetRootElement();
|
||||
nsIPresShell* subShell = subdoc->GetShell();
|
||||
if (rootElement && subShell) {
|
||||
nsresult rv = GetNextTabbableContent(subShell, rootElement,
|
||||
aOriginalStartContent, rootElement,
|
||||
aForward, (aForward ? 1 : 0),
|
||||
false, aResultContent);
|
||||
rv = GetNextTabbableContent(subShell, rootElement,
|
||||
aOriginalStartContent, rootElement,
|
||||
aForward, (aForward ? 1 : 0),
|
||||
false, aResultContent);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (*aResultContent)
|
||||
return NS_OK;
|
||||
@ -2835,10 +2849,10 @@ nsFocusManager::GetNextTabbableContent(nsIPresShell* aPresShell,
|
||||
// again.
|
||||
do {
|
||||
if (aForward)
|
||||
frameTraversal.Next();
|
||||
frameTraversal->Next();
|
||||
else
|
||||
frameTraversal.Prev();
|
||||
frame = static_cast<nsIFrame*>(frameTraversal.CurrentItem());
|
||||
frameTraversal->Prev();
|
||||
frame = static_cast<nsIFrame*>(frameTraversal->CurrentItem());
|
||||
} while (frame && frame->GetPrevContinuation());
|
||||
}
|
||||
|
||||
|
@ -2719,24 +2719,24 @@ static JSFunctionSpec JProfFunctions[] = {
|
||||
|
||||
#endif /* defined(MOZ_JPROF) */
|
||||
|
||||
#ifdef MOZ_DMD
|
||||
#ifdef MOZ_DMDV
|
||||
|
||||
// See https://wiki.mozilla.org/Performance/MemShrink/DMD for instructions on
|
||||
// how to use DMD.
|
||||
// how to use DMDV.
|
||||
|
||||
static JSBool
|
||||
DMDCheckJS(JSContext *cx, unsigned argc, jsval *vp)
|
||||
DMDVCheckAndDumpJS(JSContext *cx, unsigned argc, jsval *vp)
|
||||
{
|
||||
mozilla::DMDCheckAndDump();
|
||||
mozilla::DMDVCheckAndDump();
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
static JSFunctionSpec DMDFunctions[] = {
|
||||
JS_FS("DMD", DMDCheckJS, 0, 0),
|
||||
static JSFunctionSpec DMDVFunctions[] = {
|
||||
JS_FS("DMDV", DMDVCheckAndDumpJS, 0, 0),
|
||||
JS_FS_END
|
||||
};
|
||||
|
||||
#endif /* defined(MOZ_DMD) */
|
||||
#endif /* defined(MOZ_DMDV) */
|
||||
|
||||
nsresult
|
||||
nsJSContext::InitClasses(JSObject* aGlobalObj)
|
||||
@ -2761,9 +2761,9 @@ nsJSContext::InitClasses(JSObject* aGlobalObj)
|
||||
::JS_DefineFunctions(mContext, aGlobalObj, JProfFunctions);
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_DMD
|
||||
// Attempt to initialize DMD functions
|
||||
::JS_DefineFunctions(mContext, aGlobalObj, DMDFunctions);
|
||||
#ifdef MOZ_DMDV
|
||||
// Attempt to initialize DMDV functions
|
||||
::JS_DefineFunctions(mContext, aGlobalObj, DMDVFunctions);
|
||||
#endif
|
||||
|
||||
return rv;
|
||||
|
@ -14,6 +14,7 @@ MOCHITEST_FILES = \
|
||||
test_domrequest.html \
|
||||
test_gsp-standards.html \
|
||||
test_gsp-quirks.html \
|
||||
test_gsp-qualified.html \
|
||||
test_nondomexception.html \
|
||||
test_screen_orientation.html \
|
||||
$(NULL)
|
||||
|
38
dom/base/test/test_gsp-qualified.html
Normal file
38
dom/base/test/test_gsp-qualified.html
Normal file
@ -0,0 +1,38 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=799875
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 799875</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=799875">Mozilla Bug 799875</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
<iframe src="data:text/html,<div id='test2'>"></iframe>
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 799875 **/
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
addLoadEvent(function() {
|
||||
is(window.test, document.getElementById("test"),
|
||||
"Global scope polluter should map ids even when qualified")
|
||||
isnot(document.getElementById("test"), null,
|
||||
"Should have element");
|
||||
is(window[0].test2, window[0].document.getElementById("test2"),
|
||||
"Global scope polluter should map ids across globals");
|
||||
isnot(window[0].document.getElementById("test2"), null,
|
||||
"Should have element in subframe");
|
||||
SimpleTest.finish();
|
||||
});
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -11,6 +11,7 @@
|
||||
#include "AccessCheck.h"
|
||||
#include "WrapperFactory.h"
|
||||
#include "xpcprivate.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "XPCQuickStubs.h"
|
||||
#include "nsIXPConnect.h"
|
||||
|
||||
@ -739,5 +740,27 @@ SetXrayExpandoChain(JSObject* obj, JSObject* chain)
|
||||
}
|
||||
}
|
||||
|
||||
JSContext*
|
||||
MainThreadDictionaryBase::ParseJSON(const nsAString& aJSON,
|
||||
mozilla::Maybe<JSAutoRequest>& aAr,
|
||||
mozilla::Maybe<JSAutoCompartment>& aAc,
|
||||
JS::Value& aVal)
|
||||
{
|
||||
JSContext* cx = nsContentUtils::ThreadJSContextStack()->GetSafeJSContext();
|
||||
NS_ENSURE_TRUE(cx, nullptr);
|
||||
JSObject* global = JS_GetGlobalObject(cx);
|
||||
aAr.construct(cx);
|
||||
aAc.construct(cx, global);
|
||||
if (aJSON.IsEmpty()) {
|
||||
return cx;
|
||||
}
|
||||
if (!JS_ParseJSON(cx,
|
||||
static_cast<const jschar*>(PromiseFlatString(aJSON).get()),
|
||||
aJSON.Length(), &aVal)) {
|
||||
return nullptr;
|
||||
}
|
||||
return cx;
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
@ -1227,6 +1227,15 @@ MustInheritFromNonRefcountedDOMObject(NonRefcountedDOMObject*)
|
||||
JSObject* GetXrayExpandoChain(JSObject *obj);
|
||||
void SetXrayExpandoChain(JSObject *obj, JSObject *chain);
|
||||
|
||||
struct MainThreadDictionaryBase
|
||||
{
|
||||
protected:
|
||||
JSContext* ParseJSON(const nsAString& aJSON,
|
||||
mozilla::Maybe<JSAutoRequest>& aAr,
|
||||
mozilla::Maybe<JSAutoCompartment>& aAc,
|
||||
JS::Value& aVal);
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
|
@ -231,7 +231,7 @@ DOMInterfaces = {
|
||||
|
||||
'IID': [
|
||||
{
|
||||
'nativeType': 'nsIJSIID',
|
||||
'nativeType': 'nsIJSID',
|
||||
'headerFile': 'xpcjsid.h',
|
||||
},
|
||||
{
|
||||
@ -247,6 +247,14 @@ DOMInterfaces = {
|
||||
'workers': True,
|
||||
}],
|
||||
|
||||
'MediaStreamList': {
|
||||
'headerFile': 'MediaStreamList.h',
|
||||
'wrapperCache': False,
|
||||
'nativeOwnership': 'owned',
|
||||
'resultNotAddRefed': [ '__indexedGetter' ],
|
||||
'binaryNames': { '__indexedGetter': 'IndexedGetter' }
|
||||
},
|
||||
|
||||
'MozChannel': [
|
||||
{
|
||||
'nativeType': 'nsIChannel',
|
||||
@ -613,6 +621,7 @@ addExternalIface('File')
|
||||
addExternalIface('HitRegionOptions', nativeType='nsISupports')
|
||||
addExternalIface('HTMLElement')
|
||||
addExternalIface('ImageData', nativeType='mozilla::dom::ImageData')
|
||||
addExternalIface('MediaStream')
|
||||
addExternalIface('Node', nativeType='nsINode')
|
||||
addExternalIface('PaintRequest')
|
||||
addExternalIface('SVGLength')
|
||||
|
@ -793,7 +793,7 @@ class CGClassConstructHook(CGAbstractStaticMethod):
|
||||
JS::Value val = OBJECT_TO_JSVAL(obj);
|
||||
rv = xpc_qsUnwrapArg<nsISupports>(cx, val, &global, &globalRef.ptr, &val);
|
||||
if (NS_FAILED(rv)) {
|
||||
return Throw<true>(cx, NS_ERROR_XPC_BAD_CONVERT_JS);
|
||||
return ThrowErrorMessage(cx, MSG_GLOBAL_NOT_NATIVE);
|
||||
}
|
||||
}
|
||||
"""
|
||||
@ -1639,8 +1639,8 @@ class FailureFatalCastableObjectUnwrapper(CastableObjectUnwrapper):
|
||||
"""
|
||||
def __init__(self, descriptor, source, target):
|
||||
CastableObjectUnwrapper.__init__(self, descriptor, source, target,
|
||||
"return Throw<%s>(cx, rv);" %
|
||||
toStringBool(not descriptor.workers))
|
||||
"return ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE," +
|
||||
'"%s");' % descriptor.name)
|
||||
|
||||
class CallbackObjectUnwrapper:
|
||||
"""
|
||||
@ -1651,8 +1651,9 @@ class CallbackObjectUnwrapper:
|
||||
"""
|
||||
def __init__(self, descriptor, source, target, codeOnFailure=None):
|
||||
if codeOnFailure is None:
|
||||
codeOnFailure = ("return Throw<%s>(cx, rv);" %
|
||||
toStringBool(not descriptor.workers))
|
||||
codeOnFailure = ("return ThrowErrorMessage(cx," +
|
||||
'MSG_DOES_NOT_IMPLEMENT_INTERFACE, "%s");' %
|
||||
descriptor.name)
|
||||
self.descriptor = descriptor
|
||||
self.substitution = { "nativeType" : descriptor.nativeType,
|
||||
"source" : source,
|
||||
@ -1908,7 +1909,7 @@ def getJSToNativeConversionTemplate(type, descriptorProvider, failureCode=None,
|
||||
|
||||
templateBody = ("""JSObject* seq = &${val}.toObject();\n
|
||||
if (!IsArrayLike(cx, seq)) {
|
||||
return Throw<%s>(cx, NS_ERROR_XPC_BAD_CONVERT_JS);
|
||||
return ThrowErrorMessage(cx, MSG_NOT_SEQUENCE);
|
||||
}
|
||||
uint32_t length;
|
||||
// JS_GetArrayLength actually works on all objects
|
||||
@ -1917,18 +1918,17 @@ if (!JS_GetArrayLength(cx, seq, &length)) {
|
||||
}
|
||||
Sequence< %s > &arr = const_cast< Sequence< %s >& >(%s);
|
||||
if (!arr.SetCapacity(length)) {
|
||||
return Throw<%s>(cx, NS_ERROR_OUT_OF_MEMORY);
|
||||
JS_ReportOutOfMemory(cx);
|
||||
return false;
|
||||
}
|
||||
for (uint32_t i = 0; i < length; ++i) {
|
||||
jsval temp;
|
||||
if (!JS_GetElement(cx, seq, i, &temp)) {
|
||||
return false;
|
||||
}
|
||||
""" % (toStringBool(descriptorProvider.workers),
|
||||
""" % (elementDeclType.define(),
|
||||
elementDeclType.define(),
|
||||
elementDeclType.define(),
|
||||
arrayRef,
|
||||
toStringBool(descriptorProvider.workers)))
|
||||
arrayRef))
|
||||
|
||||
templateBody += CGIndenter(CGGeneric(
|
||||
string.Template(elementTemplate).substitute(
|
||||
@ -3489,8 +3489,9 @@ class CGMethodCall(CGThing):
|
||||
else:
|
||||
# Just throw; we have no idea what we're supposed to
|
||||
# do with this.
|
||||
caseBody.append(CGGeneric("return Throw<%s>(cx, NS_ERROR_XPC_BAD_CONVERT_JS);" %
|
||||
toStringBool(not descriptor.workers)))
|
||||
caseBody.append(CGGeneric(
|
||||
'return ThrowErrorMessage(cx, MSG_INVALID_ARG, "%s", "%s");'
|
||||
% (str(distinguishingIndex), str(argCount))))
|
||||
|
||||
argCountCases.append(CGCase(str(argCount),
|
||||
CGList(caseBody, "\n")))
|
||||
@ -3576,8 +3577,7 @@ class CGAbstractBindingMethod(CGAbstractStaticMethod):
|
||||
CGAbstractStaticMethod.__init__(self, descriptor, name, "JSBool", args)
|
||||
|
||||
if unwrapFailureCode is None:
|
||||
self.unwrapFailureCode = ("return Throw<%s>(cx, rv);" %
|
||||
toStringBool(not descriptor.workers))
|
||||
self.unwrapFailureCode = 'return ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "%s");' % self.descriptor.name
|
||||
else:
|
||||
self.unwrapFailureCode = unwrapFailureCode
|
||||
|
||||
@ -5390,6 +5390,8 @@ class CGDictionary(CGThing):
|
||||
d = self.dictionary
|
||||
if d.parent:
|
||||
inheritance = ": public %s " % self.makeClassName(d.parent)
|
||||
elif not self.workers:
|
||||
inheritance = ": public MainThreadDictionaryBase "
|
||||
else:
|
||||
inheritance = ""
|
||||
memberDecls = [" %s %s;" %
|
||||
@ -5400,6 +5402,16 @@ class CGDictionary(CGThing):
|
||||
"struct ${selfName} ${inheritance}{\n"
|
||||
" ${selfName}() {}\n"
|
||||
" bool Init(JSContext* cx, const JS::Value& val);\n"
|
||||
" \n" +
|
||||
(" bool Init(const nsAString& aJSON)\n"
|
||||
" {\n"
|
||||
" mozilla::Maybe<JSAutoRequest> ar;\n"
|
||||
" mozilla::Maybe<JSAutoCompartment> ac;\n"
|
||||
" jsval json = JSVAL_VOID;\n"
|
||||
" JSContext* cx = ParseJSON(aJSON, ar, ac, json);\n"
|
||||
" NS_ENSURE_TRUE(cx, false);\n"
|
||||
" return Init(cx, json);\n"
|
||||
" }\n" if not self.workers else "") +
|
||||
"\n" +
|
||||
"\n".join(memberDecls) + "\n"
|
||||
"private:\n"
|
||||
@ -5466,7 +5478,7 @@ class CGDictionary(CGThing):
|
||||
" JS::Value temp;\n"
|
||||
" bool isNull = val.isNullOrUndefined();\n"
|
||||
" if (!isNull && !val.isObject()) {\n"
|
||||
" return Throw<${isMainThread}>(cx, NS_ERROR_XPC_BAD_CONVERT_JS);\n"
|
||||
" return ThrowErrorMessage(cx, MSG_NOT_OBJECT);\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
"${initMembers}\n"
|
||||
|
@ -29,3 +29,6 @@ MSG_DEF(MSG_ILLEGAL_CONSTRUCTOR, 0, "Illegal constructor.")
|
||||
MSG_DEF(MSG_NO_PROPERTY_SETTER, 1, "{0} doesn't have an indexed property setter.")
|
||||
MSG_DEF(MSG_ENFORCE_RANGE_NON_FINITE, 1, "Non-finite value is out of range for {0}.")
|
||||
MSG_DEF(MSG_ENFORCE_RANGE_OUT_OF_RANGE, 1, "Value is out of range for {0}.")
|
||||
MSG_DEF(MSG_NOT_SEQUENCE, 0, "object can not be converted to a sequence")
|
||||
MSG_DEF(MSG_INVALID_ARG, 2, "argument {0} is not valid for any of the {1}-argument overloads")
|
||||
MSG_DEF(MSG_GLOBAL_NOT_NATIVE, 0, "global is not a native object")
|
||||
|
@ -74,6 +74,7 @@ LOCAL_INCLUDES += -I$(topsrcdir)/js/xpconnect/src \
|
||||
-I$(topsrcdir)/js/xpconnect/wrappers \
|
||||
-I$(topsrcdir)/content/canvas/src \
|
||||
-I$(topsrcdir)/content/html/content/src \
|
||||
-I$(topsrcdir)/media/webrtc/signaling/src/peerconnection \
|
||||
-I$(topsrcdir)/dom/base \
|
||||
$(NULL)
|
||||
|
||||
|
@ -62,6 +62,7 @@ MOCHITEST_FILES := \
|
||||
test_sequence_wrapping.html \
|
||||
file_bug775543.html \
|
||||
test_bug788369.html \
|
||||
test_bug742191.html \
|
||||
$(NULL)
|
||||
|
||||
MOCHITEST_CHROME_FILES = \
|
||||
|
36
dom/bindings/test/test_bug742191.html
Normal file
36
dom/bindings/test/test_bug742191.html
Normal file
@ -0,0 +1,36 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=742191
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for invalid argument object</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=742191">Mozilla Bug 742191</a>
|
||||
<p id="display"></p>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 742191 **/
|
||||
function doTest() {
|
||||
var gotTypeError = false;
|
||||
var ctx = document.createElement("canvas").getContext("2d");
|
||||
try {
|
||||
ctx.drawImage({}, 0, 0);
|
||||
} catch(e) {
|
||||
if (e instanceof TypeError) {
|
||||
gotTypeError = true;
|
||||
}
|
||||
}
|
||||
|
||||
ok(gotTypeError, "passing an invalid argument should cause a type error!");
|
||||
}
|
||||
doTest();
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -158,6 +158,27 @@ BluetoothOppManager::Disconnect()
|
||||
CloseSocket();
|
||||
}
|
||||
|
||||
bool
|
||||
BluetoothOppManager::Listen()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
CloseSocket();
|
||||
|
||||
BluetoothService* bs = BluetoothService::Get();
|
||||
if (!bs) {
|
||||
NS_WARNING("BluetoothService not available!");
|
||||
return false;
|
||||
}
|
||||
|
||||
nsresult rv = bs->ListenSocketViaService(BluetoothReservedChannels::OPUSH,
|
||||
BluetoothSocketType::RFCOMM,
|
||||
true,
|
||||
false,
|
||||
this);
|
||||
return NS_FAILED(rv) ? false : true;
|
||||
}
|
||||
|
||||
bool
|
||||
BluetoothOppManager::SendFile(BlobParent* aActor,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
|
@ -46,6 +46,7 @@ public:
|
||||
bool Connect(const nsAString& aDeviceObjectPath,
|
||||
BluetoothReplyRunnable* aRunnable);
|
||||
void Disconnect();
|
||||
bool Listen();
|
||||
|
||||
bool SendFile(BlobParent* aBlob,
|
||||
BluetoothReplyRunnable* aRunnable);
|
||||
|
@ -757,6 +757,12 @@ public:
|
||||
if (h) {
|
||||
h->Listen();
|
||||
}
|
||||
|
||||
BluetoothOppManager* opp = BluetoothOppManager::Get();
|
||||
if (opp) {
|
||||
opp->Listen();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
};
|
||||
@ -771,6 +777,12 @@ public:
|
||||
if (h) {
|
||||
h->CloseSocket();
|
||||
}
|
||||
|
||||
BluetoothOppManager* opp = BluetoothOppManager::Get();
|
||||
if (opp) {
|
||||
opp->CloseSocket();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
};
|
||||
@ -793,6 +805,7 @@ public:
|
||||
|
||||
uuids.AppendElement((uint32_t)(BluetoothServiceUuid::HandsfreeAG >> 32));
|
||||
uuids.AppendElement((uint32_t)(BluetoothServiceUuid::HeadsetAG >> 32));
|
||||
uuids.AppendElement((uint32_t)(BluetoothServiceUuid::ObjectPush >> 32));
|
||||
|
||||
// TODO/qdot: This needs to be held for the life of the bluetooth connection
|
||||
// so we could clean it up. For right now though, we can throw it away.
|
||||
|
@ -401,7 +401,7 @@ BrowserElementChild.prototype = {
|
||||
var menuData = {systemTargets: [], contextmenu: null};
|
||||
var ctxMenuId = null;
|
||||
|
||||
while (elem && elem.hasAttribute) {
|
||||
while (elem && elem.parentNode) {
|
||||
var ctxData = this._getSystemCtxMenuData(elem);
|
||||
if (ctxData) {
|
||||
menuData.systemTargets.push({
|
||||
@ -410,7 +410,7 @@ BrowserElementChild.prototype = {
|
||||
});
|
||||
}
|
||||
|
||||
if (!ctxMenuId && elem.hasAttribute('contextmenu')) {
|
||||
if (!ctxMenuId && 'hasAttribute' in elem && elem.hasAttribute('contextmenu')) {
|
||||
ctxMenuId = elem.getAttribute('contextmenu');
|
||||
}
|
||||
elem = elem.parentNode;
|
||||
@ -462,7 +462,10 @@ BrowserElementChild.prototype = {
|
||||
content.innerHeight, "rgb(255,255,255)");
|
||||
sendAsyncMsg('got-screenshot', {
|
||||
id: data.json.id,
|
||||
rv: canvas.toDataURL("image/png")
|
||||
// Hack around the fact that we can't specify opaque PNG, this requires
|
||||
// us to unpremultiply the alpha channel which is expensive on ARM
|
||||
// processors because they lack a hardware integer division instruction.
|
||||
rv: canvas.toDataURL("image/jpeg")
|
||||
});
|
||||
},
|
||||
|
||||
@ -621,6 +624,10 @@ BrowserElementChild.prototype = {
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove password and wyciwyg from uri.
|
||||
location = Cc["@mozilla.org/docshell/urifixup;1"]
|
||||
.getService(Ci.nsIURIFixup).createExposableURI(location);
|
||||
|
||||
sendAsyncMsg('locationchange', location.spec);
|
||||
},
|
||||
|
||||
|
@ -139,6 +139,9 @@ MOCHITEST_FILES = \
|
||||
file_browserElement_AppFramePermission.html \
|
||||
browserElement_AppFramePermission.js \
|
||||
test_browserElement_inproc_AppFramePermission.html \
|
||||
file_wyciwyg.html \
|
||||
browserElement_ExposableURI.js \
|
||||
test_browserElement_inproc_ExposableURI.html \
|
||||
$(NULL)
|
||||
|
||||
# Disabled due to https://bugzilla.mozilla.org/show_bug.cgi?id=774100
|
||||
@ -201,6 +204,7 @@ MOCHITEST_FILES += \
|
||||
test_browserElement_oop_RemoveBrowserElement.html \
|
||||
test_browserElement_oop_DOMRequestError.html \
|
||||
test_browserElement_oop_AppFramePermission.html \
|
||||
test_browserElement_oop_ExposableURI.html \
|
||||
$(NULL)
|
||||
endif #}
|
||||
endif #}
|
||||
|
@ -20,7 +20,7 @@ var iframeScript = function() {
|
||||
|
||||
content.fireContextMenu(content.document.body);
|
||||
content.fireContextMenu(content.document.getElementById('menu1-trigger'));
|
||||
content.fireContextMenu(content.document.getElementById('inner-link'));
|
||||
content.fireContextMenu(content.document.getElementById('inner-link').childNodes[0]);
|
||||
content.fireContextMenu(content.document.getElementById('menu2-trigger'));
|
||||
}
|
||||
|
||||
|
57
dom/browser-element/mochitest/browserElement_ExposableURI.js
Normal file
57
dom/browser-element/mochitest/browserElement_ExposableURI.js
Normal file
@ -0,0 +1,57 @@
|
||||
/* Any copyright is dedicated to the public domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
// Bug 795317: Test that the browser element sanitizes its URIs by removing the
|
||||
// "unexposable" parts before sending them in the locationchange event.
|
||||
|
||||
"use strict";
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var iframe;
|
||||
|
||||
|
||||
function testPassword() {
|
||||
function locationchange(e) {
|
||||
var uri = e.detail;
|
||||
is(uri, 'http://mochi.test:8888/tests/dom/browser-element/mochitest/file_empty.html',
|
||||
"Username and password shouldn't be exposed in uri.");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
iframe.addEventListener('mozbrowserlocationchange', locationchange);
|
||||
iframe.src = "http://iamuser:iampassword@mochi.test:8888/tests/dom/browser-element/mochitest/file_empty.html";
|
||||
}
|
||||
|
||||
function testWyciwyg() {
|
||||
var locationChangeCount = 0;
|
||||
|
||||
function locationchange(e) {
|
||||
// locationChangeCount:
|
||||
// 0 - the first load.
|
||||
// 1 - after document.write().
|
||||
if (locationChangeCount == 0) {
|
||||
locationChangeCount ++;
|
||||
} else if (locationChangeCount == 1) {
|
||||
var uri = e.detail;
|
||||
is(uri, 'http://mochi.test:8888/tests/dom/browser-element/mochitest/file_wyciwyg.html', "Scheme in string shouldn't be wyciwyg");
|
||||
iframe.removeEventListener('mozbrowserlocationchange', locationchange);
|
||||
SimpleTest.executeSoon(testPassword);
|
||||
}
|
||||
}
|
||||
|
||||
// file_wyciwyg.html calls document.write() to create a wyciwyg channel.
|
||||
iframe.src = 'file_wyciwyg.html';
|
||||
iframe.addEventListener('mozbrowserlocationchange', locationchange);
|
||||
}
|
||||
|
||||
function runTest() {
|
||||
browserElementTestHelpers.setEnabledPref(true);
|
||||
browserElementTestHelpers.addPermission();
|
||||
|
||||
iframe = document.createElement('iframe');
|
||||
iframe.mozbrowser = true;
|
||||
document.body.appendChild(iframe);
|
||||
testWyciwyg();
|
||||
}
|
||||
|
||||
addEventListener('load', function() { SimpleTest.executeSoon(runTest); });
|
14
dom/browser-element/mochitest/file_wyciwyg.html
Normal file
14
dom/browser-element/mochitest/file_wyciwyg.html
Normal file
@ -0,0 +1,14 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>test</title>
|
||||
<script type="text/javascript">
|
||||
addEventListener('load', function() {
|
||||
window.setTimeout(function() {
|
||||
document.write("test");
|
||||
}, 0);
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user