Merge last PGO-green changeset of mozilla-inbound to mozilla-central

This commit is contained in:
Ed Morley 2012-10-16 09:08:39 +01:00
commit 3cee04e4db
515 changed files with 8738 additions and 5396 deletions

View File

@ -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

View File

@ -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);

View 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
};
}
}

View File

@ -58,6 +58,7 @@ EXPORTS_NAMESPACES = mozilla/a11y
EXPORTS_mozilla/a11y = \
FocusManager.h \
AccTypes.h \
States.h \
Role.h \
$(NULL)

View File

@ -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());
}
/**

View File

@ -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"

View File

@ -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)

View File

@ -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.
*/

View File

@ -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)
{

View File

@ -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

View File

@ -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
};
//////////////////////////////////////////////////////////////////////////////

View File

@ -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->IsProgress()) {
FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_VALUE_CHANGE,
aContent);
}
}
}
// DocAccessible protected member

View File

@ -21,7 +21,7 @@ public:
ProgressMeterAccessible(nsIContent* aContent, DocAccessible* aDoc) :
LeafAccessible(aContent, aDoc)
{
mFlags = mFlags | eHasNumericValue;
mFlags |= eHasNumericValue | eProgressAccessible;
}
NS_DECL_ISUPPORTS_INHERITED

View File

@ -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")) {

View File

@ -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

View File

@ -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>

View File

@ -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);

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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");

View File

@ -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);

View File

@ -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();
}

View File

@ -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");

View File

@ -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;

View File

@ -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

View File

@ -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();

View File

@ -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));
}
}
},

View File

@ -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);

View File

@ -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

View File

@ -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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -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 ***/

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -1822,12 +1822,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

View File

@ -6525,8 +6525,8 @@ nsContentUtils::PlatformToDOMLineBreaks(nsString &aString)
}
}
nsIWidget *
nsContentUtils::WidgetForDocument(nsIDocument *aDoc)
nsIPresShell*
nsContentUtils::FindPresShellForDocument(nsIDocument* aDoc)
{
nsIDocument* doc = aDoc;
nsIDocument* displayDoc = doc->GetDisplayDocument();
@ -6535,25 +6535,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) {

View File

@ -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;

View File

@ -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;

View File

@ -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.

View File

@ -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

View 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>

View File

@ -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;

View File

@ -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 \

View 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">

View File

@ -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;

View File

@ -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,

View File

@ -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

View File

@ -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();
}

View File

@ -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);

View 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>

Binary file not shown.

View File

@ -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

View File

@ -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;

View File

@ -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);

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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":

View File

@ -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);

View File

@ -66,6 +66,7 @@ EXPORTS = \
nsIScriptObjectPrincipal.h \
nsIScriptRuntime.h \
nsIScriptTimeoutHandler.h \
nsJSEnvironment.h \
nsJSUtils.h \
nsPIDOMWindow.h \
nsPIWindowRoot.h \

View File

@ -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;
}

View File

@ -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());
}

View File

@ -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;

View File

@ -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)

View 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>

View File

@ -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')

View File

@ -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)

View File

@ -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)

View File

@ -46,6 +46,7 @@ public:
bool Connect(const nsAString& aDeviceObjectPath,
BluetoothReplyRunnable* aRunnable);
void Disconnect();
bool Listen();
bool SendFile(BlobParent* aBlob,
BluetoothReplyRunnable* aRunnable);

View File

@ -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.

View File

@ -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;

View File

@ -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'));
}

View File

@ -14,7 +14,7 @@
* http://www.w3.org/TR/DOM-Level-2-Style
*/
[builtinclass, scriptable, uuid(2ae61565-1a66-4e6e-960d-b999c631e5c6)]
[builtinclass, scriptable, uuid(df3491fd-2243-427f-bd93-b0dd3c3e7834)]
interface nsIDOMCSS2Properties : nsISupports
{
attribute DOMString background;
@ -803,30 +803,30 @@ interface nsIDOMCSS2Properties : nsISupports
attribute DOMString MozBorderImage;
// raises(DOMException) on setting
attribute DOMString MozAlignItems;
attribute DOMString alignItems;
// raises(DOMException) on setting
attribute DOMString MozAlignSelf;
attribute DOMString alignSelf;
// raises(DOMException) on setting
attribute DOMString MozFlex;
attribute DOMString flex;
// raises(DOMException) on setting
attribute DOMString MozFlexBasis;
attribute DOMString flexBasis;
// raises(DOMException) on setting
attribute DOMString MozFlexDirection;
attribute DOMString flexDirection;
// raises(DOMException) on setting
attribute DOMString MozFlexGrow;
attribute DOMString flexGrow;
// raises(DOMException) on setting
attribute DOMString MozFlexShrink;
attribute DOMString flexShrink;
// raises(DOMException) on setting
attribute DOMString MozOrder;
attribute DOMString order;
// raises(DOMException) on setting
attribute DOMString MozJustifyContent;
attribute DOMString justifyContent;
// raises(DOMException) on setting
};

View File

@ -20,6 +20,7 @@
* @status UNDER_DEVELOPMENT
*/
interface nsIDOMBlob;
interface nsIDOMFile;
interface nsIVariant;
interface nsIInputStreamCallback;
@ -40,6 +41,11 @@ interface nsIPrintCallback : nsISupports
void render(in nsIDOMMozCanvasPrintState ctx);
};
[scriptable, function, uuid(6e9ffb59-2067-4aef-a51c-65e65a3e0d81)]
interface nsIFileCallback : nsISupports {
void receive(in nsIDOMBlob file);
};
[scriptable, uuid(a7062fca-41c6-4520-b777-3bb30fd77273)]
interface nsIDOMHTMLCanvasElement : nsIDOMHTMLElement
{
@ -64,6 +70,10 @@ interface nsIDOMHTMLCanvasElement : nsIDOMHTMLElement
[optional_argc] nsIDOMFile mozGetAsFile(in DOMString name,
[optional] in DOMString type);
[optional_argc] void toBlob(in nsIFileCallback callback,
[optional] in DOMString type,
[optional] in nsIVariant params);
// A Mozilla-only extension to get a canvas context backed by double-buffered
// shared memory. Only privileged callers can call this.
nsISupports MozGetIPCContext(in DOMString contextId);

View File

@ -20,6 +20,7 @@
#endif
#include "mozilla/Attributes.h"
#include "mozilla/MemoryInfoDumper.h"
#include "mozilla/dom/ExternalHelperAppChild.h"
#include "mozilla/dom/PCrashReporterChild.h"
#include "mozilla/dom/StorageChild.h"
@ -447,12 +448,17 @@ ContentChild::RecvDumpMemoryReportsToFile(const nsString& aIdentifier,
const bool& aMinimizeMemoryUsage,
const bool& aDumpChildProcesses)
{
nsCOMPtr<nsIMemoryReporterManager> mgr =
do_GetService("@mozilla.org/memory-reporter-manager;1");
NS_ENSURE_TRUE(mgr, true);
mgr->DumpMemoryReportsToFile(aIdentifier,
aMinimizeMemoryUsage,
aDumpChildProcesses);
MemoryInfoDumper::DumpMemoryReportsToFile(
aIdentifier, aMinimizeMemoryUsage, aDumpChildProcesses);
return true;
}
bool
ContentChild::RecvDumpGCAndCCLogsToFile(const nsString& aIdentifier,
const bool& aDumpChildProcesses)
{
MemoryInfoDumper::DumpGCAndCCLogsToFile(
aIdentifier, aDumpChildProcesses);
return true;
}

View File

@ -111,9 +111,12 @@ public:
RecvPMemoryReportRequestConstructor(PMemoryReportRequestChild* child);
virtual bool
RecvDumpMemoryReportsToFile(const nsString& identifier,
RecvDumpMemoryReportsToFile(const nsString& aIdentifier,
const bool& aMinimizeMemoryUsage,
const bool& aDumpChildProcesses);
virtual bool
RecvDumpGCAndCCLogsToFile(const nsString& aIdentifier,
const bool& aDumpChildProcesses);
virtual PTestShellChild* AllocPTestShell();
virtual bool DeallocPTestShell(PTestShellChild*);

View File

@ -202,12 +202,21 @@ child:
* Dump the contents of about:memory to a file in our temp directory.
*
* For documentation on the args, see
* nsIMemoryReporterManager::dumpMemoryReportsToFile.
* MemoryInfoDumper::dumpMemoryReportsToFile.
*/
async DumpMemoryReportsToFile(nsString identifier,
bool minimizeMemoryUsage,
bool dumpChildProcesses);
/**
* Dump this process's GC and CC logs.
*
* For documentation on the args, see
* MemoryInfoDumper::dumpGCAndCCLogsToFile.
*/
async DumpGCAndCCLogsToFile(nsString identifier,
bool dumpChildProcesses);
PTestShell();
RegisterChrome(ChromePackage[] packages, ResourceMapping[] resources,

View File

@ -28,11 +28,12 @@
namespace mozilla {
// We only support 1 audio and 1 video track for now.
enum {
kVideoTrack = 1,
kAudioTrack = 2
};
#ifdef PR_LOGGING
PRLogModuleInfo* gMediaManagerLog = PR_NewLogModule("MediaManager");
#define LOG(msg) PR_LOG(gMediaManagerLog, PR_LOG_DEBUG, msg)
#else
#define LOG(msg)
#endif
/**
@ -204,6 +205,13 @@ MediaDevice::GetSource()
* be released correctly.
*
* All of this must be done on the main thread!
*
* Note that the various GetUserMedia Runnable classes currently allow for
* two streams. If we ever need to support getting more than two streams
* at once, we could convert everything to nsTArray<nsRefPtr<blah> >'s,
* though that would complicate the constructors some. Currently the
* GetUserMedia spec does not allow for more than 2 streams to be obtained in
* one call, to simplify handling of constraints.
*/
class GetUserMediaStreamRunnable : public nsRunnable
{
@ -211,14 +219,16 @@ public:
GetUserMediaStreamRunnable(
already_AddRefed<nsIDOMGetUserMediaSuccessCallback> aSuccess,
already_AddRefed<nsIDOMGetUserMediaErrorCallback> aError,
MediaEngineSource* aSource, StreamListeners* aListeners,
uint64_t aWindowID, TrackID aTrackID)
StreamListeners* aListeners,
uint64_t aWindowID,
MediaEngineSource* aAudioSource,
MediaEngineSource* aVideoSource)
: mSuccess(aSuccess)
, mError(aError)
, mSource(aSource)
, mAudioSource(aAudioSource)
, mVideoSource(aVideoSource)
, mListeners(aListeners)
, mWindowID(aWindowID)
, mTrackID(aTrackID) {}
, mWindowID(aWindowID) {}
~GetUserMediaStreamRunnable() {}
@ -229,18 +239,23 @@ public:
// Create a media stream.
nsCOMPtr<nsDOMMediaStream> stream;
if (mTrackID == kVideoTrack) {
stream = nsDOMMediaStream::CreateInputStream(
nsDOMMediaStream::HINT_CONTENTS_VIDEO
);
} else {
stream = nsDOMMediaStream::CreateInputStream(
nsDOMMediaStream::HINT_CONTENTS_AUDIO
);
}
uint32_t hints = (mAudioSource ? nsDOMMediaStream::HINT_CONTENTS_AUDIO : 0);
hints |= (mVideoSource ? nsDOMMediaStream::HINT_CONTENTS_VIDEO : 0);
stream = nsDOMMediaStream::CreateInputStream(hints);
nsPIDOMWindow *window = static_cast<nsPIDOMWindow*>
(nsGlobalWindow::GetInnerWindowWithId(mWindowID));
WindowTable* activeWindows = MediaManager::Get()->GetActiveWindows();
if (!stream) {
if (activeWindows->Get(mWindowID)) {
nsCOMPtr<nsIDOMGetUserMediaErrorCallback> error(mError);
LOG(("Returning error for getUserMedia() - no stream"));
error->OnError(NS_LITERAL_STRING("NO_STREAM"));
}
return NS_OK;
}
if (window && window->GetExtantDoc()) {
stream->CombineWithPrincipal(window->GetExtantDoc()->NodePrincipal());
@ -250,7 +265,8 @@ public:
// that the MediaStream has started consuming. The listener is freed
// when the page is invalidated (on navigation or close).
GetUserMediaCallbackMediaStreamListener* listener =
new GetUserMediaCallbackMediaStreamListener(mSource, stream, mTrackID);
new GetUserMediaCallbackMediaStreamListener(stream, mAudioSource,
mVideoSource);
stream->GetStream()->AddListener(listener);
// No need for locking because we always do this in the main thread.
@ -260,8 +276,8 @@ public:
nsCOMPtr<nsIDOMGetUserMediaSuccessCallback> success(mSuccess);
nsCOMPtr<nsIDOMGetUserMediaErrorCallback> error(mError);
WindowTable* activeWindows = MediaManager::Get()->GetActiveWindows();
if (activeWindows->Get(mWindowID)) {
LOG(("Returning success for getUserMedia()"));
success->OnSuccess(stream);
}
@ -271,10 +287,10 @@ public:
private:
already_AddRefed<nsIDOMGetUserMediaSuccessCallback> mSuccess;
already_AddRefed<nsIDOMGetUserMediaErrorCallback> mError;
nsRefPtr<MediaEngineSource> mSource;
nsRefPtr<MediaEngineSource> mAudioSource;
nsRefPtr<MediaEngineSource> mVideoSource;
StreamListeners* mListeners;
uint64_t mWindowID;
TrackID mTrackID;
};
/**
@ -296,7 +312,8 @@ public:
GetUserMediaRunnable(bool aAudio, bool aVideo, bool aPicture,
already_AddRefed<nsIDOMGetUserMediaSuccessCallback> aSuccess,
already_AddRefed<nsIDOMGetUserMediaErrorCallback> aError,
StreamListeners* aListeners, uint64_t aWindowID, MediaDevice* aDevice)
StreamListeners* aListeners, uint64_t aWindowID,
MediaDevice* aAudioDevice, MediaDevice* aVideoDevice)
: mAudio(aAudio)
, mVideo(aVideo)
, mPicture(aPicture)
@ -304,9 +321,16 @@ public:
, mError(aError)
, mListeners(aListeners)
, mWindowID(aWindowID)
, mDevice(aDevice)
, mDeviceChosen(true)
, mBackendChosen(false) {}
, mBackendChosen(false)
{
if (mAudio) {
mAudioDevice = aAudioDevice;
}
if (mVideo) {
mVideoDevice = aVideoDevice;
}
}
GetUserMediaRunnable(bool aAudio, bool aVideo, bool aPicture,
already_AddRefed<nsIDOMGetUserMediaSuccessCallback> aSuccess,
@ -375,29 +399,13 @@ public:
return NS_OK;
}
// XXX: Implement merging two streams (See bug 758391).
if (mAudio && mVideo) {
NS_DispatchToMainThread(new ErrorCallbackRunnable(
mSuccess, mError, NS_LITERAL_STRING("NOT_IMPLEMENTED"), mWindowID
));
return NS_OK;
}
if (mPicture) {
ProcessGetUserMediaSnapshot(mDevice->GetSource(), 0);
return NS_OK;
}
if (mVideo) {
ProcessGetUserMedia(mDevice->GetSource(), kVideoTrack);
return NS_OK;
}
if (mAudio) {
ProcessGetUserMedia(mDevice->GetSource(), kAudioTrack);
ProcessGetUserMediaSnapshot(mVideoDevice->GetSource(), 0);
return NS_OK;
}
ProcessGetUserMedia(mAudio ? mAudioDevice->GetSource() : nullptr,
mVideo ? mVideoDevice->GetSource() : nullptr);
return NS_OK;
}
@ -417,9 +425,17 @@ public:
}
nsresult
SetDevice(MediaDevice* aDevice)
SetAudioDevice(MediaDevice* aAudioDevice)
{
mDevice = aDevice;
mAudioDevice = aAudioDevice;
mDeviceChosen = true;
return NS_OK;
}
nsresult
SetVideoDevice(MediaDevice* aVideoDevice)
{
mVideoDevice = aVideoDevice;
mDeviceChosen = true;
return NS_OK;
}
@ -439,8 +455,10 @@ public:
));
return NS_ERROR_FAILURE;
}
mDevice = new MediaDevice(videoSources[0]);
} else {
mVideoDevice = new MediaDevice(videoSources[0]);
LOG(("Selected video device"));
}
if (mAudio) {
nsTArray<nsRefPtr<MediaEngineAudioSource> > audioSources;
mBackend->EnumerateAudioDevices(&audioSources);
@ -451,7 +469,8 @@ public:
));
return NS_ERROR_FAILURE;
}
mDevice = new MediaDevice(audioSources[0]);
mAudioDevice = new MediaDevice(audioSources[0]);
LOG(("Selected audio device"));
}
return NS_OK;
@ -462,18 +481,35 @@ public:
* a GetUserMediaStreamRunnable. Runs off the main thread.
*/
void
ProcessGetUserMedia(MediaEngineSource* aSource, TrackID aTrackID)
ProcessGetUserMedia(MediaEngineSource* aAudioSource, MediaEngineSource* aVideoSource)
{
nsresult rv = aSource->Allocate();
if (NS_FAILED(rv)) {
NS_DispatchToMainThread(new ErrorCallbackRunnable(
mSuccess, mError, NS_LITERAL_STRING("HARDWARE_UNAVAILABLE"), mWindowID
));
return;
nsresult rv;
if (aAudioSource) {
rv = aAudioSource->Allocate();
if (NS_FAILED(rv)) {
LOG(("Failed to allocate audiosource %d",rv));
NS_DispatchToMainThread(new ErrorCallbackRunnable(
mSuccess, mError, NS_LITERAL_STRING("HARDWARE_UNAVAILABLE"), mWindowID
));
return;
}
}
if (aVideoSource) {
rv = aVideoSource->Allocate();
if (NS_FAILED(rv)) {
LOG(("Failed to allocate videosource %d\n",rv));
if (aAudioSource) {
aAudioSource->Deallocate();
}
NS_DispatchToMainThread(new ErrorCallbackRunnable(
mSuccess, mError, NS_LITERAL_STRING("HARDWARE_UNAVAILABLE"), mWindowID
));
return;
}
}
NS_DispatchToMainThread(new GetUserMediaStreamRunnable(
mSuccess, mError, aSource, mListeners, mWindowID, aTrackID
mSuccess, mError, mListeners, mWindowID, aAudioSource, aVideoSource
));
return;
}
@ -515,7 +551,8 @@ private:
already_AddRefed<nsIDOMGetUserMediaErrorCallback> mError;
StreamListeners* mListeners;
uint64_t mWindowID;
nsRefPtr<MediaDevice> mDevice;
nsRefPtr<MediaDevice> mAudioDevice;
nsRefPtr<MediaDevice> mVideoDevice;
bool mDeviceChosen;
bool mBackendChosen;
@ -616,21 +653,30 @@ MediaManager::GetUserMedia(bool aPrivileged, nsPIDOMWindow* aWindow,
rv = aParams->GetVideo(&video);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIMediaDevice> device;
rv = aParams->GetDevice(getter_AddRefs(device));
nsCOMPtr<nsIMediaDevice> audiodevice;
rv = aParams->GetAudioDevice(getter_AddRefs(audiodevice));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIMediaDevice> videodevice;
rv = aParams->GetVideoDevice(getter_AddRefs(videodevice));
NS_ENSURE_SUCCESS(rv, rv);
// If a device was provided, make sure it support the type of stream requested.
if (device) {
// Doesn't handle hard-specifying both audio and video
if (audiodevice) {
nsString type;
device->GetType(type);
if ((picture || video) && !type.EqualsLiteral("video")) {
return NS_ERROR_FAILURE;
}
audiodevice->GetType(type);
if (audio && !type.EqualsLiteral("audio")) {
return NS_ERROR_FAILURE;
}
}
if (videodevice) {
nsString type;
videodevice->GetType(type);
if ((picture || video) && !type.EqualsLiteral("video")) {
return NS_ERROR_FAILURE;
}
}
// We only support "front" or "back". TBD: Send to GetUserMediaRunnable.
nsString cameraType;
@ -696,11 +742,13 @@ MediaManager::GetUserMedia(bool aPrivileged, nsPIDOMWindow* aWindow,
audio, video, onSuccess.forget(), onError.forget(), listeners,
windowID, new MediaEngineDefault()
);
} else if (device) {
} else if (audiodevice || videodevice) {
// Stream from provided device.
gUMRunnable = new GetUserMediaRunnable(
audio, video, picture, onSuccess.forget(), onError.forget(), listeners,
windowID, static_cast<MediaDevice*>(device.get())
windowID,
static_cast<MediaDevice*>(audiodevice.get()),
static_cast<MediaDevice*>(videodevice.get())
);
} else {
// Stream from default device from WebRTC backend.
@ -710,10 +758,15 @@ MediaManager::GetUserMedia(bool aPrivileged, nsPIDOMWindow* aWindow,
);
}
#ifdef ANDROID
if (picture) {
// ShowFilePickerForMimeType() must run on the Main Thread! (on Android)
NS_DispatchToMainThread(gUMRunnable);
} else if (aPrivileged || fake) {
}
// XXX No support for Audio or Video in Android yet
#else
// XXX No full support for picture in Desktop yet (needs proper UI)
if (aPrivileged || fake) {
if (!mMediaThread) {
nsresult rv = NS_NewThread(getter_AddRefs(mMediaThread));
NS_ENSURE_SUCCESS(rv, rv);
@ -756,6 +809,7 @@ MediaManager::GetUserMedia(bool aPrivileged, nsPIDOMWindow* aWindow,
nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
obs->NotifyObservers(aParams, "getUserMedia:request", data.get());
}
#endif
return NS_OK;
}
@ -862,11 +916,20 @@ MediaManager::Observe(nsISupports* aSubject, const char* aTopic,
if (aSubject) {
// A particular device was chosen by the user.
// NOTE: does not allow setting a device to null; assumes nullptr
nsCOMPtr<nsIMediaDevice> device = do_QueryInterface(aSubject);
if (device) {
GetUserMediaRunnable* gUMRunnable =
static_cast<GetUserMediaRunnable*>(runnable.get());
gUMRunnable->SetDevice(static_cast<MediaDevice*>(device.get()));
nsString type;
device->GetType(type);
if (type.EqualsLiteral("video")) {
gUMRunnable->SetVideoDevice(static_cast<MediaDevice*>(device.get()));
} else if (type.EqualsLiteral("audio")) {
gUMRunnable->SetAudioDevice(static_cast<MediaDevice*>(device.get()));
} else {
NS_WARNING("Unknown device type in getUserMedia");
}
}
}

View File

@ -14,9 +14,23 @@
#include "nsPIDOMWindow.h"
#include "nsIDOMNavigatorUserMedia.h"
#include "mozilla/Attributes.h"
#include "prlog.h"
namespace mozilla {
#ifdef PR_LOGGING
extern PRLogModuleInfo* gMediaManagerLog;
#define MM_LOG(msg) PR_LOG(gMediaManagerLog, PR_LOG_DEBUG, msg)
#else
#define MM_LOG(msg)
#endif
// We only support 1 audio and 1 video track for now.
enum {
kVideoTrack = 1,
kAudioTrack = 2
};
class GetUserMediaNotificationEvent: public nsRunnable
{
public:
@ -59,11 +73,12 @@ class GetUserMediaNotificationEvent: public nsRunnable
class GetUserMediaCallbackMediaStreamListener : public MediaStreamListener
{
public:
GetUserMediaCallbackMediaStreamListener(MediaEngineSource* aSource,
nsDOMMediaStream* aStream, TrackID aListenId)
: mSource(aSource)
GetUserMediaCallbackMediaStreamListener(nsDOMMediaStream* aStream,
MediaEngineSource* aAudioSource,
MediaEngineSource* aVideoSource)
: mAudioSource(aAudioSource)
, mVideoSource(aVideoSource)
, mStream(aStream)
, mID(aListenId)
, mValid(true) {}
void
@ -74,9 +89,14 @@ public:
}
mValid = false;
mSource->Stop();
mSource->Deallocate();
if (mAudioSource) {
mAudioSource->Stop();
mAudioSource->Deallocate();
}
if (mVideoSource) {
mVideoSource->Stop();
mVideoSource->Deallocate();
}
nsCOMPtr<GetUserMediaNotificationEvent> event =
new GetUserMediaNotificationEvent(GetUserMediaNotificationEvent::STOPPING);
@ -87,8 +107,22 @@ public:
NotifyConsumptionChanged(MediaStreamGraph* aGraph, Consumption aConsuming)
{
if (aConsuming == CONSUMED) {
nsresult rv;
SourceMediaStream* stream = mStream->GetStream()->AsSourceStream();
mSource->Start(stream, mID);
if (mAudioSource) {
rv = mAudioSource->Start(stream, kAudioTrack);
if (NS_FAILED(rv)) {
MM_LOG(("Starting audio failed, rv=%d",rv));
}
}
if (mVideoSource) {
rv = mVideoSource->Start(stream, kVideoTrack);
if (NS_FAILED(rv)) {
MM_LOG(("Starting video failed, rv=%d",rv));
}
}
MM_LOG(("started all sources"));
nsCOMPtr<GetUserMediaNotificationEvent> event =
new GetUserMediaNotificationEvent(GetUserMediaNotificationEvent::STARTING);
@ -101,17 +135,10 @@ public:
return;
}
void NotifyBlockingChanged(MediaStreamGraph* aGraph, Blocking aBlocked) {}
void NotifyOutput(MediaStreamGraph* aGraph) {}
void NotifyFinished(MediaStreamGraph* aGraph) {}
void NotifyQueuedTrackChanges(MediaStreamGraph* aGraph, TrackID aID,
TrackRate aTrackRate, TrackTicks aTrackOffset,
uint32_t aTrackEvents, const MediaSegment& aQueuedMedia) {}
private:
nsRefPtr<MediaEngineSource> mSource;
nsRefPtr<MediaEngineSource> mAudioSource;
nsRefPtr<MediaEngineSource> mVideoSource;
nsCOMPtr<nsDOMMediaStream> mStream;
TrackID mID;
bool mValid;
};

View File

@ -146,6 +146,7 @@ function PeerConnection() {
this.onstatechange = null;
this.ongatheringchange = null;
this.onicechange = null;
this.remoteDescription = null;
// Data channel.
this.ondatachannel = null;
@ -248,31 +249,35 @@ PeerConnection.prototype = {
});
},
createAnswer: function(offer, onSuccess, onError, constraints, provisional) {
createAnswer: function(onSuccess, onError, constraints, provisional) {
if (this._onCreateAnswerSuccess) {
if (onError) {
onError.onCallback("createAnswer already called");
try {
onError.onCallback("createAnswer already called");
} catch(e) {}
}
return;
}
if (!this.remoteDescription) {
if (onError) {
try {
onError.onCallback("setRemoteDescription not called");
} catch(e) {}
}
}
if (this.remoteDescription.type != "offer") {
if (onError) {
try {
onError.onCallback("No outstanding offer");
} catch(e) {}
}
}
this._onCreateAnswerSuccess = onSuccess;
this._onCreateAnswerFailure = onError;
if (offer.type != "offer") {
if (onError) {
onError.onCallback("Invalid type " + offer.type + " passed");
}
return;
}
if (!offer.sdp) {
if (onError) {
onError.onCallback("SDP not provided to createAnswer");
}
return;
}
if (!constraints) {
constraints = "";
}
@ -283,7 +288,7 @@ PeerConnection.prototype = {
// TODO: Implement provisional answer & constraints.
this._queueOrRun({
func: this._pc.createAnswer,
args: ["", offer.sdp],
args: ["", this.remoteDescription.sdp],
wait: true
});
},
@ -291,7 +296,9 @@ PeerConnection.prototype = {
setLocalDescription: function(desc, onSuccess, onError) {
if (this._onSetLocalDescriptionSuccess) {
if (onError) {
onError.onCallback("setLocalDescription already called");
try {
onError.onCallback("setLocalDescription already called");
} catch(e) {}
}
return;
}
@ -309,9 +316,11 @@ PeerConnection.prototype = {
break;
default:
if (onError) {
onError.onCallback(
"Invalid type " + desc.type + " provided to setLocalDescription"
);
try {
onError.onCallback(
"Invalid type " + desc.type + " provided to setLocalDescription"
);
} catch(e) {}
return;
}
break;
@ -327,7 +336,9 @@ PeerConnection.prototype = {
setRemoteDescription: function(desc, onSuccess, onError) {
if (this._onSetRemoteDescriptionSuccess) {
if (onError) {
onError.onCallback("setRemoteDescription already called");
try {
onError.onCallback("setRemoteDescription already called");
} catch(e) {}
}
return;
}
@ -345,14 +356,21 @@ PeerConnection.prototype = {
break;
default:
if (onError) {
onError.onCallback(
"Invalid type " + desc.type + " provided to setLocalDescription"
);
try {
onError.onCallback(
"Invalid type " + desc.type + " provided to setRemoteDescription"
);
} catch(e) {}
return;
}
break;
}
this.remoteDescription = {
type: desc.type, sdp: desc.sdp,
__exposedProps__: { type: "rw", sdp: "rw" }
};
this._queueOrRun({
func: this._pc.setRemoteDescription,
args: [type, desc.sdp],
@ -404,6 +422,13 @@ PeerConnection.prototype = {
});
},
get localStreams() {
return this._pc.localStreams;
},
get remoteStreams() {
return this._pc.remoteStreams;
},
createDataChannel: function(label, dict) {
if (dict &&
dict.maxRetransmitTime != undefined &&

View File

@ -83,6 +83,9 @@ interface IPeerConnection : nsISupports
void removeStream(in nsIDOMMediaStream stream);
void closeStreams();
[implicit_jscontext] readonly attribute jsval localStreams; // MediaStream[]
[implicit_jscontext] readonly attribute jsval remoteStreams; // MediaStream[]
/* As the ICE candidates roll in this one should be called each time
* in order to keep the candidate list up-to-date for the next SDP-related
* call PeerConnectionImpl does not parse ICE candidates, just sticks them

View File

@ -35,7 +35,7 @@ interface nsIDOMGetUserMediaErrorCallback : nsISupports
void onError(in DOMString error);
};
[scriptable, uuid(36d9c3b7-7594-4035-8a7e-92c2cecdb2c5)]
[scriptable, uuid(f34a3616-395a-43cd-b275-bf81750ac8b9)]
interface nsIMediaStreamOptions : nsISupports
{
readonly attribute boolean fake;
@ -43,7 +43,8 @@ interface nsIMediaStreamOptions : nsISupports
readonly attribute boolean video;
readonly attribute boolean picture;
readonly attribute DOMString camera;
readonly attribute nsIMediaDevice device;
readonly attribute nsIMediaDevice audioDevice;
readonly attribute nsIMediaDevice videoDevice;
};
[scriptable, uuid(381e0071-0be5-4f6b-ae21-8e3407a37faa)]

View File

@ -35,15 +35,14 @@ interface nsIDOMRTCIceCandidate : nsISupports
};
/* See http://dev.w3.org/2011/webrtc/editor/webrtc.html */
[scriptable, uuid(807b9b54-25a1-421e-9133-27ae6efcfcfd)]
[scriptable, uuid(f888648c-5e6b-4af9-91ad-a911e53d7a39)]
interface nsIDOMRTCPeerConnection : nsISupports
{
void createOffer(in RTCPeerConnectionCallback successCallback,
[optional] in RTCPeerConnectionCallback failureCallback,
[optional] in jsval constraints);
void createAnswer(in nsIDOMRTCSessionDescription offer,
in RTCPeerConnectionCallback successCallback,
void createAnswer(in RTCPeerConnectionCallback successCallback,
[optional] in RTCPeerConnectionCallback failureCallback,
[optional] in jsval constraints,
[optional] in bool createProvisionalAnswer);

View File

@ -19,7 +19,7 @@ class nsPluginEvent;
// Do not make this interface scriptable, because the virtual functions in C++
// blocks will make script call the wrong functions.
[uuid(CE1EE148-B201-4DC7-8A65-311143EA01BF)]
[uuid(59BE4CA5-3CB0-40E6-A111-9A88C8477610)]
interface nsIPluginInstanceOwner : nsISupports
{
/**
@ -111,10 +111,6 @@ interface nsIPluginInstanceOwner : nsISupports
void setEventModel(in int32_t eventModel);
%{C++
virtual void SendIdleEvent() = 0;
%}
/**
* Call NPP_SetWindow on the plugin.
*/

View File

@ -2127,7 +2127,7 @@ _getvalue(NPP npp, NPNVariable variable, void *result)
#ifndef NP_NO_CARBON
case NPNVsupportsCarbonBool: {
*(NPBool*)result = true;
*(NPBool*)result = false;
return NPERR_NO_ERROR;
}

View File

@ -368,11 +368,6 @@ nsPluginHost::nsPluginHost()
PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("nsPluginHost::ctor\n"));
PR_LogFlush();
#endif
#ifdef MAC_CARBON_PLUGINS
mVisiblePluginTimer = do_CreateInstance(NS_TIMER_CONTRACTID);
mHiddenPluginTimer = do_CreateInstance(NS_TIMER_CONTRACTID);
#endif
}
nsPluginHost::~nsPluginHost()
@ -3810,74 +3805,8 @@ nsPluginHost::GetPluginTagForInstance(nsNPAPIPluginInstance *aPluginInstance,
return NS_OK;
}
#ifdef MAC_CARBON_PLUGINS
// Flash requires a minimum of 8 events per second to avoid audio skipping.
// Since WebKit uses a hidden plugin event rate of 4 events per second Flash
// uses a Carbon timer for WebKit which fires at 8 events per second.
#define HIDDEN_PLUGIN_DELAY 125
#define VISIBLE_PLUGIN_DELAY 20
#endif
void nsPluginHost::AddIdleTimeTarget(nsIPluginInstanceOwner* objectFrame, bool isVisible)
{
#ifdef MAC_CARBON_PLUGINS
nsTObserverArray<nsIPluginInstanceOwner*> *targetArray;
if (isVisible) {
targetArray = &mVisibleTimerTargets;
} else {
targetArray = &mHiddenTimerTargets;
}
if (targetArray->Contains(objectFrame)) {
return;
}
targetArray->AppendElement(objectFrame);
if (targetArray->Length() == 1) {
if (isVisible) {
mVisiblePluginTimer->InitWithCallback(this, VISIBLE_PLUGIN_DELAY, nsITimer::TYPE_REPEATING_SLACK);
} else {
mHiddenPluginTimer->InitWithCallback(this, HIDDEN_PLUGIN_DELAY, nsITimer::TYPE_REPEATING_SLACK);
}
}
#endif
}
void nsPluginHost::RemoveIdleTimeTarget(nsIPluginInstanceOwner* objectFrame)
{
#ifdef MAC_CARBON_PLUGINS
bool visibleRemoved = mVisibleTimerTargets.RemoveElement(objectFrame);
if (visibleRemoved && mVisibleTimerTargets.IsEmpty()) {
mVisiblePluginTimer->Cancel();
}
bool hiddenRemoved = mHiddenTimerTargets.RemoveElement(objectFrame);
if (hiddenRemoved && mHiddenTimerTargets.IsEmpty()) {
mHiddenPluginTimer->Cancel();
}
NS_ASSERTION(!(hiddenRemoved && visibleRemoved), "Plugin instance received visible and hidden idle event notifications");
#endif
}
NS_IMETHODIMP nsPluginHost::Notify(nsITimer* timer)
{
#ifdef MAC_CARBON_PLUGINS
if (timer == mVisiblePluginTimer) {
nsTObserverArray<nsIPluginInstanceOwner*>::ForwardIterator iter(mVisibleTimerTargets);
while (iter.HasMore()) {
iter.GetNext()->SendIdleEvent();
}
return NS_OK;
} else if (timer == mHiddenPluginTimer) {
nsTObserverArray<nsIPluginInstanceOwner*>::ForwardIterator iter(mHiddenTimerTargets);
while (iter.HasMore()) {
iter.GetNext()->SendIdleEvent();
}
return NS_OK;
}
#endif
nsRefPtr<nsPluginTag> pluginTag = mPlugins;
while (pluginTag) {
if (pluginTag->mUnloadTimer == timer) {

View File

@ -38,10 +38,6 @@ class nsPluginNativeWindow;
class nsObjectLoadingContent;
class nsPluginInstanceOwner;
#if defined(XP_MACOSX) && !defined(NP_NO_CARBON)
#define MAC_CARBON_PLUGINS
#endif
class nsInvalidPluginTag : public nsISupports
{
public:
@ -320,13 +316,6 @@ private:
// We need to hold a global ptr to ourselves because we register for
// two different CIDs for some reason...
static nsPluginHost* sInst;
#ifdef MAC_CARBON_PLUGINS
nsCOMPtr<nsITimer> mVisiblePluginTimer;
nsTObserverArray<nsIPluginInstanceOwner*> mVisibleTimerTargets;
nsCOMPtr<nsITimer> mHiddenPluginTimer;
nsTObserverArray<nsIPluginInstanceOwner*> mHiddenTimerTargets;
#endif
};
class NS_STACK_CLASS PluginDestructionGuard : protected PRCList

View File

@ -321,6 +321,7 @@ nsPluginInstanceOwner::nsPluginInstanceOwner()
#ifdef XP_MACOSX
#ifndef NP_NO_CARBON
// We don't support Carbon, but it is still the default model for i386 NPAPI.
mEventModel = NPEventModelCarbon;
#else
mEventModel = NPEventModelCocoa;
@ -328,10 +329,6 @@ nsPluginInstanceOwner::nsPluginInstanceOwner()
mUseAsyncRendering = false;
#endif
#if defined(XP_MACOSX) && !defined(NP_NO_CARBON)
mRegisteredScrollPositionListener = false;
#endif
mWaitingForPaint = false;
#ifdef MOZ_WIDGET_ANDROID
@ -351,10 +348,6 @@ nsPluginInstanceOwner::~nsPluginInstanceOwner()
NS_DispatchToMainThread(event);
}
#ifdef MAC_CARBON_PLUGINS
CancelTimer();
#endif
mObjectFrame = nullptr;
for (cnt = 0; cnt < (mNumCachedAttrs + 1 + mNumCachedParams); cnt++) {
@ -767,17 +760,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetNetscapeWindow(void *value)
NS_IMETHODIMP nsPluginInstanceOwner::SetEventModel(int32_t eventModel)
{
#ifdef XP_MACOSX
NPEventModel newEventModel = static_cast<NPEventModel>(eventModel);
#ifndef NP_NO_CARBON
bool eventModelChange = (mEventModel != newEventModel);
if (eventModelChange)
RemoveScrollPositionListener();
#endif
mEventModel = static_cast<NPEventModel>(newEventModel);
#ifndef NP_NO_CARBON
if (eventModelChange)
AddScrollPositionListener();
#endif
mEventModel = static_cast<NPEventModel>(eventModel);
return NS_OK;
#else
return NS_ERROR_NOT_IMPLEMENTED;
@ -1353,20 +1336,6 @@ nsresult nsPluginInstanceOwner::EnsureCachedAttrParamArrays()
#ifdef XP_MACOSX
#ifndef NP_NO_CARBON
static void InitializeEventRecord(EventRecord* event, ::Point* aMousePosition)
{
memset(event, 0, sizeof(EventRecord));
if (aMousePosition) {
event->where = *aMousePosition;
} else {
::GetGlobalMouse(&event->where);
}
event->when = ::TickCount();
event->modifiers = ::GetCurrentKeyModifiers();
}
#endif
static void InitializeNPCocoaEvent(NPCocoaEvent* event)
{
memset(event, 0, sizeof(NPCocoaEvent));
@ -1595,19 +1564,6 @@ void* nsPluginInstanceOwner::SetPluginPortAndDetectChange()
return nullptr;
mPluginWindow->window = pluginPort;
#ifndef NP_NO_CARBON
if (GetEventModel() == NPEventModelCarbon &&
GetDrawingModel() == NPDrawingModelCoreGraphics) {
NP_CGContext* windowCGPort = static_cast<NP_CGContext*>(mPluginWindow->window);
if ((windowCGPort->context != mCGPluginPortCopy.context) ||
(windowCGPort->window != mCGPluginPortCopy.window)) {
mCGPluginPortCopy.context = windowCGPort->context;
mCGPluginPortCopy.window = windowCGPort->window;
mPluginPortChanged = true;
}
}
#endif
return mPluginWindow->window;
}
@ -1650,54 +1606,6 @@ nsPluginInstanceOwner::GetEventloopNestingLevel()
return currentLevel;
}
void nsPluginInstanceOwner::ScrollPositionWillChange(nscoord aX, nscoord aY)
{
#ifdef MAC_CARBON_PLUGINS
if (GetEventModel() != NPEventModelCarbon)
return;
CancelTimer();
if (mInstance) {
nsCOMPtr<nsIPluginWidget> pluginWidget = do_QueryInterface(mWidget);
if (pluginWidget && NS_SUCCEEDED(pluginWidget->StartDrawPlugin())) {
EventRecord scrollEvent;
InitializeEventRecord(&scrollEvent, nullptr);
scrollEvent.what = NPEventType_ScrollingBeginsEvent;
void* window = FixUpPluginWindow(ePluginPaintDisable);
if (window) {
mInstance->HandleEvent(&scrollEvent, nullptr);
}
pluginWidget->EndDrawPlugin();
}
}
#endif
}
void nsPluginInstanceOwner::ScrollPositionDidChange(nscoord aX, nscoord aY)
{
#ifdef MAC_CARBON_PLUGINS
if (GetEventModel() != NPEventModelCarbon)
return;
if (mInstance) {
nsCOMPtr<nsIPluginWidget> pluginWidget = do_QueryInterface(mWidget);
if (pluginWidget && NS_SUCCEEDED(pluginWidget->StartDrawPlugin())) {
EventRecord scrollEvent;
InitializeEventRecord(&scrollEvent, nullptr);
scrollEvent.what = NPEventType_ScrollingEndsEvent;
void* window = FixUpPluginWindow(ePluginPaintEnable);
if (window) {
mInstance->HandleEvent(&scrollEvent, nullptr);
}
pluginWidget->EndDrawPlugin();
}
}
#endif
}
#ifdef MOZ_WIDGET_ANDROID
// Modified version of nsFrame::GetOffsetToCrossDoc that stops when it
@ -1938,35 +1846,6 @@ nsresult nsPluginInstanceOwner::Text(nsIDOMEvent* aTextEvent)
nsresult nsPluginInstanceOwner::ProcessKeyPress(nsIDOMEvent* aKeyEvent)
{
#ifdef XP_MACOSX
#ifndef NP_NO_CARBON
if (GetEventModel() == NPEventModelCarbon) {
// KeyPress events are really synthesized keyDown events.
// Here we check the native message of the event so that
// we won't send the plugin two keyDown events.
nsEvent *theEvent = aKeyEvent->GetInternalNSEvent();
const EventRecord *ev;
if (theEvent &&
theEvent->message == NS_KEY_PRESS &&
(ev = (EventRecord*)(((nsGUIEvent*)theEvent)->pluginEvent)) &&
ev->what == keyDown)
return aKeyEvent->PreventDefault(); // consume event
// Nasty hack to avoid recursive event dispatching with Java. Java can
// dispatch key events to a TSM handler, which comes back and calls
// [ChildView insertText:] on the cocoa widget, which sends a key
// event back down.
static bool sInKeyDispatch = false;
if (sInKeyDispatch)
return aKeyEvent->PreventDefault(); // consume event
sInKeyDispatch = true;
nsresult rv = DispatchKeyToPlugin(aKeyEvent);
sInKeyDispatch = false;
return rv;
}
#endif
return DispatchKeyToPlugin(aKeyEvent);
#else
if (SendNativeEvents())
@ -2153,9 +2032,6 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const nsGUIEvent& anEvent)
NPEventModel eventModel = GetEventModel();
// If we have to synthesize an event we'll use one of these.
#ifndef NP_NO_CARBON
EventRecord synthCarbonEvent;
#endif
NPCocoaEvent synthCocoaEvent;
void* event = anEvent.pluginEvent;
nsPoint pt =
@ -2169,99 +2045,45 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const nsGUIEvent& anEvent)
size_t intScaleFactor = ceil(scaleFactor);
nsIntPoint ptPx(presContext->AppUnitsToDevPixels(pt.x) / intScaleFactor,
presContext->AppUnitsToDevPixels(pt.y) / intScaleFactor);
#ifndef NP_NO_CARBON
nsIntPoint geckoScreenCoords = mWidget->WidgetToScreenOffset();
::Point carbonPt = { static_cast<short>(ptPx.y + geckoScreenCoords.y / intScaleFactor),
static_cast<short>(ptPx.x + geckoScreenCoords.x / intScaleFactor) };
if (eventModel == NPEventModelCarbon) {
if (event && anEvent.eventStructType == NS_MOUSE_EVENT) {
static_cast<EventRecord*>(event)->where = carbonPt;
}
}
#endif
if (!event) {
#ifndef NP_NO_CARBON
if (eventModel == NPEventModelCarbon) {
InitializeEventRecord(&synthCarbonEvent, &carbonPt);
} else
#endif
{
InitializeNPCocoaEvent(&synthCocoaEvent);
}
InitializeNPCocoaEvent(&synthCocoaEvent);
switch (anEvent.message) {
case NS_FOCUS_CONTENT:
case NS_BLUR_CONTENT:
#ifndef NP_NO_CARBON
if (eventModel == NPEventModelCarbon) {
synthCarbonEvent.what = (anEvent.message == NS_FOCUS_CONTENT) ?
NPEventType_GetFocusEvent : NPEventType_LoseFocusEvent;
event = &synthCarbonEvent;
}
#endif
break;
case NS_MOUSE_MOVE:
{
// Ignore mouse-moved events that happen as part of a dragging
// operation that started over another frame. See bug 525078.
nsRefPtr<nsFrameSelection> frameselection = mObjectFrame->GetFrameSelection();
if (!frameselection->GetMouseDownState() ||
(nsIPresShell::GetCapturingContent() == mObjectFrame->GetContent())) {
#ifndef NP_NO_CARBON
if (eventModel == NPEventModelCarbon) {
synthCarbonEvent.what = osEvt;
event = &synthCarbonEvent;
} else
#endif
{
synthCocoaEvent.type = NPCocoaEventMouseMoved;
synthCocoaEvent.data.mouse.pluginX = static_cast<double>(ptPx.x);
synthCocoaEvent.data.mouse.pluginY = static_cast<double>(ptPx.y);
event = &synthCocoaEvent;
}
}
}
break;
case NS_MOUSE_BUTTON_DOWN:
#ifndef NP_NO_CARBON
if (eventModel == NPEventModelCarbon) {
synthCarbonEvent.what = mouseDown;
event = &synthCarbonEvent;
} else
#endif
{
synthCocoaEvent.type = NPCocoaEventMouseDown;
(nsIPresShell::GetCapturingContent() == mObjectFrame->GetContent())) {
synthCocoaEvent.type = NPCocoaEventMouseMoved;
synthCocoaEvent.data.mouse.pluginX = static_cast<double>(ptPx.x);
synthCocoaEvent.data.mouse.pluginY = static_cast<double>(ptPx.y);
event = &synthCocoaEvent;
}
}
break;
case NS_MOUSE_BUTTON_DOWN:
synthCocoaEvent.type = NPCocoaEventMouseDown;
synthCocoaEvent.data.mouse.pluginX = static_cast<double>(ptPx.x);
synthCocoaEvent.data.mouse.pluginY = static_cast<double>(ptPx.y);
event = &synthCocoaEvent;
break;
case NS_MOUSE_BUTTON_UP:
// If we're in a dragging operation that started over another frame,
// either ignore the mouse-up event (in the Carbon Event Model) or
// convert it into a mouse-entered event (in the Cocoa Event Model).
// See bug 525078.
if ((static_cast<const nsMouseEvent&>(anEvent).button == nsMouseEvent::eLeftButton) &&
(nsIPresShell::GetCapturingContent() != mObjectFrame->GetContent())) {
if (eventModel == NPEventModelCocoa) {
synthCocoaEvent.type = NPCocoaEventMouseEntered;
synthCocoaEvent.data.mouse.pluginX = static_cast<double>(ptPx.x);
synthCocoaEvent.data.mouse.pluginY = static_cast<double>(ptPx.y);
event = &synthCocoaEvent;
}
synthCocoaEvent.type = NPCocoaEventMouseEntered;
synthCocoaEvent.data.mouse.pluginX = static_cast<double>(ptPx.x);
synthCocoaEvent.data.mouse.pluginY = static_cast<double>(ptPx.y);
event = &synthCocoaEvent;
} else {
#ifndef NP_NO_CARBON
if (eventModel == NPEventModelCarbon) {
synthCarbonEvent.what = mouseUp;
event = &synthCarbonEvent;
} else
#endif
{
synthCocoaEvent.type = NPCocoaEventMouseUp;
synthCocoaEvent.data.mouse.pluginX = static_cast<double>(ptPx.x);
synthCocoaEvent.data.mouse.pluginY = static_cast<double>(ptPx.y);
event = &synthCocoaEvent;
}
synthCocoaEvent.type = NPCocoaEventMouseUp;
synthCocoaEvent.data.mouse.pluginX = static_cast<double>(ptPx.x);
synthCocoaEvent.data.mouse.pluginY = static_cast<double>(ptPx.y);
event = &synthCocoaEvent;
}
break;
default:
@ -2275,14 +2097,6 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const nsGUIEvent& anEvent)
}
}
#ifndef NP_NO_CARBON
// Work around an issue in the Flash plugin, which can cache a pointer
// to a doomed TSM document (one that belongs to a NSTSMInputContext)
// and try to activate it after it has been deleted. See bug 183313.
if (eventModel == NPEventModelCarbon && anEvent.message == NS_FOCUS_CONTENT)
::DeactivateTSMDocument(::TSMGetActiveDocument());
#endif
int16_t response = kNPEventNotHandled;
void* window = FixUpPluginWindow(ePluginPaintEnable);
if (window || (eventModel == NPEventModelCocoa)) {
@ -2755,10 +2569,6 @@ nsPluginInstanceOwner::Destroy()
if (mObjectFrame)
mObjectFrame->SetInstanceOwner(nullptr);
#ifdef MAC_CARBON_PLUGINS
// stop the timer explicitly to reduce reference count.
CancelTimer();
#endif
#ifdef XP_MACOSX
RemoveFromCARefreshTimer();
if (mColorProfile)
@ -2836,20 +2646,7 @@ void nsPluginInstanceOwner::Paint(const gfxRect& aDirtyRect, CGContextRef cgCont
nsCOMPtr<nsIPluginWidget> pluginWidget = do_QueryInterface(mWidget);
if (pluginWidget && NS_SUCCEEDED(pluginWidget->StartDrawPlugin())) {
#ifndef NP_NO_CARBON
void* window = FixUpPluginWindow(ePluginPaintEnable);
if (GetEventModel() == NPEventModelCarbon && window) {
EventRecord updateEvent;
InitializeEventRecord(&updateEvent, nullptr);
updateEvent.what = updateEvt;
updateEvent.message = UInt32(window);
mInstance->HandleEvent(&updateEvent, nullptr);
} else if (GetEventModel() == NPEventModelCocoa)
#endif
{
DoCocoaEventDrawRect(dirtyRectCopy, cgContext);
}
DoCocoaEventDrawRect(dirtyRectCopy, cgContext);
pluginWidget->EndDrawPlugin();
}
}
@ -3178,50 +2975,6 @@ nsPluginInstanceOwner::Renderer::DrawWithXlib(gfxXlibSurface* xsurface,
}
#endif
void nsPluginInstanceOwner::SendIdleEvent()
{
#ifdef MAC_CARBON_PLUGINS
// validate the plugin clipping information by syncing the plugin window info to
// reflect the current widget location. This makes sure that everything is updated
// correctly in the event of scrolling in the window.
if (mInstance) {
nsCOMPtr<nsIPluginWidget> pluginWidget = do_QueryInterface(mWidget);
if (pluginWidget && NS_SUCCEEDED(pluginWidget->StartDrawPlugin())) {
void* window = FixUpPluginWindow(ePluginPaintEnable);
if (window) {
EventRecord idleEvent;
InitializeEventRecord(&idleEvent, nullptr);
idleEvent.what = nullEvent;
// give a bogus 'where' field of our null event when hidden, so Flash
// won't respond to mouse moves in other tabs, see bug 120875
if (!mWidgetVisible)
idleEvent.where.h = idleEvent.where.v = 20000;
mInstance->HandleEvent(&idleEvent, nullptr);
}
pluginWidget->EndDrawPlugin();
}
}
#endif
}
#ifdef MAC_CARBON_PLUGINS
void nsPluginInstanceOwner::StartTimer(bool isVisible)
{
if (GetEventModel() != NPEventModelCarbon)
return;
mPluginHost->AddIdleTimeTarget(this, isVisible);
}
void nsPluginInstanceOwner::CancelTimer()
{
mPluginHost->RemoveIdleTimeTarget(this);
}
#endif
nsresult nsPluginInstanceOwner::Init(nsIContent* aContent)
{
mLastEventloopNestingLevel = GetEventloopNestingLevel();
@ -3413,10 +3166,6 @@ NS_IMETHODIMP nsPluginInstanceOwner::CreateWidget(void)
// be initialized first
mPluginWindow->type = NPWindowTypeWindow;
mPluginWindow->window = GetPluginPortFromWidget();
#ifdef MAC_CARBON_PLUGINS
// start the idle timer.
StartTimer(true);
#endif
// tell the plugin window about the widget
mPluginWindow->SetPluginWidget(mWidget);
@ -3440,36 +3189,23 @@ void* nsPluginInstanceOwner::FixUpPluginWindow(int32_t inPaintState)
if (!mWidget || !mPluginWindow || !mInstance || !mObjectFrame)
return nullptr;
NPEventModel eventModel = GetEventModel();
nsCOMPtr<nsIPluginWidget> pluginWidget = do_QueryInterface(mWidget);
if (!pluginWidget)
return nullptr;
// If we've already set up a CGContext in nsObjectFrame::PaintPlugin(), we
// don't want calls to SetPluginPortAndDetectChange() to step on our work.
void* pluginPort = nullptr;
if (mInCGPaintLevel > 0) {
pluginPort = mPluginWindow->window;
} else {
pluginPort = SetPluginPortAndDetectChange();
if (mInCGPaintLevel < 1) {
SetPluginPortAndDetectChange();
}
#ifdef MAC_CARBON_PLUGINS
if (eventModel == NPEventModelCarbon && !pluginPort)
return nullptr;
#endif
// We'll need the top-level Cocoa window for the Cocoa event model.
void* cocoaTopLevelWindow = nullptr;
if (eventModel == NPEventModelCocoa) {
nsIWidget* widget = mObjectFrame->GetNearestWidget();
if (!widget)
return nullptr;
cocoaTopLevelWindow = widget->GetNativeData(NS_NATIVE_WINDOW);
if (!cocoaTopLevelWindow)
return nullptr;
}
nsIWidget* widget = mObjectFrame->GetNearestWidget();
if (!widget)
return nullptr;
void *cocoaTopLevelWindow = widget->GetNativeData(NS_NATIVE_WINDOW);
if (!cocoaTopLevelWindow)
return nullptr;
nsIntPoint pluginOrigin;
nsIntRect widgetClip;
@ -3487,14 +3223,7 @@ void* nsPluginInstanceOwner::FixUpPluginWindow(int32_t inPaintState)
nsIntPoint geckoScreenCoords = mWidget->WidgetToScreenOffset();
nsRect windowRect;
#ifndef NP_NO_CARBON
if (eventModel == NPEventModelCarbon) {
NS_NPAPI_CarbonWindowFrame(static_cast<WindowRef>(static_cast<NP_CGContext*>(pluginPort)->window), windowRect);
} else
#endif
{
NS_NPAPI_CocoaWindowFrame(cocoaTopLevelWindow, windowRect);
}
NS_NPAPI_CocoaWindowFrame(cocoaTopLevelWindow, windowRect);
double scaleFactor = 1.0;
GetContentsScaleFactor(&scaleFactor);
@ -3526,7 +3255,8 @@ void* nsPluginInstanceOwner::FixUpPluginWindow(int32_t inPaintState)
if (mPluginWindow->clipRect.left != oldClipRect.left ||
mPluginWindow->clipRect.top != oldClipRect.top ||
mPluginWindow->clipRect.right != oldClipRect.right ||
mPluginWindow->clipRect.bottom != oldClipRect.bottom)
mPluginWindow->clipRect.bottom != oldClipRect.bottom ||
mPluginPortChanged)
{
if (UseAsyncRendering()) {
mInstance->AsyncSetWindow(mPluginWindow);
@ -3535,30 +3265,11 @@ void* nsPluginInstanceOwner::FixUpPluginWindow(int32_t inPaintState)
mPluginWindow->CallSetWindow(mInstance);
}
mPluginPortChanged = false;
#ifdef MAC_CARBON_PLUGINS
// if the clipRect is of size 0, make the null timer fire less often
CancelTimer();
if (mPluginWindow->clipRect.left == mPluginWindow->clipRect.right ||
mPluginWindow->clipRect.top == mPluginWindow->clipRect.bottom) {
StartTimer(false);
}
else {
StartTimer(true);
}
#endif
} else if (mPluginPortChanged) {
if (UseAsyncRendering()) {
mInstance->AsyncSetWindow(mPluginWindow);
}
else {
mPluginWindow->CallSetWindow(mInstance);
}
mPluginPortChanged = false;
}
// After the first NPP_SetWindow call we need to send an initial
// top-level window focus event.
if (eventModel == NPEventModelCocoa && !mSentInitialTopLevelWindowEvent) {
if (!mSentInitialTopLevelWindowEvent) {
// Set this before calling ProcessEvent to avoid endless recursion.
mSentInitialTopLevelWindowEvent = true;
@ -3571,11 +3282,6 @@ void* nsPluginInstanceOwner::FixUpPluginWindow(int32_t inPaintState)
ProcessEvent(pluginEvent);
}
#ifdef MAC_CARBON_PLUGINS
if (GetDrawingModel() == NPDrawingModelCoreGraphics && eventModel == NPEventModelCarbon)
return static_cast<NP_CGContext*>(pluginPort)->window;
#endif
return nullptr;
}
@ -3689,38 +3395,6 @@ nsPluginInstanceOwner::CallSetWindow()
return NS_OK;
}
#if defined(XP_MACOSX) && !defined(NP_NO_CARBON)
void nsPluginInstanceOwner::AddScrollPositionListener()
{
// We need to register as a scroll position listener on every scrollable frame up to the top.
if (!mRegisteredScrollPositionListener && GetEventModel() == NPEventModelCarbon) {
for (nsIFrame* f = mObjectFrame; f; f = nsLayoutUtils::GetCrossDocParentFrame(f)) {
nsIScrollableFrame* sf = do_QueryFrame(f);
if (sf) {
sf->AddScrollPositionListener(this);
}
}
mRegisteredScrollPositionListener = true;
}
}
void nsPluginInstanceOwner::RemoveScrollPositionListener()
{
// Our frame is changing or going away, unregister for a scroll position listening.
// It's OK to unregister when we didn't register, so don't be strict about unregistering.
// Better to unregister when we didn't have to than to not unregister when we should.
if (mRegisteredScrollPositionListener) {
for (nsIFrame* f = mObjectFrame; f; f = nsLayoutUtils::GetCrossDocParentFrame(f)) {
nsIScrollableFrame* sf = do_QueryFrame(f);
if (sf) {
sf->RemoveScrollPositionListener(this);
}
}
mRegisteredScrollPositionListener = false;
}
}
#endif
NS_IMETHODIMP
nsPluginInstanceOwner::GetContentsScaleFactor(double *result)
{
@ -3730,24 +3404,10 @@ nsPluginInstanceOwner::GetContentsScaleFactor(double *result)
// for plugins. On other platforms, plugin coordinates are always in device
// pixels.
#if defined(XP_MACOSX)
if (mWidget) {
scaleFactor = mWidget->GetDefaultScale();
} else {
nsCOMPtr<nsIScreenManager> screenMgr =
do_GetService("@mozilla.org/gfx/screenmanager;1");
if (screenMgr) {
nsCOMPtr<nsIScreen> screen;
nsIntRect screenRect = mObjectFrame->GetScreenRect();
screenMgr->ScreenForRect(screenRect.x, screenRect.y,
screenRect.width, screenRect.height,
getter_AddRefs(screen));
if (screen) {
nsresult rv = screen->GetContentsScaleFactor(&scaleFactor);
if (NS_FAILED(rv)) {
scaleFactor = 1.0;
}
}
}
nsIPresShell* presShell = nsContentUtils::FindPresShellForDocument(mContent->OwnerDoc());
if (presShell) {
scaleFactor = double(nsPresContext::AppUnitsPerCSSPixel())/
presShell->GetPresContext()->DeviceContext()->UnscaledAppUnitsPerDevPixel();
}
#endif
*result = scaleFactor;
@ -3787,11 +3447,6 @@ void nsPluginInstanceOwner::SetFrame(nsObjectFrame *aFrame)
container->SetCurrentImageInTransaction(nullptr);
}
// Scroll position listening is only required for Carbon event model plugins on Mac OS X.
#if defined(XP_MACOSX) && !defined(NP_NO_CARBON)
RemoveScrollPositionListener();
#endif
// Make sure the old frame isn't holding a reference to us.
mObjectFrame->SetInstanceOwner(nullptr);
}
@ -3809,11 +3464,6 @@ void nsPluginInstanceOwner::SetFrame(nsObjectFrame *aFrame)
}
mObjectFrame->FixupWindow(mObjectFrame->GetContentRectRelativeToSelf().Size());
mObjectFrame->InvalidateFrame();
// Scroll position listening is only required for Carbon event model plugins on Mac OS X.
#if defined(XP_MACOSX) && !defined(NP_NO_CARBON)
AddScrollPositionListener();
#endif
nsFocusManager* fm = nsFocusManager::GetFocusManager();
const nsIContent* content = aFrame->GetContent();

View File

@ -13,7 +13,6 @@
#include "nsIPluginTagInfo.h"
#include "nsIPrivacyTransitionObserver.h"
#include "nsIDOMEventListener.h"
#include "nsIScrollPositionListener.h"
#include "nsPluginHost.h"
#include "nsPluginNativeWindow.h"
#include "nsWeakReference.h"
@ -48,7 +47,6 @@ class gfxXlibSurface;
class nsPluginInstanceOwner : public nsIPluginInstanceOwner,
public nsIPluginTagInfo,
public nsIDOMEventListener,
public nsIScrollPositionListener,
public nsIPrivacyTransitionObserver,
public nsSupportsWeakReference
{
@ -103,17 +101,7 @@ public:
#elif defined(XP_OS2)
void Paint(const nsRect& aDirtyRect, HPS aHPS);
#endif
#ifdef MAC_CARBON_PLUGINS
void CancelTimer();
void StartTimer(bool isVisible);
#endif
void SendIdleEvent();
// nsIScrollPositionListener interface
virtual void ScrollPositionWillChange(nscoord aX, nscoord aY);
virtual void ScrollPositionDidChange(nscoord aX, nscoord aY);
//locals
nsresult Init(nsIContent* aContent);
@ -275,11 +263,6 @@ private:
bool mFullScreen;
void* mJavaView;
#endif
#if defined(XP_MACOSX) && !defined(NP_NO_CARBON)
void AddScrollPositionListener();
void RemoveScrollPositionListener();
#endif
nsPluginNativeWindow *mPluginWindow;
nsRefPtr<nsNPAPIPluginInstance> mInstance;
@ -317,9 +300,6 @@ private:
#endif
bool mPluginWindowVisible;
bool mPluginDocumentActiveState;
#if defined(XP_MACOSX) && !defined(NP_NO_CARBON)
bool mRegisteredScrollPositionListener;
#endif
uint16_t mNumCachedAttrs;
uint16_t mNumCachedParams;

View File

@ -217,8 +217,20 @@ PluginModuleParent::TimeoutChanged(const char* aPref, void* aModule)
void
PluginModuleParent::CleanupFromTimeout()
{
if (!mShutdown && OkToCleanup())
Close();
if (mShutdown) {
return;
}
if (!OkToCleanup()) {
// there's still plugin code on the C++ stack, try again
MessageLoop::current()->PostDelayedTask(
FROM_HERE,
mTaskFactory.NewRunnableMethod(
&PluginModuleParent::CleanupFromTimeout), 10);
return;
}
Close();
}
#ifdef XP_WIN
@ -288,6 +300,27 @@ GetProcessCpuUsage(const InfallibleTArray<base::ProcessHandle>& processHandles,
} // anonymous namespace
#endif // #ifdef XP_WIN
#ifdef MOZ_CRASHREPORTER_INJECTOR
static bool
CreateFlashMinidump(DWORD processId, ThreadId childThread,
nsIFile* parentMinidump, const nsACString& name)
{
if (processId == 0) {
return false;
}
base::ProcessHandle handle;
if (!base::OpenPrivilegedProcessHandle(processId, &handle)) {
return false;
}
bool res = CreateAdditionalChildMinidump(handle, 0, parentMinidump, name);
base::CloseProcessHandle(handle);
return res;
}
#endif
bool
PluginModuleParent::ShouldContinueFromReplyTimeout()
{
@ -310,19 +343,13 @@ PluginModuleParent::ShouldContinueFromReplyTimeout()
pluginDumpFile) {
nsCOMPtr<nsIFile> childDumpFile;
if (mFlashProcess1 &&
TakeMinidumpForChild(mFlashProcess1,
getter_AddRefs(childDumpFile))) {
if (CreateFlashMinidump(mFlashProcess1, 0, pluginDumpFile,
NS_LITERAL_CSTRING("flash1"))) {
additionalDumps.Append(",flash1");
RenameAdditionalHangMinidump(pluginDumpFile, childDumpFile,
NS_LITERAL_CSTRING("flash1"));
}
if (mFlashProcess2 &&
TakeMinidumpForChild(mFlashProcess2,
getter_AddRefs(childDumpFile))) {
if (CreateFlashMinidump(mFlashProcess2, 0, pluginDumpFile,
NS_LITERAL_CSTRING("flash2"))) {
additionalDumps.Append(",flash2");
RenameAdditionalHangMinidump(pluginDumpFile, childDumpFile,
NS_LITERAL_CSTRING("flash2"));
}
}
#endif

View File

@ -69,20 +69,6 @@ pluginInstanceInit(InstanceData* instanceData)
return NPERR_INCOMPATIBLE_VERSION_ERROR;
}
#ifndef NP_NO_CARBON
// The test plugin will test using Carbon NPAPI if it is available. This
// is simply because we want to test Gecko's Carbon NPAPI support. You can
// override this behavior with an environment variable.
if (!getenv("TEST_COCOA_NPAPI")) {
NPBool supportsCarbonEvents = false;
if ((NPN_GetValue(npp, NPNVsupportsCarbonBool, &supportsCarbonEvents) == NPERR_NO_ERROR) &&
supportsCarbonEvents) {
instanceData->eventModel = NPEventModelCarbon;
return NPERR_NO_ERROR;
}
}
#endif
NPBool supportsCocoaEvents = false;
if ((NPN_GetValue(npp, NPNVsupportsCocoaBool, &supportsCocoaEvents) == NPERR_NO_ERROR) &&
supportsCocoaEvents) {
@ -158,16 +144,7 @@ pluginDraw(InstanceData* instanceData, NPCocoaEvent* event)
NPWindow window = instanceData->window;
CGContextRef cgContext = NULL;
#ifndef NP_NO_CARBON
if (instanceData->eventModel == NPEventModelCocoa) {
cgContext = event->data.draw.context;
} else {
cgContext = ((NP_CGContext*)(window.window))->context;
}
#else
cgContext = event->data.draw.context;
#endif
CGContextRef cgContext = event->data.draw.context;
float windowWidth = window.width;
float windowHeight = window.height;
@ -255,40 +232,6 @@ pluginDraw(InstanceData* instanceData, NPCocoaEvent* event)
int16_t
pluginHandleEvent(InstanceData* instanceData, void* event)
{
#ifndef NP_NO_CARBON
if (instanceData->eventModel == NPEventModelCarbon) {
EventRecord* carbonEvent = (EventRecord*)event;
if (!carbonEvent)
return kNPEventNotHandled;
NPWindow* w = &instanceData->window;
switch (carbonEvent->what) {
case updateEvt:
pluginDraw(instanceData, NULL);
break;
case mouseDown:
case mouseUp:
case osEvt:
{
Rect globalBounds = {0};
WindowRef nativeWindow = static_cast<WindowRef>(static_cast<NP_CGContext*>(w->window)->window);
if (nativeWindow)
::GetWindowBounds(nativeWindow, kWindowStructureRgn, &globalBounds);
instanceData->lastMouseX = carbonEvent->where.h - w->x - globalBounds.left;
instanceData->lastMouseY = carbonEvent->where.v - w->y - globalBounds.top;
if (carbonEvent->what == mouseUp) {
instanceData->mouseUpEventCount++;
}
break;
}
default:
return kNPEventNotHandled;
}
return kNPEventHandled;
}
#endif
NPCocoaEvent* cocoaEvent = (NPCocoaEvent*)event;
if (!cocoaEvent)
return kNPEventNotHandled;

View File

@ -586,7 +586,7 @@ nsresult nsGeolocationService::Init()
#endif
#ifdef MOZ_WIDGET_GONK
provider = GonkGPSGeolocationProvider::GetSingleton();
provider = do_GetService(GONK_GPS_GEOLOCATION_PROVIDER_CONTRACTID);
if (provider) {
mProviders.AppendObject(provider);
}

View File

@ -25,6 +25,12 @@
class nsIThread;
#define GONK_GPS_GEOLOCATION_PROVIDER_CID \
{ 0x48525ec5, 0x5a7f, 0x490a, { 0x92, 0x77, 0xba, 0x66, 0xe0, 0xd2, 0x2c, 0x8b } }
#define GONK_GPS_GEOLOCATION_PROVIDER_CONTRACTID \
"@mozilla.org/gonk-gps-geolocation-provider;1"
class GonkGPSGeolocationProvider : public nsIGeolocationProvider
, public nsIRILDataCallback
{

View File

@ -71,7 +71,10 @@ CPPSRCS += \
$(NULL)
# for our local copy of AudioSystem.h
LOCAL_INCLUDES += -I$(topsrcdir)/media/libsydneyaudio/src
EXPORTS = nsVolume.h
EXPORTS = \
nsVolume.h \
GonkGPSGeolocationProvider.h \
$(NULL)
endif
EXTRA_COMPONENTS = \

View File

@ -129,6 +129,7 @@ MOCHITEST_FILES = \
test_bug750051.html \
test_bug755320.html \
test_bug777628.html \
test_bug665548.html \
$(NULL)
ifneq (Linux,$(OS_ARCH))

View File

@ -0,0 +1,29 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=665548
-->
<head>
<title>Test for Bug 665548</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<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=665548">Mozilla Bug 665548</a>
<p id="display"></p>
<div id="content" style="display: none">
<iframe name='location'></iframe>
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 665548 **/
isnot(window.location, window.frames[0],
"window.location shouldn't be the frame named location");
</script>
</pre>
</body>
</html>

View File

@ -1,12 +1,13 @@
<!DOCTYPE html>
<html>
<body>
</body>
<script>
dump("\n frame created \n\n");
addEventListener('message', function(e) {
if (e.data == 'clear') {
navigator.mozApps.getSelf().onsuccess = function() {
dump("\n clearing browser data \n\n");
this.result.clearBrowserData();
document.body.innerHTML = "<done></done>";
};
}
});

View File

@ -191,36 +191,44 @@ function browserLoadEvent() {
setupStorage(gBrowserStorage.localStorage);
setupStorage(gBrowserStorage.sessionStorage);
dump("\n send message to iframe \n\n");
frames[1].postMessage("clear", "http://www.example.com");
waitForClearBrowserData();
};
function waitForClearBrowserData() {
SimpleTest.executeSoon(function() {
dump("\n call getAll() \n\n");
navigator.mozApps.mgmt.getAll().onsuccess = function() {
dump("\n get getAll() results \n\n");
for (i in this.result) {
var app = this.result[i];
if (app.manifestURL == gManifestURL) {
is(gBrowserStorage.localStorage.getItem("foo"), null, "localstorage data have been deleted");
is(gBrowserStorage.sessionStorage.getItem("foo"), "bar", "sessionstorage data have not been deleted");
is(gAppStorage.localStorage.getItem("foo"), "bar", "data are still there");
is(gAppStorage.sessionStorage.getItem("foo"), "bar", "data are still there");
is(gWitnessStorage.localStorage.getItem("foo"), "bar", "data are still there");
is(gWitnessStorage.sessionStorage.getItem("foo"), "bar", "data are still there");
Webapps.DOMApplicationRegistry.allAppsLaunchable = gPreviousLaunchableValue;
// Now we uninstall the app and make sure everything is clean.
app.uninstall().onsuccess = function() {
finish();
};
}
}
};
if (frames[1].document.getElementsByTagName('done').length == 0) {
waitForClearBrowserData();
} else {
checks();
}
});
}
function checks() {
navigator.mozApps.mgmt.getAll().onsuccess = function() {
for (i in this.result) {
var app = this.result[i];
if (app.manifestURL == gManifestURL) {
is(gBrowserStorage.localStorage.getItem("foo"), null, "localstorage data have been deleted");
is(gBrowserStorage.sessionStorage.getItem("foo"), "bar", "sessionstorage data have not been deleted");
is(gAppStorage.localStorage.getItem("foo"), "bar", "data are still there");
is(gAppStorage.sessionStorage.getItem("foo"), "bar", "data are still there");
is(gWitnessStorage.localStorage.getItem("foo"), "bar", "data are still there");
is(gWitnessStorage.sessionStorage.getItem("foo"), "bar", "data are still there");
Webapps.DOMApplicationRegistry.allAppsLaunchable = gPreviousLaunchableValue;
// Now we uninstall the app and make sure everything is clean.
app.uninstall().onsuccess = function() {
finish();
};
}
}
};
}
/**
* This method will be called when the test will be done. It is going to clear

View File

@ -0,0 +1,13 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/.
*/
interface MediaStream;
[NoInterfaceObject]
interface MediaStreamList {
getter MediaStream? (unsigned long index);
readonly attribute unsigned long length;
};

Some files were not shown because too many files have changed in this diff Show More