Merge the last PGO-green inbound changeset to m-c.

This commit is contained in:
Ryan VanderMeulen 2013-05-16 16:16:42 -04:00
commit 819ece47cb
395 changed files with 4686 additions and 2510 deletions

View File

@ -1,48 +0,0 @@
#
# 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/.
DEPTH = @DEPTH@
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
LIBRARY_NAME = accessibility
EXPORT_LIBRARY = 1
IS_COMPONENT = 1
MODULE_NAME = nsAccessibilityModule
LIBXUL_LIBRARY = 1
CPPSRCS = nsAccessibilityFactory.cpp
LOCAL_INCLUDES = -I$(srcdir)/../src
SHARED_LIBRARY_LIBS = \
../src/base/$(LIB_PREFIX)accessibility_base_s.$(LIB_SUFFIX) \
../src/generic/$(LIB_PREFIX)accessibility_generic_s.$(LIB_SUFFIX) \
../src/html/$(LIB_PREFIX)accessibility_html_s.$(LIB_SUFFIX) \
../src/xpcom/$(LIB_PREFIX)accessibility_xpcom_s.$(LIB_SUFFIX) \
$(NULL)
ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
SHARED_LIBRARY_LIBS += \
../src/windows/msaa/$(LIB_PREFIX)accessibility_toolkit_msaa_s.$(LIB_SUFFIX) \
../src/windows/ia2/$(LIB_PREFIX)accessibility_toolkit_ia2_s.$(LIB_SUFFIX) \
../src/windows/sdn/$(LIB_PREFIX)accessibility_toolkit_sdn_s.$(LIB_SUFFIX) \
../src/windows/uia/$(LIB_PREFIX)accessibility_toolkit_uia_s.$(LIB_SUFFIX) \
$(NULL)
else
SHARED_LIBRARY_LIBS += \
../src/$(LIB_PREFIX)accessibility_toolkit_s.$(LIB_SUFFIX) \
$(NULL)
endif
ifdef MOZ_XUL
SHARED_LIBRARY_LIBS += ../src/xul/$(LIB_PREFIX)accessibility_xul_s.$(LIB_SUFFIX)
endif
include $(topsrcdir)/config/rules.mk

View File

@ -1,8 +0,0 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.
MODULE = 'accessibility'

View File

@ -1,53 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* 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/. */
#include "nsCOMPtr.h"
#include "mozilla/ModuleUtils.h"
#include "nsIServiceManager.h"
#include "nsIComponentManager.h"
#include "nsIAccessibilityService.h"
#include "nsIAccessibleRetrieval.h"
#include "nscore.h"
static nsresult
NS_ConstructAccessibilityService(nsISupports *aOuter, REFNSIID aIID, void **aResult)
{
nsresult rv;
NS_ASSERTION(aOuter == nullptr, "no aggregation");
nsIAccessibilityService* accessibility;
rv = NS_GetAccessibilityService(&accessibility);
if (NS_FAILED(rv)) {
NS_ERROR("Unable to construct accessibility service");
return rv;
}
rv = accessibility->QueryInterface(aIID, aResult);
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to find correct interface");
NS_RELEASE(accessibility);
return rv;
}
NS_DEFINE_NAMED_CID(NS_ACCESSIBILITY_SERVICE_CID);
static const mozilla::Module::CIDEntry kA11yCIDs[] = {
{ &kNS_ACCESSIBILITY_SERVICE_CID, false, nullptr, NS_ConstructAccessibilityService },
{ nullptr }
};
static const mozilla::Module::ContractIDEntry kA11yContracts[] = {
{ "@mozilla.org/accessibilityService;1", &kNS_ACCESSIBILITY_SERVICE_CID },
{ "@mozilla.org/accessibleRetrieval;1", &kNS_ACCESSIBILITY_SERVICE_CID },
{ nullptr }
};
static const mozilla::Module kA11yModule = {
mozilla::Module::kVersion,
kA11yCIDs,
kA11yContracts
};
NSMODULE_DEFN(nsAccessibilityModule) = &kA11yModule;

View File

@ -1,3 +0,0 @@
ifeq ($(OS_TARGET),WINNT)
NO_PROFILE_GUIDED_OPTIMIZE := 1 # Don't PGO
endif

View File

@ -4,7 +4,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/.
DIRS += ['public', 'src', 'build']
DIRS += ['public', 'src']
TEST_DIRS += ['tests']
MODULE = 'accessibility'

View File

@ -110,52 +110,69 @@ AccGroupInfo::AccGroupInfo(Accessible* aItem, role aRole) :
if (IsConceptualParent(aRole, parentRole))
mParent = parent;
// In the case of ARIA tree (not ARIA treegrid) a tree can be arranged by
// using ARIA groups to organize levels. In this case the parent of the tree
// item will be a group and the previous treeitem of that should be the tree
// item parent.
if (parentRole != roles::GROUPING || aRole != roles::OUTLINEITEM)
// ARIA tree and list can be arranged by using ARIA groups to organize levels.
if (parentRole != roles::GROUPING)
return;
Accessible* parentPrevSibling = parent->PrevSibling();
if (!parentPrevSibling)
return;
roles::Role parentPrevSiblingRole = parentPrevSibling->Role();
if (parentPrevSiblingRole == roles::TEXT_LEAF) {
// XXX Sometimes an empty text accessible is in the hierarchy here,
// although the text does not appear to be rendered, GetRenderedText()
// says that it is so we need to skip past it to find the true
// previous sibling.
parentPrevSibling = parentPrevSibling->PrevSibling();
if (parentPrevSibling)
parentPrevSiblingRole = parentPrevSibling->Role();
// Way #1 for ARIA tree (not ARIA treegrid): previous sibling of a group is a
// parent. In other words the parent of the tree item will be a group and
// the previous tree item of the group is a conceptual parent of the tree
// item.
if (aRole == roles::OUTLINEITEM) {
Accessible* parentPrevSibling = parent->PrevSibling();
if (parentPrevSibling && parentPrevSibling->Role() == aRole) {
mParent = parentPrevSibling;
return;
}
}
// Previous sibling of parent group is a tree item, this is the
// conceptual tree item parent.
if (parentPrevSiblingRole == roles::OUTLINEITEM)
mParent = parentPrevSibling;
// Way #2 for ARIA list and tree: group is a child of an item. In other words
// the parent of the item will be a group and containing item of the group is
// a conceptual parent of the item.
if (aRole == roles::LISTITEM || aRole == roles::OUTLINEITEM) {
Accessible* grandParent = parent->Parent();
if (grandParent && grandParent->Role() == aRole)
mParent = grandParent;
}
}
Accessible*
AccGroupInfo::FirstItemOf(Accessible* aContainer)
{
// ARIA trees can be arranged by ARIA groups, otherwise aria-level works.
// ARIA tree can be arranged by ARIA groups case #1 (previous sibling of a
// group is a parent) or by aria-level.
a11y::role containerRole = aContainer->Role();
Accessible* item = aContainer->NextSibling();
if (item) {
if (containerRole == roles::OUTLINEITEM && item->Role() == roles::GROUPING)
item = item->FirstChild();
AccGroupInfo* itemGroupInfo = item->GetGroupInfo();
if (itemGroupInfo && itemGroupInfo->ConceptualParent() == aContainer)
return item;
if (item) {
AccGroupInfo* itemGroupInfo = item->GetGroupInfo();
if (itemGroupInfo && itemGroupInfo->ConceptualParent() == aContainer)
return item;
}
}
// ARIA list and tree can be arranged by ARIA groups case #2 (group is
// a child of an item).
item = aContainer->LastChild();
if (!item)
return nullptr;
if (item->Role() == roles::GROUPING &&
(containerRole == roles::LISTITEM || containerRole == roles::OUTLINEITEM)) {
item = item->FirstChild();
if (item) {
AccGroupInfo* itemGroupInfo = item->GetGroupInfo();
if (itemGroupInfo && itemGroupInfo->ConceptualParent() == aContainer)
return item;
}
}
// Otherwise it can be a direct child.
item = aContainer->FirstChild();
if (item && IsConceptualParent(BaseRole(item->Role()), containerRole))
if (IsConceptualParent(BaseRole(item->Role()), containerRole))
return item;
return nullptr;

View File

@ -2024,7 +2024,8 @@ Accessible::RelationByType(uint32_t aType)
// This is an ARIA tree or treegrid that doesn't use owns, so we need to
// get the parent the hard way.
if (mRoleMapEntry && (mRoleMapEntry->role == roles::OUTLINEITEM ||
if (mRoleMapEntry && (mRoleMapEntry->role == roles::OUTLINEITEM ||
mRoleMapEntry->role == roles::LISTITEM ||
mRoleMapEntry->role == roles::ROW)) {
rel.AppendTarget(GetGroupInfo()->ConceptualParent());
}
@ -2055,8 +2056,10 @@ Accessible::RelationByType(uint32_t aType)
// also can be organized by groups.
if (mRoleMapEntry &&
(mRoleMapEntry->role == roles::OUTLINEITEM ||
mRoleMapEntry->role == roles::LISTITEM ||
mRoleMapEntry->role == roles::ROW ||
mRoleMapEntry->role == roles::OUTLINE ||
mRoleMapEntry->role == roles::LIST ||
mRoleMapEntry->role == roles::TREE_TABLE)) {
rel.AppendIter(new ItemIterator(this));
}
@ -3256,10 +3259,11 @@ Accessible::GetLevelInternal()
}
} else if (role == roles::LISTITEM) {
// Expose 'level' attribute on nested lists. We assume nested list is a last
// child of listitem of parent list. We don't handle the case when nested
// lists have more complex structure, for example when there are accessibles
// between parent listitem and nested list.
// Expose 'level' attribute on nested lists. We support two hierarchies:
// a) list -> listitem -> list -> listitem (nested list is a last child
// of listitem of the parent list);
// b) list -> listitem -> group -> listitem (nested listitems are contained
// by group that is a last child of the parent listitem).
// Calculate 'level' attribute based on number of parent listitems.
level = 0;
@ -3269,9 +3273,8 @@ Accessible::GetLevelInternal()
if (parentRole == roles::LISTITEM)
++ level;
else if (parentRole != roles::LIST)
else if (parentRole != roles::LIST && parentRole != roles::GROUPING)
break;
}
if (level == 0) {
@ -3283,8 +3286,11 @@ Accessible::GetLevelInternal()
Accessible* sibling = parent->GetChildAt(siblingIdx);
Accessible* siblingChild = sibling->LastChild();
if (siblingChild && siblingChild->Role() == roles::LIST)
return 1;
if (siblingChild) {
roles::Role lastChildRole = siblingChild->Role();
if (lastChildRole == roles::LIST || lastChildRole == roles::GROUPING)
return 1;
}
}
} else {
++ level; // level is 1-index based

View File

@ -68,7 +68,7 @@
testGroupAttrs("li9", 3, 3);
//////////////////////////////////////////////////////////////////////////
// ARIA list (nested lists)
// ARIA list (nested lists: list -> listitem -> list -> listitem)
testGroupAttrs("li10", 1, 3, 1);
testGroupAttrs("li11", 2, 3, 1);
testGroupAttrs("li12", 3, 3, 1);
@ -77,6 +77,15 @@
testGroupAttrs("n_li11", 2, 3, 2);
testGroupAttrs("n_li12", 3, 3, 2);
//////////////////////////////////////////////////////////////////////////
// ARIA list (nested lists: list -> listitem -> group -> listitem)
testGroupAttrs("lgt_li1", 1, 2, 1);
testGroupAttrs("lgt_li1_nli1", 1, 2, 2);
testGroupAttrs("lgt_li1_nli2", 2, 2, 2);
testGroupAttrs("lgt_li2", 2, 2, 1);
testGroupAttrs("lgt_li2_nli1", 1, 2, 2);
testGroupAttrs("lgt_li2_nli2", 2, 2, 2);
//////////////////////////////////////////////////////////////////////////
// ARIA menu (menuitem, separator, menuitemradio and menuitemcheckbox)
testGroupAttrs("menu_item1", 1, 2);
@ -110,6 +119,24 @@
testGroupAttrs("ti7", 3, 3, 2);
testGroupAttrs("ti8", 3, 3, 1);
//////////////////////////////////////////////////////////////////////////
// ARIA tree (tree -> treeitem -> group -> treeitem)
testGroupAttrs("tree2_ti1", 1, 2, 1);
testGroupAttrs("tree2_ti1a", 1, 2, 2);
testGroupAttrs("tree2_ti1b", 2, 2, 2);
testGroupAttrs("tree2_ti2", 2, 2, 1);
testGroupAttrs("tree2_ti2a", 1, 2, 2);
testGroupAttrs("tree2_ti2b", 2, 2, 2);
//////////////////////////////////////////////////////////////////////////
// ARIA tree (tree -> treeitem, group -> treeitem)
testGroupAttrs("tree3_ti1", 1, 2, 1);
testGroupAttrs("tree3_ti1a", 1, 2, 2);
testGroupAttrs("tree3_ti1b", 2, 2, 2);
testGroupAttrs("tree3_ti2", 2, 2, 1);
testGroupAttrs("tree3_ti2a", 1, 2, 2);
testGroupAttrs("tree3_ti2b", 2, 2, 2);
//////////////////////////////////////////////////////////////////////////
// ARIA grid
testGroupAttrs("grid_row1", 1, 2);
@ -164,6 +191,11 @@
title="Expose level for nested lists in HTML">
Mozilla Bug 468418
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=864224"
title="Support nested ARIA listitems structured by role='group'">
Bug 864224
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
@ -228,6 +260,21 @@
</span>
</span>
<div role="list">
<div role="listitem" id="lgt_li1">Item 1
<div role="group">
<div role="listitem" id="lgt_li1_nli1">Item 1A</div>
<div role="listitem" id="lgt_li1_nli2">Item 1B</div>
</div>
</div>
<div role="listitem" id="lgt_li2">Item 2
<div role="group">
<div role="listitem" id="lgt_li2_nli1">Item 2A</div>
<div role="listitem" id="lgt_li2_nli2">Item 2B</div>
</div>
</div>
</div>
<ul role="menubar">
<li role="menuitem" aria-haspopup="true" id="menu_item1">File
<ul role="menu">
@ -283,6 +330,34 @@
</tr>
</table>
<ul role="tree">
<li role="treeitem" id="tree2_ti1">Item 1
<ul role="group">
<li role="treeitem" id="tree2_ti1a">Item 1A</li>
<li role="treeitem" id="tree2_ti1b">Item 1B</li>
</ul>
</li>
<li role="treeitem" id="tree2_ti2">Item 2
<ul role="group">
<li role="treeitem" id="tree2_ti2a">Item 2A</li>
<li role="treeitem" id="tree2_ti2b">Item 2B</li>
</ul>
</li>
</div>
<div role="tree">
<div role="treeitem" id="tree3_ti1">Item 1</div>
<div role="group">
<li role="treeitem" id="tree3_ti1a">Item 1A</li>
<li role="treeitem" id="tree3_ti1b">Item 1B</li>
</div>
<div role="treeitem" id="tree3_ti2">Item 2</div>
<div role="group">
<div role="treeitem" id="tree3_ti2a">Item 2A</div>
<div role="treeitem" id="tree3_ti2b">Item 2B</div>
</div>
</div>
<table role="grid">
<tr role="row" id="grid_row1">
<td role="gridcell" id="grid_cell1">cell1</td>

View File

@ -73,12 +73,20 @@
testRelation("treeitem5", RELATION_NODE_CHILD_OF, "treeitem4");
testRelation("treeitem6", RELATION_NODE_CHILD_OF, "tree");
testRelation("treeitem7", RELATION_NODE_CHILD_OF, "treeitem6");
testRelation("tree2_ti1", RELATION_NODE_CHILD_OF, "tree2");
testRelation("tree2_ti1a", RELATION_NODE_CHILD_OF, "tree2_ti1");
testRelation("tree2_ti1b", RELATION_NODE_CHILD_OF, "tree2_ti1");
// 'node child of' relation for row role of treegrid
testRelation("treegridrow1", RELATION_NODE_CHILD_OF, "treegrid");
testRelation("treegridrow2", RELATION_NODE_CHILD_OF, "treegrid");
testRelation("treegridrow3", RELATION_NODE_CHILD_OF, "treegridrow2");
// 'node child of' relation for lists organized by groups
testRelation("listitem1", RELATION_NODE_CHILD_OF, "list");
testRelation("listitem1.1", RELATION_NODE_CHILD_OF, "listitem1");
testRelation("listitem1.2", RELATION_NODE_CHILD_OF, "listitem1");
// 'node child of' relation for the document having window, returns
// direct accessible parent (fixed in bug 419770).
var iframeElmObj = {};
@ -95,11 +103,20 @@
"treeitem5"); // aria-level
testRelation("treeitem6", RELATION_NODE_PARENT_OF,
"treeitem7"); // // group role
testRelation("tree2", RELATION_NODE_PARENT_OF, "tree2_ti1"); // group role
testRelation("tree2_ti1", RELATION_NODE_PARENT_OF,
["tree2_ti1a", "tree2_ti1b"]); // group role
testRelation("treegridrow2", RELATION_NODE_PARENT_OF, "treegridrow3");
testRelation("treegrid", RELATION_NODE_PARENT_OF,
["treegridrow1", "treegridrow2"]);
// 'node parent of' relation on ARIA list structured by groups
testRelation("list", RELATION_NODE_PARENT_OF,
"listitem1");
testRelation("listitem1", RELATION_NODE_PARENT_OF,
[ "listitem1.1", "listitem1.2" ]);
// aria-controls
getAccessible("tab");
todo(false,
@ -178,6 +195,11 @@
title="HTML select options gets relation from containing label">
Bug 687393
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=864224"
title="Support nested ARIA listitems structured by role='group'">
Bug 864224
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
@ -253,6 +275,15 @@
</div>
</div>
<ul role="tree" id="tree2">
<li role="treeitem" id="tree2_ti1">Item 1
<ul role="group">
<li role="treeitem" id="tree2_ti1a">Item 1A</li>
<li role="treeitem" id="tree2_ti1b">Item 1B</li>
</ul>
</li>
</ul>
<div role="treegrid" id="treegrid">
<div role="row" id="treegridrow1">
<span role="gridcell">cell1</span><span role="gridcell">cell2</span>
@ -265,6 +296,15 @@
</div>
</div>
<div role="list" id="list">
<div role="listitem" id="listitem1">Item 1
<div role="group">
<div role="listitem" id="listitem1.1">Item 1A</div>
<div role="listitem" id="listitem1.2">Item 1B</div>
</div>
</div>
</div>
<iframe id="iframe"></iframe>
<div id="tablist" role="tablist">

View File

@ -513,11 +513,11 @@ var gPluginHandler = {
// only show notification for small subset of plugins
let mimetype = pluginInfo.mimetype.split(";")[0];
if (!this.canInstallThisMimeType(mimetype))
return;
return false;
let pluginIdentifier = this.nameForSupportedPlugin(mimetype);
if (!pluginIdentifier)
return;
return false;
let displayName = this.supportedPlugins.plugins[pluginIdentifier].displayName;

View File

@ -4616,6 +4616,9 @@ var TabsInTitlebar = {
},
_update: function () {
function $(id) document.getElementById(id);
function rect(ele) ele.getBoundingClientRect();
if (!this._initialized || window.fullScreen)
return;
@ -4628,12 +4631,9 @@ var TabsInTitlebar = {
if (allowed == this.enabled)
return;
function $(id) document.getElementById(id);
let titlebar = $("titlebar");
if (allowed) {
function rect(ele) ele.getBoundingClientRect();
let tabsToolbar = $("TabsToolbar");
#ifdef MENUBAR_CAN_AUTOHIDE

View File

@ -64,6 +64,9 @@ _BROWSER_FILES = \
head.js \
browser_typeAheadFind.js \
browser_keywordSearch.js \
browser_keywordSearch_postData.js \
POSTSearchEngine.xml \
print_postdata.sjs \
browser_alltabslistener.js \
browser_bug304198.js \
title_test.svg \

View File

@ -0,0 +1,6 @@
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
<ShortName>POST Search</ShortName>
<Url type="text/html" method="POST" template="http://mochi.test:8888/browser/browser/base/content/test/print_postdata.sjs">
<Param name="searchterms" value="{searchTerms}"/>
</Url>
</OpenSearchDescription>

View File

@ -2,6 +2,8 @@ const gTestRoot = getRootDirectory(gTestPath);
const gStyleSheet = "bug839103.css";
var gTab = null;
var needsInitialApplicableStateEvent = false;
var needsInitialApplicableStateEventFor = null;
function test() {
waitForExplicitFinish();
@ -13,6 +15,7 @@ function test() {
function initialStylesheetAdded(evt) {
gBrowser.removeEventListener("StyleSheetAdded", initialStylesheetAdded, true);
ok(true, "received initial style sheet event");
is(evt.type, "StyleSheetAdded", "evt.type has expected value");
is(evt.target, gBrowser.contentDocument, "event targets correct document");
ok(evt.stylesheet, "evt.stylesheet is defined");
ok(evt.stylesheet.toString().contains("CSSStyleSheet"), "evt.stylesheet is a stylesheet");
@ -36,10 +39,13 @@ function continueTest() {
info("continuing test");
let doc = gBrowser.contentDocument;
doc.styleSheetChangeEventsEnabled = true;
doc.addEventListener("StyleSheetAdded", unexpectedContentEvent, false);
doc.addEventListener("StyleSheetRemoved", unexpectedContentEvent, false);
doc.addEventListener("StyleSheetApplicableStateChanged", unexpectedContentEvent, false);
doc.defaultView.addEventListener("StyleSheetAdded", unexpectedContentEvent, false);
doc.defaultView.addEventListener("StyleSheetRemoved", unexpectedContentEvent, false);
doc.defaultView.addEventListener("StyleSheetApplicableStateChanged", unexpectedContentEvent, false);
let link = doc.createElement('link');
link.setAttribute('rel', 'stylesheet');
link.setAttribute('type', 'text/css');
@ -47,16 +53,39 @@ function continueTest() {
gLinkElement = link;
gBrowser.addEventListener("StyleSheetAdded", dynamicStylesheetAdded, true);
gBrowser.addEventListener("StyleSheetApplicableStateChanged", dynamicStylesheetApplicableStateChanged, true);
doc.body.appendChild(link);
}
function dynamicStylesheetAdded(evt) {
gBrowser.removeEventListener("StyleSheetAdded", dynamicStylesheetAdded, true);
ok(true, "received dynamic style sheet event");
is(evt.type, "StyleSheetAdded", "evt.type has expected value");
is(evt.target, gBrowser.contentDocument, "event targets correct document");
ok(evt.stylesheet, "evt.stylesheet is defined");
ok(evt.stylesheet.toString().contains("CSSStyleSheet"), "evt.stylesheet is a stylesheet");
ok(evt.documentSheet, "style sheet is a document sheet");
}
function dynamicStylesheetApplicableStateChanged(evt) {
gBrowser.removeEventListener("StyleSheetApplicableStateChanged", dynamicStylesheetApplicableStateChanged, true);
ok(true, "received dynamic style sheet applicable state change event");
is(evt.type, "StyleSheetApplicableStateChanged", "evt.type has expected value");
is(evt.target, gBrowser.contentDocument, "event targets correct document");
is(evt.stylesheet, gLinkElement.sheet, "evt.stylesheet has the right value");
is(evt.applicable, true, "evt.applicable has the right value");
gBrowser.addEventListener("StyleSheetApplicableStateChanged", dynamicStylesheetApplicableStateChangedToFalse, true);
gLinkElement.disabled = true;
}
function dynamicStylesheetApplicableStateChangedToFalse(evt) {
gBrowser.removeEventListener("StyleSheetApplicableStateChanged", dynamicStylesheetApplicableStateChangedToFalse, true);
is(evt.type, "StyleSheetApplicableStateChanged", "evt.type has expected value");
ok(true, "received dynamic style sheet applicable state change event after media=\"\" changed");
is(evt.target, gBrowser.contentDocument, "event targets correct document");
is(evt.stylesheet, gLinkElement.sheet, "evt.stylesheet has the right value");
is(evt.applicable, false, "evt.applicable has the right value");
gBrowser.addEventListener("StyleSheetRemoved", dynamicStylesheetRemoved, true);
gBrowser.contentDocument.body.removeChild(gLinkElement);
@ -65,10 +94,53 @@ function dynamicStylesheetAdded(evt) {
function dynamicStylesheetRemoved(evt) {
gBrowser.removeEventListener("StyleSheetRemoved", dynamicStylesheetRemoved, true);
ok(true, "received dynamic style sheet removal");
is(evt.type, "StyleSheetRemoved", "evt.type has expected value");
is(evt.target, gBrowser.contentDocument, "event targets correct document");
ok(evt.stylesheet, "evt.stylesheet is defined");
ok(evt.stylesheet.toString().contains("CSSStyleSheet"), "evt.stylesheet is a stylesheet");
ok(evt.stylesheet.href.contains(gStyleSheet), "evt.stylesheet is the removed stylesheet");
gBrowser.addEventListener("StyleRuleAdded", styleRuleAdded, true);
gBrowser.contentDocument.querySelector("style").sheet.insertRule("*{color:black}", 0);
}
function styleRuleAdded(evt) {
gBrowser.removeEventListener("StyleRuleAdded", styleRuleAdded, true);
ok(true, "received style rule added event");
is(evt.type, "StyleRuleAdded", "evt.type has expected value");
is(evt.target, gBrowser.contentDocument, "event targets correct document");
ok(evt.stylesheet, "evt.stylesheet is defined");
ok(evt.stylesheet.toString().contains("CSSStyleSheet"), "evt.stylesheet is a stylesheet");
ok(evt.rule, "evt.rule is defined");
is(evt.rule.cssText, "* { color: black; }", "evt.rule.cssText has expected value");
gBrowser.addEventListener("StyleRuleChanged", styleRuleChanged, true);
evt.rule.style.cssText = "color:green";
}
function styleRuleChanged(evt) {
gBrowser.removeEventListener("StyleRuleChanged", styleRuleChanged, true);
ok(true, "received style rule changed event");
is(evt.type, "StyleRuleChanged", "evt.type has expected value");
is(evt.target, gBrowser.contentDocument, "event targets correct document");
ok(evt.stylesheet, "evt.stylesheet is defined");
ok(evt.stylesheet.toString().contains("CSSStyleSheet"), "evt.stylesheet is a stylesheet");
ok(evt.rule, "evt.rule is defined");
is(evt.rule.cssText, "* { color: green; }", "evt.rule.cssText has expected value");
gBrowser.addEventListener("StyleRuleRemoved", styleRuleRemoved, true);
evt.stylesheet.deleteRule(0);
}
function styleRuleRemoved(evt) {
gBrowser.removeEventListener("StyleRuleRemoved", styleRuleRemoved, true);
ok(true, "received style rule removed event");
is(evt.type, "StyleRuleRemoved", "evt.type has expected value");
is(evt.target, gBrowser.contentDocument, "event targets correct document");
ok(evt.stylesheet, "evt.stylesheet is defined");
ok(evt.stylesheet.toString().contains("CSSStyleSheet"), "evt.stylesheet is a stylesheet");
ok(evt.rule, "evt.rule is defined");
executeSoon(concludeTest);
}
@ -76,10 +148,12 @@ function concludeTest() {
let doc = gBrowser.contentDocument;
doc.removeEventListener("StyleSheetAdded", unexpectedContentEvent, false);
doc.removeEventListener("StyleSheetRemoved", unexpectedContentEvent, false);
doc.removeEventListener("StyleSheetApplicableStateChanged", unexpectedContentEvent, false);
doc.defaultView.removeEventListener("StyleSheetAdded", unexpectedContentEvent, false);
doc.defaultView.removeEventListener("StyleSheetRemoved", unexpectedContentEvent, false);
doc.defaultView.removeEventListener("StyleSheetApplicableStateChanged", unexpectedContentEvent, false);
gBrowser.removeCurrentTab();
gLinkElement = null;
gTab = null;
finish();
}
}

View File

@ -0,0 +1,94 @@
/**
* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
**/
var gTests = [
{
name: "normal search (search service)",
testText: "test search",
expectText: "test+search"
},
{
name: "?-prefixed search (search service)",
testText: "? foo ",
expectText: "foo"
}
];
function test() {
waitForExplicitFinish();
let tab = gBrowser.selectedTab = gBrowser.addTab();
let searchObserver = function search_observer(aSubject, aTopic, aData) {
let engine = aSubject.QueryInterface(Ci.nsISearchEngine);
info("Observer: " + aData + " for " + engine.name);
if (aData != "engine-added")
return;
if (engine.name != "POST Search")
return;
Services.search.defaultEngine = engine;
registerCleanupFunction(function () {
Services.search.removeEngine(engine);
});
// ready to execute the tests!
executeSoon(nextTest);
};
Services.obs.addObserver(searchObserver, "browser-search-engine-modified", false);
registerCleanupFunction(function () {
gBrowser.removeTab(tab);
Services.obs.removeObserver(searchObserver, "browser-search-engine-modified");
});
Services.search.addEngine("http://test:80/browser/browser/base/content/test/POSTSearchEngine.xml",
Ci.nsISearchEngine.DATA_XML, null, false);
}
var gCurrTest;
function nextTest() {
if (gTests.length) {
gCurrTest = gTests.shift();
doTest();
} else {
finish();
}
}
function doTest() {
info("Running test: " + gCurrTest.name);
waitForLoad(function () {
let loadedText = gBrowser.contentDocument.body.textContent;
ok(loadedText, "search page loaded");
let needle = "searchterms=" + gCurrTest.expectText;
is(loadedText, needle, "The query POST data should be returned in the response");
nextTest();
});
// Simulate a user entering search terms
gURLBar.value = gCurrTest.testText;
gURLBar.focus();
EventUtils.synthesizeKey("VK_RETURN", {});
}
function waitForLoad(cb) {
let browser = gBrowser.selectedBrowser;
browser.addEventListener("load", function listener() {
if (browser.currentURI.spec == "about:blank")
return;
info("Page loaded: " + browser.currentURI.spec);
browser.removeEventListener("load", listener, true);
cb();
}, true);
}

View File

@ -0,0 +1,22 @@
const CC = Components.Constructor;
const BinaryInputStream = CC("@mozilla.org/binaryinputstream;1",
"nsIBinaryInputStream",
"setInputStream");
function handleRequest(request, response) {
response.setHeader("Content-Type", "text/plain", false);
if (request.method == "GET") {
response.write(request.queryString);
} else {
var body = new BinaryInputStream(request.bodyInputStream);
var avail;
var bytes = [];
while ((avail = body.available()) > 0)
Array.prototype.push.apply(bytes, body.readByteArray(avail));
var data = String.fromCharCode.apply(null, bytes);
response.bodyOutputStream.write(data, data.length);
}
}

View File

@ -3,6 +3,7 @@
<head>
<title>Document for Bug 839103</title>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<style></style>
</head>
<body>
</body>

View File

@ -144,6 +144,9 @@ const WebProgress = {
this._progressActive = true;
// display the track
Elements.progressContainer.removeAttribute("collapsed");
// 'Whoosh' in
this._progressCount = kProgressMarginStart;
Elements.progress.style.width = this._progressCount + "%";
@ -198,6 +201,7 @@ const WebProgress = {
// Close out fade finished, reset
if (data.propertyName == "opacity") {
Elements.progress.style.width = "0px";
Elements.progressContainer.setAttribute("collapsed", true);
}
},
};

View File

@ -46,6 +46,7 @@ let Elements = {};
["appbar", "appbar"],
["contentViewport", "content-viewport"],
["progress", "progress-control"],
["progressContainer", "progress-container"],
["contentNavigator", "content-navigator"],
["aboutFlyout", "about-flyoutpanel"],
["prefsFlyout", "prefs-flyoutpanel"],

View File

@ -435,8 +435,7 @@ var Browser = {
addTab: function browser_addTab(aURI, aBringFront, aOwner, aParams) {
let params = aParams || {};
let newTab = new Tab(aURI, params);
newTab.owner = aOwner || null;
let newTab = new Tab(aURI, params, aOwner);
this._tabs.push(newTab);
if (aBringFront)
@ -1382,7 +1381,7 @@ function showDownloadManager(aWindowContext, aID, aReason) {
// TODO: select the download with aID
}
function Tab(aURI, aParams) {
function Tab(aURI, aParams, aOwner) {
this._id = null;
this._browser = null;
this._notification = null;
@ -1391,7 +1390,7 @@ function Tab(aURI, aParams) {
this._metadata = null;
this._eventDeferred = null;
this.owner = null;
this.owner = aOwner || null;
this.hostChanged = false;
this.state = null;
@ -1402,7 +1401,7 @@ function Tab(aURI, aParams) {
// aParams is an object that contains some properties for the initial tab
// loading like flags, a referrerURI, a charset or even a postData.
this.create(aURI, aParams || {});
this.create(aURI, aParams || {}, aOwner);
// default tabs to inactive (i.e. no display port)
this.active = false;
@ -1526,7 +1525,7 @@ Tab.prototype = {
return this._loading;
},
create: function create(aURI, aParams) {
create: function create(aURI, aParams, aOwner) {
this._eventDeferred = Promise.defer();
this._chromeTab = Elements.tabList.addTab();
@ -1543,6 +1542,8 @@ Tab.prototype = {
}
browser.addEventListener("pageshow", onPageShowEvent, true);
if (aOwner)
this._copyHistoryFrom(aOwner);
this._loadUsingParams(browser, aURI, aParams);
},
@ -1576,6 +1577,17 @@ Tab.prototype = {
browser.__SS_restore = true;
},
_copyHistoryFrom: function _copyHistoryFrom(tab) {
let otherHistory = tab._browser._webNavigation.sessionHistory;
let history = this._browser._webNavigation.sessionHistory;
// Ensure that history is initialized
history.QueryInterface(Ci.nsISHistoryInternal);
for (let i = 0, length = otherHistory.index; i <= length; i++)
history.addEntry(otherHistory.getEntryAtIndex(i, false), true);
},
_loadUsingParams: function _loadUsingParams(aBrowser, aURI, aParams) {
let flags = aParams.flags || Ci.nsIWebNavigation.LOAD_FLAGS_NONE;
let postData = ("postData" in aParams && aParams.postData) ? aParams.postData.value : null;

View File

@ -306,7 +306,9 @@
<!-- Windows 8 Appbar -->
<appbar id="appbar" mousethrough="never" observes="bcast_windowState">
<hbox id="progress-control" layer="true"/>
<hbox id="progress-container" layer="true">
<hbox id="progress-control" />
</hbox>
<!-- Main Toolbar -->
<toolbar id="toolbar" observes="bcast_windowState" flex="1">
@ -377,10 +379,10 @@
</flyoutpanel>
<flyoutpanel id="sync-flyoutpanel" headertext="&syncHeader.title;">
<description>&sync.setup.description;</description>
<description id="sync-accountinfo" collapsed="true"></description>
<description id="sync-lastsync" collapsed="true"></description>
<description id="sync-errordescription" collapsed="true"></description>
<description id="sync-description">&sync.setup.description;</description>
<description id="sync-accountinfo" collapsed="true"></description>
<description id="sync-lastsync" collapsed="true"></description>
<description id="sync-errordescription" collapsed="true"></description>
<setting id="sync-connect" type="control" collapsed="true">
<button label="&sync.setupbutton.label;" oncommand="Sync.tryConnect();" />
</setting>

View File

@ -447,7 +447,7 @@ let Sync = {
let settingids = ["device", "connect", "connected", "disconnect", "lastsync", "pairdevice",
"errordescription", "accountinfo", "disconnectwarnpanel", "disconnectthrobber",
"disconnectwarntitle"];
"disconnectwarntitle", "description"];
settingids.forEach(function(id) {
elements[id] = document.getElementById("sync-" + id);
});
@ -468,6 +468,7 @@ let Sync = {
let lastsync = this._elements.lastsync;
let pairdevice = this._elements.pairdevice;
let accountinfo = this._elements.accountinfo;
let description = this._elements.description;
let disconnectthrobber = this._elements.disconnectthrobber;
// This gets updated when an error occurs
@ -489,6 +490,7 @@ let Sync = {
lastsync.collapsed = !isConfigured;
device.collapsed = !isConfigured;
disconnect.collapsed = !isConfigured;
description.collapsed = isConfigured;
if (this._disconnecting) {
connect.collapsed = true;

View File

@ -9,23 +9,26 @@
%define forward_width 22px
%define forward_spacing 12px
/* Sliding Toolbar/Tab Tray ------------------------------------------------- */
/* Progress meter ------------------------------------------------- */
#tray {
transition: transform @metro_animation_duration@ @metro_animation_easing@;
transform: translateY(-@tabs_height@);
width: 100%;
}
#progress-control {
#progress-container {
display: block;
position: absolute;
top: -@progress_height@;
height: @progress_height@;
max-height: @progress_height@;
background: linear-gradient(to right, @progress_start_color@, @progress_end_color@);
width: 100%;
background-color: hsla(210,5%,80%,1);
box-shadow: 0 1px 0 hsla(210,5%,50%,.1) inset;
-moz-user-focus: ignore;
}
#progress-control {
display: block;
height: @progress_height@;
background-image: -moz-linear-gradient(left, hsla(200,100%,83%,.5), hsla(200,100%,83%,0)), -moz-linear-gradient(top, #1ab2ff, #0091ff);
border-right: 1px solid #0082e5;
transition: width .3s ease-in;
-moz-user-focus: ignore;
}
#progress-control:-moz-dir(rtl) {
@ -37,6 +40,14 @@
transition: width .3s ease-in, .5s opacity ease-in;
}
/* Sliding Toolbar/Tab Tray ------------------------------------------------- */
#tray {
transition: transform @metro_animation_duration@ @metro_animation_easing@;
transform: translateY(-@tabs_height@);
width: 100%;
}
/* in non-tabsonly mode the navigation bar and tab tray float over content. In
tabsonly mode they are always visible and offset content. */
#tray:not([tabsonly]) {
@ -394,25 +405,7 @@ documenttab[selected] .documenttab-selection {
}
#toolbar[mode="loading"] > #tool-reload,
#toolbar:-moz-any([mode="edit"], [mode="view"]) > #tool-stop {
visibility: collapse;
}
/* Hide the tab toggle if we're showing classic tabs or we're snap-viewed. */
#toolbar[viewstate="snapped"],
#tray[tabsonly] #toolbar {
background: @panel_light_color@ @panel_light_background@;
-moz-padding-end: 0;
}
#toolbar[viewstate="snapped"] {
-moz-padding-end: 0;
}
#toolbar[viewstate="snapped"] > #urlbar-container {
-moz-margin-end: 0;
}
#toolbar:-moz-any([mode="edit"], [mode="view"]) > #tool-stop,
#toolbar[viewstate="snapped"] > #tool-stop ~ toolbarbutton {
visibility: collapse;
}

View File

@ -22,7 +22,7 @@
%define toolbar_height 68px
%define tabs_height 178px
%define progress_height 3px
%define progress_height 5px
%define progress_start_color #0095dd
%define progress_end_color #97cbff

View File

@ -11,6 +11,7 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
LIBRARY_NAME = caps_s
MSVC_ENABLE_PGO := 1
FORCE_STATIC_LIB = 1
LIBXUL_LIBRARY = 1

View File

@ -1570,7 +1570,7 @@ nsScriptSecurityManager::CheckLoadURIStrWithPrincipal(nsIPrincipal* aPrincipal,
};
for (uint32_t i = 0; i < ArrayLength(flags); ++i) {
rv = fixup->CreateFixupURI(aTargetURIStr, flags[i],
rv = fixup->CreateFixupURI(aTargetURIStr, flags[i], nullptr,
getter_AddRefs(target));
NS_ENSURE_SUCCESS(rv, rv);

View File

@ -11,6 +11,7 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
LIBRARY_NAME = chrome_s
MSVC_ENABLE_PGO := 1
LIBXUL_LIBRARY = 1
FORCE_STATIC_LIB = 1

View File

@ -275,6 +275,13 @@ STATIC_LIBRARY_NAME=$(LIBRARY_NAME)
endif
endif
# PGO on MSVC is opt-in
ifdef _MSC_VER
ifndef MSVC_ENABLE_PGO
NO_PROFILE_GUIDED_OPTIMIZE = 1
endif
endif
# No sense in profiling tools
ifdef INTERNAL_TOOLS
NO_PROFILE_GUIDED_OPTIMIZE = 1

View File

@ -2096,6 +2096,16 @@ public:
already_AddRefed<nsIDOMTouchList>
CreateTouchList(const mozilla::dom::Sequence<mozilla::dom::OwningNonNull<mozilla::dom::Touch> >& aTouches);
void SetStyleSheetChangeEventsEnabled(bool aValue)
{
mStyleSheetChangeEventsEnabled = aValue;
}
bool StyleSheetChangeEventsEnabled() const
{
return mStyleSheetChangeEventsEnabled;
}
virtual nsHTMLDocument* AsHTMLDocument() { return nullptr; }
virtual JSObject* WrapObject(JSContext *aCx,
@ -2299,6 +2309,9 @@ protected:
bool mHasHadDefaultView;
// Whether style sheet change events will be dispatched for this document
bool mStyleSheetChangeEventsEnabled;
// The document's script global object, the object from which the
// document can get its script context and scope. This is the
// *inner* window object.

View File

@ -22,7 +22,6 @@ interface nsISelectionDisplay : nsISupports
This will tell the rendering engine to draw the different
selection types.
@return NS_OK if successful.
*/
void setSelectionFlags(in short toggle);
@ -32,7 +31,6 @@ interface nsISelectionDisplay : nsISupports
@param short *aReturn - This will be filled with DISPLAY_(TEXT,IMAGE,FRAMES,ALL)
bit flags.
@return NS_OK if successful.
*/
short getSelectionFlags();

View File

@ -11,6 +11,7 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
LIBRARY_NAME = gkconbase_s
MSVC_ENABLE_PGO := 1
LIBXUL_LIBRARY = 1
CPPSRCS = \

View File

@ -137,8 +137,9 @@
#include "nsIPrompt.h"
#include "nsIPropertyBag2.h"
#include "nsIDOMPageTransitionEvent.h"
#include "nsIDOMStyleSheetAddedEvent.h"
#include "nsIDOMStyleSheetRemovedEvent.h"
#include "nsIDOMStyleRuleChangeEvent.h"
#include "nsIDOMStyleSheetChangeEvent.h"
#include "nsIDOMStyleSheetApplicableStateChangeEvent.h"
#include "nsJSUtils.h"
#include "nsFrameLoader.h"
#include "nsEscape.h"
@ -202,6 +203,8 @@
#include "nsITextControlElement.h"
#include "nsIDOMNSEditableElement.h"
#include "nsIEditor.h"
#include "nsIDOMCSSStyleRule.h"
#include "mozilla/css/Rule.h"
using namespace mozilla;
using namespace mozilla::dom;
@ -3722,7 +3725,7 @@ nsDocument::AddStyleSheetToStyleSets(nsIStyleSheet* aSheet)
}
}
#define DO_STYLESHEET_NOTIFICATION(createFunc, initMethod, concreteInterface, type) \
#define DO_STYLESHEET_NOTIFICATION(createFunc, concreteInterface, initMethod, type, ...) \
do { \
nsCOMPtr<nsIDOMEvent> event; \
nsresult rv = createFunc(getter_AddRefs(event), this, \
@ -3739,7 +3742,7 @@ nsDocument::AddStyleSheetToStyleSets(nsIStyleSheet* aSheet)
nsCOMPtr<concreteInterface> ssEvent(do_QueryInterface(event)); \
MOZ_ASSERT(ssEvent); \
ssEvent->initMethod(NS_LITERAL_STRING(type), true, true, \
cssSheet, aDocumentSheet); \
cssSheet, __VA_ARGS__); \
event->SetTrusted(true); \
event->SetTarget(this); \
nsRefPtr<nsAsyncDOMEvent> asyncEvent = new nsAsyncDOMEvent(this, event); \
@ -3751,23 +3754,29 @@ void
nsDocument::NotifyStyleSheetAdded(nsIStyleSheet* aSheet, bool aDocumentSheet)
{
NS_DOCUMENT_NOTIFY_OBSERVERS(StyleSheetAdded, (this, aSheet, aDocumentSheet));
DO_STYLESHEET_NOTIFICATION(NS_NewDOMStyleSheetAddedEvent,
InitStyleSheetAddedEvent,
nsIDOMStyleSheetAddedEvent,
"StyleSheetAdded");
if (StyleSheetChangeEventsEnabled()) {
DO_STYLESHEET_NOTIFICATION(NS_NewDOMStyleSheetChangeEvent,
nsIDOMStyleSheetChangeEvent,
InitStyleSheetChangeEvent,
"StyleSheetAdded",
aDocumentSheet);
}
}
void
nsDocument::NotifyStyleSheetRemoved(nsIStyleSheet* aSheet, bool aDocumentSheet)
{
NS_DOCUMENT_NOTIFY_OBSERVERS(StyleSheetRemoved, (this, aSheet, aDocumentSheet));
DO_STYLESHEET_NOTIFICATION(NS_NewDOMStyleSheetRemovedEvent,
InitStyleSheetRemovedEvent,
nsIDOMStyleSheetRemovedEvent,
"StyleSheetRemoved");
}
#undef DO_STYLESHEET_NOTIFICATION
if (StyleSheetChangeEventsEnabled()) {
DO_STYLESHEET_NOTIFICATION(NS_NewDOMStyleSheetChangeEvent,
nsIDOMStyleSheetChangeEvent,
InitStyleSheetChangeEvent,
"StyleSheetRemoved",
aDocumentSheet);
}
}
void
nsDocument::AddStyleSheet(nsIStyleSheet* aSheet)
@ -3888,6 +3897,14 @@ nsDocument::SetStyleSheetApplicableState(nsIStyleSheet* aSheet,
NS_DOCUMENT_NOTIFY_OBSERVERS(StyleSheetApplicableStateChanged,
(this, aSheet, aApplicable));
if (StyleSheetChangeEventsEnabled()) {
DO_STYLESHEET_NOTIFICATION(NS_NewDOMStyleSheetApplicableStateChangeEvent,
nsIDOMStyleSheetApplicableStateChangeEvent,
InitStyleSheetApplicableStateChangeEvent,
"StyleSheetApplicableStateChanged",
aApplicable);
}
}
// These three functions are a lot like the implementation of the
@ -4617,31 +4634,60 @@ nsDocument::DocumentStatesChanged(nsEventStates aStateMask)
}
void
nsDocument::StyleRuleChanged(nsIStyleSheet* aStyleSheet,
nsDocument::StyleRuleChanged(nsIStyleSheet* aSheet,
nsIStyleRule* aOldStyleRule,
nsIStyleRule* aNewStyleRule)
{
NS_DOCUMENT_NOTIFY_OBSERVERS(StyleRuleChanged,
(this, aStyleSheet,
(this, aSheet,
aOldStyleRule, aNewStyleRule));
if (StyleSheetChangeEventsEnabled()) {
nsCOMPtr<css::Rule> rule = do_QueryInterface(aNewStyleRule);
DO_STYLESHEET_NOTIFICATION(NS_NewDOMStyleRuleChangeEvent,
nsIDOMStyleRuleChangeEvent,
InitStyleRuleChangeEvent,
"StyleRuleChanged",
rule ? rule->GetDOMRule() : nullptr);
}
}
void
nsDocument::StyleRuleAdded(nsIStyleSheet* aStyleSheet,
nsDocument::StyleRuleAdded(nsIStyleSheet* aSheet,
nsIStyleRule* aStyleRule)
{
NS_DOCUMENT_NOTIFY_OBSERVERS(StyleRuleAdded,
(this, aStyleSheet, aStyleRule));
(this, aSheet, aStyleRule));
if (StyleSheetChangeEventsEnabled()) {
nsCOMPtr<css::Rule> rule = do_QueryInterface(aStyleRule);
DO_STYLESHEET_NOTIFICATION(NS_NewDOMStyleRuleChangeEvent,
nsIDOMStyleRuleChangeEvent,
InitStyleRuleChangeEvent,
"StyleRuleAdded",
rule ? rule->GetDOMRule() : nullptr);
}
}
void
nsDocument::StyleRuleRemoved(nsIStyleSheet* aStyleSheet,
nsDocument::StyleRuleRemoved(nsIStyleSheet* aSheet,
nsIStyleRule* aStyleRule)
{
NS_DOCUMENT_NOTIFY_OBSERVERS(StyleRuleRemoved,
(this, aStyleSheet, aStyleRule));
(this, aSheet, aStyleRule));
if (StyleSheetChangeEventsEnabled()) {
nsCOMPtr<css::Rule> rule = do_QueryInterface(aStyleRule);
DO_STYLESHEET_NOTIFICATION(NS_NewDOMStyleRuleChangeEvent,
nsIDOMStyleRuleChangeEvent,
InitStyleRuleChangeEvent,
"StyleRuleRemoved",
rule ? rule->GetDOMRule() : nullptr);
}
}
#undef DO_STYLESHEET_NOTIFICATION
//
// nsIDOMDocument interface

View File

@ -90,6 +90,9 @@ using namespace mozilla::dom;
#define XML_HTTP_REQUEST_ARRAYBUFFER_MAX_GROWTH (32*1024*1024)
// start at 32k to avoid lots of doubling right at the start
#define XML_HTTP_REQUEST_ARRAYBUFFER_MIN_SIZE (32*1024)
// the maximum Content-Length that we'll preallocate. 1GB. Must fit
// in an int32_t!
#define XML_HTTP_REQUEST_MAX_CONTENT_LENGTH_PREALLOCATE (1*1024*1024*1024LL)
#define LOAD_STR "load"
#define ERROR_STR "error"
@ -429,6 +432,7 @@ nsXMLHttpRequest::ResetResponse()
mDOMFile = nullptr;
mBlobSet = nullptr;
mResultArrayBuffer = nullptr;
mArrayBufferBuilder.reset();
mResultJSON = JSVAL_VOID;
mLoadTransferred = 0;
mResponseBodyDecodedPos = 0;
@ -480,6 +484,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsXMLHttpRequest,
nsXHREventTarget)
tmp->mResultArrayBuffer = nullptr;
tmp->mArrayBufferBuilder.reset();
tmp->mResultJSON = JSVAL_VOID;
NS_IMPL_CYCLE_COLLECTION_UNLINK(mContext)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mChannel)
@ -1752,7 +1757,7 @@ nsXMLHttpRequest::StreamReaderFunc(nsIInputStream* in,
xmlHttpRequest->mResponseType == XML_HTTP_RESPONSE_TYPE_CHUNKED_ARRAYBUFFER) {
// get the initial capacity to something reasonable to avoid a bunch of reallocs right
// at the start
if (xmlHttpRequest->mArrayBufferBuilder.length() == 0)
if (xmlHttpRequest->mArrayBufferBuilder.capacity() == 0)
xmlHttpRequest->mArrayBufferBuilder.setCapacity(PR_MAX(count, XML_HTTP_REQUEST_ARRAYBUFFER_MIN_SIZE));
xmlHttpRequest->mArrayBufferBuilder.append(reinterpret_cast<const uint8_t*>(fromRawSegment), count,
@ -1949,6 +1954,17 @@ nsXMLHttpRequest::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
DetectCharset();
// Set up arraybuffer
if (mResponseType == XML_HTTP_RESPONSE_TYPE_ARRAYBUFFER && NS_SUCCEEDED(status)) {
int64_t contentLength;
rv = channel->GetContentLength(&contentLength);
if (NS_SUCCEEDED(rv) &&
contentLength > 0 &&
contentLength < XML_HTTP_REQUEST_MAX_CONTENT_LENGTH_PREALLOCATE) {
mArrayBufferBuilder.setCapacity(static_cast<int32_t>(contentLength));
}
}
// Set up responseXML
bool parseBody = mResponseType == XML_HTTP_RESPONSE_TYPE_DEFAULT ||
mResponseType == XML_HTTP_RESPONSE_TYPE_DOCUMENT;

View File

@ -21,13 +21,10 @@ function handleRequest(request, response)
if (query['scriptedreport']) {
// spit back a script that records that the page loaded
response.setHeader("Content-Type", "text/javascript", false);
response.write('netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");');
if (query['double'])
response.write('window.parent.parent.parent.frameLoaded("' + query['scriptedreport'] + '", ' +
'window.location.toString());');
response.write('window.parent.parent.parent.postMessage({call: "frameLoaded", testname: "' + query['scriptedreport'] + '", uri: "window.location.toString()"}, "*");');
else
response.write('window.parent.parent.frameLoaded("' + query['scriptedreport'] + '", ' +
'window.location.toString());');
response.write('window.parent.parent.postMessage({call: "frameLoaded", testname: "' + query['scriptedreport'] + '", uri: "window.location.toString()"}, "*");');
} else if (query['internalframe']) {
// spit back an internal iframe (one that might be blocked)
response.setHeader("Content-Type", "text/html", false);

View File

@ -21,13 +21,10 @@ function handleRequest(request, response)
if (query['scriptedreport']) {
// spit back a script that records that the page loaded
response.setHeader("Content-Type", "text/javascript", false);
response.write('netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");');
if (query['double'])
response.write('window.parent.parent.parent.frameLoaded("' + query['scriptedreport'] + '", ' +
'window.location.toString());');
response.write('window.parent.parent.parent.postMessage({call: "frameLoaded", testname: "' + query['scriptedreport'] + '", uri: "window.location.toString()"}, "*");');
else
response.write('window.parent.parent.frameLoaded("' + query['scriptedreport'] + '", ' +
'window.location.toString());');
response.write('window.parent.parent.postMessage({call: "frameLoaded", testname: "' + query['scriptedreport'] + '", uri: "window.location.toString()"}, "*");');
} else if (query['internalframe']) {
// spit back an internal iframe (one that might be blocked)
response.setHeader("Content-Type", "text/html", false);

View File

@ -113,6 +113,13 @@ var checkTestResults = function() {
SimpleTest.finish();
}
window.addEventListener("message", receiveMessage, false);
function receiveMessage(event) {
if (event.data.call && event.data.call == 'frameLoaded')
frameLoaded(event.data.testname, event.data.uri);
}
//////////////////////////////////////////////////////////////////////
// set up and go
window.examiner = new examiner();

View File

@ -11,6 +11,7 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
LIBRARY_NAME = gkconcvs_s
MSVC_ENABLE_PGO := 1
LIBXUL_LIBRARY = 1
FAIL_ON_WARNINGS = 1

View File

@ -11,6 +11,7 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
LIBRARY_NAME = gkconevents_s
MSVC_ENABLE_PGO := 1
LIBXUL_LIBRARY = 1
FAIL_ON_WARNINGS = 1

View File

@ -5,6 +5,7 @@
#include "nsDOMDataContainerEvent.h"
#include "nsDOMClassInfoID.h"
#include "nsContentUtils.h"
nsDOMDataContainerEvent::nsDOMDataContainerEvent(
mozilla::dom::EventTarget* aOwner,
@ -13,6 +14,7 @@ nsDOMDataContainerEvent::nsDOMDataContainerEvent(
: nsDOMEvent(aOwner, aPresContext, aEvent)
{
mData.Init();
SetIsDOMBinding();
}
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsDOMDataContainerEvent,
@ -59,6 +61,24 @@ nsDOMDataContainerEvent::SetData(const nsAString& aKey, nsIVariant *aData)
return NS_OK;
}
void
nsDOMDataContainerEvent::SetData(JSContext* aCx, const nsAString& aKey,
JS::Value aVal, mozilla::ErrorResult& aRv)
{
if (!nsContentUtils::XPConnect()) {
aRv = NS_ERROR_FAILURE;
return;
}
nsCOMPtr<nsIVariant> val;
nsresult rv =
nsContentUtils::XPConnect()->JSToVariant(aCx, aVal, getter_AddRefs(val));
if (NS_FAILED(rv)) {
aRv = rv;
return;
}
aRv = SetData(aKey, val);
}
nsresult
NS_NewDOMDataContainerEvent(nsIDOMEvent** aInstancePtrResult,
mozilla::dom::EventTarget* aOwner,

View File

@ -9,6 +9,7 @@
#include "nsIDOMDataContainerEvent.h"
#include "nsDOMEvent.h"
#include "nsInterfaceHashtable.h"
#include "mozilla/dom/DataContainerEventBinding.h"
class nsDOMDataContainerEvent : public nsDOMEvent,
public nsIDOMDataContainerEvent
@ -25,6 +26,22 @@ public:
NS_DECL_NSIDOMDATACONTAINEREVENT
virtual JSObject*
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
{
return mozilla::dom::DataContainerEventBinding::Wrap(aCx, aScope, this);
}
already_AddRefed<nsIVariant> GetData(const nsAString& aKey)
{
nsCOMPtr<nsIVariant> val;
GetData(aKey, getter_AddRefs(val));
return val.forget();
}
void SetData(JSContext* aCx, const nsAString& aKey, JS::Value aVal,
mozilla::ErrorResult& aRv);
private:
static PLDHashOperator
TraverseEntry(const nsAString& aKey, nsIVariant *aDataItem, void* aUserArg);

View File

@ -35,6 +35,14 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=368835
ok(isPassed, "getData shouldn't fail.");
ok(value == "data1", "Wrong value of data.");
is(aEvent.getData("document"), document);
is(aEvent.getData("window"), window);
is(aEvent.getData("event"), aEvent);
is(aEvent.getData("null"), null);
is(aEvent.getData("1"), 1);
is(aEvent.getData("1.1"), 1.1);
is(aEvent.getData("true"), true);
try {
aEvent.setData("data3", "data3");
isPassed = false;
@ -64,6 +72,13 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=368835
try {
event.setData("data1", "data1");
event.setData("document", document);
event.setData("window", window);
event.setData("event", event);
event.setData("null", null);
event.setData("1", 1);
event.setData("1.1", 1.1);
event.setData("true", true);
isPassed = true;
} catch (e) {
isPassed = false;

View File

@ -11,6 +11,7 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
LIBRARY_NAME = gkconhtmlcon_s
MSVC_ENABLE_PGO := 1
LIBXUL_LIBRARY = 1
FAIL_ON_WARNINGS = 1

View File

@ -11,6 +11,7 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
LIBRARY_NAME = gkconhtmldoc_s
MSVC_ENABLE_PGO := 1
LIBXUL_LIBRARY = 1
FAIL_ON_WARNINGS = 1

View File

@ -1,3 +0,0 @@
ifeq ($(OS_TARGET),WINNT)
NO_PROFILE_GUIDED_OPTIMIZE := 1 # Don't PGO
endif

View File

@ -10,6 +10,7 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
LIBRARY_NAME = gkconmedia_s
MSVC_ENABLE_PGO := 1
LIBXUL_LIBRARY = 1
ifndef _MSC_VER
FAIL_ON_WARNINGS := 1

View File

@ -607,6 +607,20 @@ nsresult ChannelMediaResource::OpenChannel(nsIStreamListener** aStreamListener)
*aStreamListener = nullptr;
}
if (mByteRange.IsNull()) {
// We're not making a byte range request, so set the content length,
// if it's available as an HTTP header. This ensures that MediaResource
// wrapping objects for platform libraries that expect to know
// the length of a resource can get it before OnStartRequest() fires.
nsCOMPtr<nsIHttpChannel> hc = do_QueryInterface(mChannel);
if (hc) {
int64_t cl = -1;
if (NS_SUCCEEDED(hc->GetContentLength(&cl)) && cl != -1) {
mCacheStream.NotifyDataLength(cl);
}
}
}
mListener = new Listener(this);
NS_ENSURE_TRUE(mListener, NS_ERROR_OUT_OF_MEMORY);

View File

@ -423,34 +423,28 @@ void GStreamerReader::NotifyBytesConsumed()
mLastReportedByteOffset = mByteOffset;
}
bool GStreamerReader::WaitForDecodedData(int* aCounter)
{
ReentrantMonitorAutoEnter mon(mGstThreadsMonitor);
/* Report consumed bytes from here as we can't do it from gst threads */
NotifyBytesConsumed();
while(*aCounter == 0) {
if (mReachedEos) {
return false;
}
mon.Wait();
NotifyBytesConsumed();
}
(*aCounter)--;
return true;
}
bool GStreamerReader::DecodeAudioData()
{
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
if (!WaitForDecodedData(&mAudioSinkBufferCount)) {
mAudioQueue.Finish();
return false;
GstBuffer *buffer = nullptr;
{
ReentrantMonitorAutoEnter mon(mGstThreadsMonitor);
if (mReachedEos) {
mAudioQueue.Finish();
return false;
}
if (!mAudioSinkBufferCount) {
return true;
}
buffer = gst_app_sink_pull_buffer(mAudioAppSink);
mAudioSinkBufferCount--;
}
GstBuffer* buffer = gst_app_sink_pull_buffer(mAudioAppSink);
int64_t timestamp = GST_BUFFER_TIMESTAMP(buffer);
timestamp = gst_segment_to_stream_time(&mAudioSegment,
GST_FORMAT_TIME, timestamp);
@ -479,49 +473,53 @@ bool GStreamerReader::DecodeVideoFrame(bool &aKeyFrameSkip,
{
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
GstBuffer* buffer = nullptr;
int64_t timestamp, nextTimestamp;
while (true)
GstBuffer *buffer = nullptr;
{
if (!WaitForDecodedData(&mVideoSinkBufferCount)) {
ReentrantMonitorAutoEnter mon(mGstThreadsMonitor);
if (mReachedEos) {
mVideoQueue.Finish();
break;
return false;
}
if (!mVideoSinkBufferCount) {
return true;
}
mDecoder->NotifyDecodedFrames(0, 1);
buffer = gst_app_sink_pull_buffer(mVideoAppSink);
bool isKeyframe = !GST_BUFFER_FLAG_IS_SET(buffer, GST_BUFFER_FLAG_DISCONT);
if ((aKeyFrameSkip && !isKeyframe)) {
gst_buffer_unref(buffer);
buffer = nullptr;
continue;
}
mVideoSinkBufferCount--;
}
timestamp = GST_BUFFER_TIMESTAMP(buffer);
{
ReentrantMonitorAutoEnter mon(mGstThreadsMonitor);
timestamp = gst_segment_to_stream_time(&mVideoSegment,
GST_FORMAT_TIME, timestamp);
}
NS_ASSERTION(GST_CLOCK_TIME_IS_VALID(timestamp),
"frame has invalid timestamp");
timestamp = nextTimestamp = GST_TIME_AS_USECONDS(timestamp);
if (GST_CLOCK_TIME_IS_VALID(GST_BUFFER_DURATION(buffer)))
nextTimestamp += GST_TIME_AS_USECONDS(GST_BUFFER_DURATION(buffer));
else if (fpsNum && fpsDen)
/* add 1-frame duration */
nextTimestamp += gst_util_uint64_scale(GST_USECOND, fpsNum, fpsDen);
bool isKeyframe = !GST_BUFFER_FLAG_IS_SET(buffer, GST_BUFFER_FLAG_DISCONT);
if ((aKeyFrameSkip && !isKeyframe)) {
gst_buffer_unref(buffer);
return true;
}
if (timestamp < aTimeThreshold) {
LOG(PR_LOG_DEBUG, ("skipping frame %" GST_TIME_FORMAT
" threshold %" GST_TIME_FORMAT,
GST_TIME_ARGS(timestamp), GST_TIME_ARGS(aTimeThreshold)));
gst_buffer_unref(buffer);
buffer = nullptr;
continue;
}
int64_t timestamp = GST_BUFFER_TIMESTAMP(buffer);
{
ReentrantMonitorAutoEnter mon(mGstThreadsMonitor);
timestamp = gst_segment_to_stream_time(&mVideoSegment,
GST_FORMAT_TIME, timestamp);
}
NS_ASSERTION(GST_CLOCK_TIME_IS_VALID(timestamp),
"frame has invalid timestamp");
int64_t nextTimestamp = timestamp = GST_TIME_AS_USECONDS(timestamp);
if (GST_CLOCK_TIME_IS_VALID(GST_BUFFER_DURATION(buffer)))
nextTimestamp += GST_TIME_AS_USECONDS(GST_BUFFER_DURATION(buffer));
else if (fpsNum && fpsDen)
/* add 1-frame duration */
nextTimestamp += gst_util_uint64_scale(GST_USECOND, fpsNum, fpsDen);
break;
if (timestamp < aTimeThreshold) {
LOG(PR_LOG_DEBUG, ("skipping frame %" GST_TIME_FORMAT
" threshold %" GST_TIME_FORMAT,
GST_TIME_ARGS(timestamp), GST_TIME_ARGS(aTimeThreshold)));
gst_buffer_unref(buffer);
return true;
}
if (!buffer)
@ -570,8 +568,7 @@ bool GStreamerReader::DecodeVideoFrame(bool &aKeyFrameSkip,
b.mPlanes[i].mSkip = 0;
}
bool isKeyframe = !GST_BUFFER_FLAG_IS_SET(buffer,
GST_BUFFER_FLAG_DELTA_UNIT);
isKeyframe = !GST_BUFFER_FLAG_IS_SET(buffer, GST_BUFFER_FLAG_DELTA_UNIT);
/* XXX ? */
int64_t offset = 0;
VideoData* video = VideoData::Create(mInfo, image, offset,

View File

@ -50,7 +50,6 @@ public:
private:
void ReadAndPushData(guint aLength);
bool WaitForDecodedData(int* counter);
void NotifyBytesConsumed();
int64_t QueryDuration();

View File

@ -144,11 +144,13 @@ public:
if (!mBuffer.IsEmpty() &&
mLeftOverData == INT32_MIN &&
aStream->AllInputsFinished()) {
mLeftOverData = static_cast<int32_t>(mCurrentDelayTime * IdealAudioRate());
mLeftOverData = static_cast<int32_t>(mCurrentDelayTime * IdealAudioRate()) - WEBAUDIO_BLOCK_SIZE;
nsRefPtr<PlayingRefChanged> refchanged =
new PlayingRefChanged(aStream, PlayingRefChanged::ADDREF);
NS_DispatchToMainThread(refchanged);
if (mLeftOverData > 0) {
nsRefPtr<PlayingRefChanged> refchanged =
new PlayingRefChanged(aStream, PlayingRefChanged::ADDREF);
NS_DispatchToMainThread(refchanged);
}
} else if (mLeftOverData != INT32_MIN) {
mLeftOverData -= WEBAUDIO_BLOCK_SIZE;
if (mLeftOverData <= 0) {

View File

@ -1,3 +0,0 @@
ifeq ($(OS_TARGET),WINNT)
NO_PROFILE_GUIDED_OPTIMIZE := 1 # Don't PGO
endif

View File

@ -5,7 +5,6 @@
#include "mozilla/dom/SVGAltGlyphElement.h"
#include "mozilla/dom/SVGAltGlyphElementBinding.h"
#include "nsContentUtils.h"
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(AltGlyph)
@ -85,12 +84,6 @@ SVGAltGlyphElement::IsAttributeMapped(const nsIAtom* name) const
SVGAltGlyphElementBase::IsAttributeMapped(name);
}
bool
SVGAltGlyphElement::IsEventAttributeName(nsIAtom* aName)
{
return nsContentUtils::IsEventAttributeName(aName, EventNameType_SVGGraphic);
}
//----------------------------------------------------------------------
// nsSVGElement overrides

View File

@ -31,7 +31,6 @@ public:
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const MOZ_OVERRIDE;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
virtual bool IsEventAttributeName(nsIAtom* aName) MOZ_OVERRIDE;
// WebIDL
already_AddRefed<nsIDOMSVGAnimatedString> Href();

View File

@ -5,7 +5,6 @@
#include "mozilla/dom/SVGTSpanElement.h"
#include "mozilla/dom/SVGTSpanElementBinding.h"
#include "nsContentUtils.h"
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(TSpan)
@ -52,11 +51,5 @@ SVGTSpanElement::IsAttributeMapped(const nsIAtom* name) const
SVGTSpanElementBase::IsAttributeMapped(name);
}
bool
SVGTSpanElement::IsEventAttributeName(nsIAtom* aName)
{
return nsContentUtils::IsEventAttributeName(aName, EventNameType_SVGGraphic);
}
} // namespace dom
} // namespace mozilla

View File

@ -30,8 +30,6 @@ public:
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const MOZ_OVERRIDE;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
virtual bool IsEventAttributeName(nsIAtom* aName) MOZ_OVERRIDE;
};
} // namespace dom

View File

@ -9,7 +9,6 @@
#include "nsGkAtoms.h"
#include "nsIFrame.h"
#include "nsError.h"
#include "nsContentUtils.h"
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(TextPath)
@ -115,13 +114,6 @@ SVGTextPathElement::IsAttributeMapped(const nsIAtom* name) const
SVGTextPathElementBase::IsAttributeMapped(name);
}
bool
SVGTextPathElement::IsEventAttributeName(nsIAtom* aName)
{
return nsContentUtils::IsEventAttributeName(aName, EventNameType_SVGGraphic);
}
//----------------------------------------------------------------------
// nsSVGElement overrides

View File

@ -51,8 +51,6 @@ public:
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
virtual bool IsEventAttributeName(nsIAtom* aName) MOZ_OVERRIDE;
// WebIDL
already_AddRefed<SVGAnimatedLength> StartOffset();
already_AddRefed<nsIDOMSVGAnimatedEnumeration> Method();

View File

@ -1,3 +0,0 @@
ifeq ($(OS_TARGET),WINNT)
NO_PROFILE_GUIDED_OPTIMIZE := 1 # Don't PGO
endif

View File

@ -11,6 +11,7 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
LIBRARY_NAME = gkconxbl_s
MSVC_ENABLE_PGO := 1
LIBXUL_LIBRARY = 1
FAIL_ON_WARNINGS = 1

View File

@ -11,6 +11,7 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
LIBRARY_NAME = gkconxmlcon_s
MSVC_ENABLE_PGO := 1
LIBXUL_LIBRARY = 1
FAIL_ON_WARNINGS = 1

View File

@ -11,6 +11,7 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
LIBRARY_NAME = gkconxmldoc_s
MSVC_ENABLE_PGO := 1
LIBXUL_LIBRARY = 1
FAIL_ON_WARNINGS = 1

View File

@ -1,3 +0,0 @@
ifeq ($(OS_TARGET),WINNT)
NO_PROFILE_GUIDED_OPTIMIZE := 1 # Don't PGO
endif

View File

@ -13,6 +13,7 @@ include $(DEPTH)/config/autoconf.mk
ifdef MOZ_XUL
LIBRARY_NAME = gkconxulcon_s
MSVC_ENABLE_PGO := 1
LIBXUL_LIBRARY = 1
endif

View File

@ -11,6 +11,7 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
LIBRARY_NAME = gkconxuldoc_s
MSVC_ENABLE_PGO := 1
LIBXUL_LIBRARY = 1

View File

@ -11,6 +11,7 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
LIBRARY_NAME = gkconxultmpl_s
MSVC_ENABLE_PGO := 1
LIBXUL_LIBRARY = 1

View File

@ -11,6 +11,7 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
LIBRARY_NAME = basedocshell_s
MSVC_ENABLE_PGO := 1
LIBXUL_LIBRARY = 1
ifdef MOZ_TOOLKIT_SEARCH

View File

@ -113,7 +113,8 @@ nsDefaultURIFixup::CreateExposableURI(nsIURI *aURI, nsIURI **aReturn)
/* nsIURI createFixupURI (in nsAUTF8String aURIText, in unsigned long aFixupFlags); */
NS_IMETHODIMP
nsDefaultURIFixup::CreateFixupURI(const nsACString& aStringURI, uint32_t aFixupFlags, nsIURI **aURI)
nsDefaultURIFixup::CreateFixupURI(const nsACString& aStringURI, uint32_t aFixupFlags,
nsIInputStream **aPostData, nsIURI **aURI)
{
NS_ENSURE_ARG(!aStringURI.IsEmpty());
NS_ENSURE_ARG_POINTER(aURI);
@ -147,7 +148,7 @@ nsDefaultURIFixup::CreateFixupURI(const nsACString& aStringURI, uint32_t aFixupF
sizeof("view-source:") - 1,
uriString.Length() -
(sizeof("view-source:") - 1)),
newFixupFlags, getter_AddRefs(uri));
newFixupFlags, aPostData, getter_AddRefs(uri));
if (NS_FAILED(rv))
return NS_ERROR_FAILURE;
nsAutoCString spec;
@ -243,7 +244,7 @@ nsDefaultURIFixup::CreateFixupURI(const nsACString& aStringURI, uint32_t aFixupF
NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
if (fixupKeywords)
{
KeywordURIFixup(uriString, aURI);
KeywordURIFixup(uriString, aPostData, aURI);
if(*aURI)
return NS_OK;
}
@ -309,7 +310,7 @@ nsDefaultURIFixup::CreateFixupURI(const nsACString& aStringURI, uint32_t aFixupF
// keyword match. This catches search strings with '.' or ':' in them.
if (!*aURI && fixupKeywords)
{
KeywordToURI(aStringURI, aURI);
KeywordToURI(aStringURI, aPostData, aURI);
if(*aURI)
return NS_OK;
}
@ -318,9 +319,13 @@ nsDefaultURIFixup::CreateFixupURI(const nsACString& aStringURI, uint32_t aFixupF
}
NS_IMETHODIMP nsDefaultURIFixup::KeywordToURI(const nsACString& aKeyword,
nsIInputStream **aPostData,
nsIURI **aURI)
{
*aURI = nullptr;
if (aPostData) {
*aPostData = nullptr;
}
NS_ENSURE_STATE(Preferences::GetRootBranch());
// Strip leading "?" and leading/trailing spaces from aKeyword
@ -354,13 +359,16 @@ NS_IMETHODIMP nsDefaultURIFixup::KeywordToURI(const nsACString& aKeyword,
NS_LITERAL_STRING("keyword"),
getter_AddRefs(submission));
if (submission) {
// The submission depends on POST data (i.e. the search engine's
// "method" is POST), we can't use this engine for keyword
// searches
nsCOMPtr<nsIInputStream> postData;
submission->GetPostData(getter_AddRefs(postData));
if (postData) {
return NS_ERROR_NOT_AVAILABLE;
if (aPostData) {
postData.forget(aPostData);
} else if (postData) {
// The submission specifies POST data (i.e. the search
// engine's "method" is POST), but our caller didn't allow
// passing post data back. No point passing back a URL that
// won't load properly.
return NS_ERROR_FAILURE;
}
// This notification is meant for Firefox Health Report so it
@ -762,8 +770,9 @@ const char * nsDefaultURIFixup::GetCharsetForUrlBar()
return charset;
}
nsresult nsDefaultURIFixup::KeywordURIFixup(const nsACString & aURIString,
nsIURI** aURI)
void nsDefaultURIFixup::KeywordURIFixup(const nsACString & aURIString,
nsIInputStream **aPostData,
nsIURI** aURI)
{
// These are keyword formatted strings
// "what is mozilla"
@ -802,13 +811,8 @@ nsresult nsDefaultURIFixup::KeywordURIFixup(const nsACString & aURIString,
(spaceLoc < qMarkLoc || quoteLoc < qMarkLoc)) ||
qMarkLoc == 0)
{
KeywordToURI(aURIString, aURI);
KeywordToURI(aURIString, aPostData, aURI);
}
if(*aURI)
return NS_OK;
return NS_ERROR_FAILURE;
}

View File

@ -29,7 +29,7 @@ private:
/* additional members */
nsresult FileURIFixup(const nsACString &aStringURI, nsIURI** aURI);
nsresult ConvertFileToStringURI(const nsACString& aIn, nsCString& aOut);
nsresult KeywordURIFixup(const nsACString &aStringURI, nsIURI** aURI);
void KeywordURIFixup(const nsACString &aStringURI, nsIInputStream** aPostData, nsIURI** aURI);
bool PossiblyByteExpandedFileName(const nsAString& aIn);
bool PossiblyHostPortUrl(const nsACString& aUrl);
bool MakeAlternateURI(nsIURI *aURI);

View File

@ -4005,6 +4005,7 @@ nsDocShell::LoadURI(const PRUnichar * aURI,
return NS_OK; // JS may not handle returning of an error code
}
nsCOMPtr<nsIURI> uri;
nsCOMPtr<nsIInputStream> postStream(aPostStream);
nsresult rv = NS_OK;
// Create a URI from our string; if that succeeds, we want to
@ -4036,6 +4037,7 @@ nsDocShell::LoadURI(const PRUnichar * aURI,
fixupFlags |= nsIURIFixup::FIXUP_FLAG_USE_UTF8;
}
rv = sURIFixup->CreateFixupURI(uriString, fixupFlags,
getter_AddRefs(postStream),
getter_AddRefs(uri));
}
// else no fixup service so just use the URI we created and see
@ -4069,7 +4071,7 @@ nsDocShell::LoadURI(const PRUnichar * aURI,
uint32_t loadType = MAKE_LOAD_TYPE(LOAD_NORMAL, aLoadFlags);
loadInfo->SetLoadType(ConvertLoadTypeToDocShellLoadInfo(loadType));
loadInfo->SetPostDataStream(aPostStream);
loadInfo->SetPostDataStream(postStream);
loadInfo->SetReferrer(aReferringURI);
loadInfo->SetHeadersStream(aHeaderStream);
@ -6684,6 +6686,7 @@ nsDocShell::EndPageLoad(nsIWebProgress * aProgress,
// Try and make an alternative URI from the old one
//
nsCOMPtr<nsIURI> newURI;
nsCOMPtr<nsIInputStream> newPostData;
nsAutoCString oldSpec;
url->GetSpec(oldSpec);
@ -6724,6 +6727,7 @@ nsDocShell::EndPageLoad(nsIWebProgress * aProgress,
// only send non-qualified hosts to the keyword server
if (!mOriginalUriString.IsEmpty()) {
sURIFixup->KeywordToURI(mOriginalUriString,
getter_AddRefs(newPostData),
getter_AddRefs(newURI));
}
else {
@ -6743,11 +6747,15 @@ nsDocShell::EndPageLoad(nsIWebProgress * aProgress,
do_GetService(NS_IDNSERVICE_CONTRACTID);
if (idnSrv &&
NS_SUCCEEDED(idnSrv->IsACE(host, &isACE)) && isACE &&
NS_SUCCEEDED(idnSrv->ConvertACEtoUTF8(host, utf8Host)))
NS_SUCCEEDED(idnSrv->ConvertACEtoUTF8(host, utf8Host))) {
sURIFixup->KeywordToURI(utf8Host,
getter_AddRefs(newPostData),
getter_AddRefs(newURI));
else
sURIFixup->KeywordToURI(host, getter_AddRefs(newURI));
} else {
sURIFixup->KeywordToURI(host,
getter_AddRefs(newPostData),
getter_AddRefs(newURI));
}
}
} // end keywordsEnabled
}
@ -6780,8 +6788,10 @@ nsDocShell::EndPageLoad(nsIWebProgress * aProgress,
}
if (doCreateAlternate) {
newURI = nullptr;
newPostData = nullptr;
sURIFixup->CreateFixupURI(oldSpec,
nsIURIFixup::FIXUP_FLAGS_MAKE_ALTERNATE_URI,
getter_AddRefs(newPostData),
getter_AddRefs(newURI));
}
}
@ -6802,7 +6812,7 @@ nsDocShell::EndPageLoad(nsIWebProgress * aProgress,
return LoadURI(newSpecW.get(), // URI string
LOAD_FLAGS_NONE, // Load flags
nullptr, // Referring URI
nullptr, // Post data stream
newPostData, // Post data stream
nullptr); // Headers stream
}
}

View File

@ -7,11 +7,12 @@
#include "nsISupports.idl"
interface nsIURI;
interface nsIInputStream;
/**
* Interface implemented by objects capable of fixing up strings into URIs
*/
[scriptable, uuid(773081ac-9f81-4bdb-9e7a-5e87b4361f09)]
[scriptable, uuid(552a23bb-c1b2-426e-a801-d346c6a98f1d)]
interface nsIURIFixup : nsISupports
{
/** No fixup flags. */
@ -54,14 +55,25 @@ interface nsIURIFixup : nsISupports
*
* @param aURIText Candidate URI.
* @param aFixupFlags Flags that govern ways the URI may be fixed up.
* @param aPostData The POST data to submit with the returned
* URI (see nsISearchSubmission).
*/
nsIURI createFixupURI(in AUTF8String aURIText, in unsigned long aFixupFlags);
nsIURI createFixupURI(in AUTF8String aURIText, in unsigned long aFixupFlags,
[optional] out nsIInputStream aPostData);
/**
* Converts the specified keyword string into a URI. Note that it's the
* caller's responsibility to check whether keywords are enabled and
* whether aKeyword is a sensible keyword.
*
* @param aKeyword The keyword string to convert into a URI
* @param aPostData The POST data to submit to the returned URI
* (see nsISearchSubmission).
*
* @throws NS_ERROR_FAILURE if the resulting URI requires submission of POST
* data and aPostData is null.
*/
nsIURI keywordToURI(in AUTF8String aKeyword);
nsIURI keywordToURI(in AUTF8String aKeyword,
[optional] out nsIInputStream aPostData);
};

View File

@ -18,8 +18,7 @@ interface nsIWebPageDescriptor : nsISupports
/**
* Tells the object to load the page specified by the page descriptor
*
* @return NS_OK -
* NS_ERROR_FAILURE -
* @throws NS_ERROR_FAILURE -
*/
void loadPage(in nsISupports aPageDescriptor, in unsigned long aDisplayType);

View File

@ -11,6 +11,7 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
LIBRARY_NAME = shistory_s
MSVC_ENABLE_PGO := 1
FORCE_STATIC_LIB = 1
LIBXUL_LIBRARY = 1
FAIL_ON_WARNINGS = 1

View File

@ -10,6 +10,7 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
LIBRARY_NAME = jsdombase_s
MSVC_ENABLE_PGO := 1
LIBXUL_LIBRARY = 1
FORCE_STATIC_LIB = 1
FAIL_ON_WARNINGS := 1

View File

@ -293,31 +293,36 @@ MaybeReflowForInflationScreenWidthChange(nsPresContext *aPresContext)
{
if (aPresContext) {
nsIPresShell* presShell = aPresContext->GetPresShell();
if (presShell && nsLayoutUtils::FontSizeInflationEnabled(aPresContext) &&
bool fontInflationWasEnabled = presShell->FontSizeInflationEnabled();
presShell->NotifyFontSizeInflationEnabledIsDirty();
bool changed = false;
if (presShell && presShell->FontSizeInflationEnabled() &&
presShell->FontSizeInflationMinTwips() != 0) {
bool changed;
aPresContext->ScreenWidthInchesForFontInflation(&changed);
if (changed) {
nsCOMPtr<nsISupports> container = aPresContext->GetContainer();
nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(container);
if (docShell) {
nsCOMPtr<nsIContentViewer> cv;
docShell->GetContentViewer(getter_AddRefs(cv));
nsCOMPtr<nsIMarkupDocumentViewer> mudv = do_QueryInterface(cv);
if (mudv) {
nsTArray<nsCOMPtr<nsIMarkupDocumentViewer> > array;
mudv->AppendSubtree(array);
for (uint32_t i = 0, iEnd = array.Length(); i < iEnd; ++i) {
nsCOMPtr<nsIPresShell> shell;
nsCOMPtr<nsIContentViewer> cv = do_QueryInterface(array[i]);
cv->GetPresShell(getter_AddRefs(shell));
if (shell) {
nsIFrame *rootFrame = shell->GetRootFrame();
if (rootFrame) {
shell->FrameNeedsReflow(rootFrame,
nsIPresShell::eStyleChange,
NS_FRAME_IS_DIRTY);
}
}
changed = changed ||
(fontInflationWasEnabled != presShell->FontSizeInflationEnabled());
if (changed) {
nsCOMPtr<nsISupports> container = aPresContext->GetContainer();
nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(container);
if (docShell) {
nsCOMPtr<nsIContentViewer> cv;
docShell->GetContentViewer(getter_AddRefs(cv));
nsCOMPtr<nsIMarkupDocumentViewer> mudv = do_QueryInterface(cv);
if (mudv) {
nsTArray<nsCOMPtr<nsIMarkupDocumentViewer> > array;
mudv->AppendSubtree(array);
for (uint32_t i = 0, iEnd = array.Length(); i < iEnd; ++i) {
nsCOMPtr<nsIPresShell> shell;
nsCOMPtr<nsIContentViewer> cv = do_QueryInterface(array[i]);
cv->GetPresShell(getter_AddRefs(shell));
if (shell) {
nsIFrame *rootFrame = shell->GetRootFrame();
if (rootFrame) {
shell->FrameNeedsReflow(rootFrame,
nsIPresShell::eStyleChange,
NS_FRAME_IS_DIRTY);
}
}
}

View File

@ -248,41 +248,43 @@ NS_IMETHODIMP
nsScreen::MozLockOrientation(const JS::Value& aOrientation, JSContext* aCx,
bool* aReturn)
{
if (aOrientation.isObject() && IsArrayLike(aCx, &aOrientation.toObject())) {
if (aOrientation.isObject()) {
JS::Rooted<JSObject*> seq(aCx, &aOrientation.toObject());
uint32_t length;
// JS_GetArrayLength actually works on all objects
if (!JS_GetArrayLength(aCx, seq, &length)) {
return NS_ERROR_FAILURE;
}
Sequence<nsString> orientations;
if (!orientations.SetCapacity(length)) {
return NS_ERROR_OUT_OF_MEMORY;
}
for (uint32_t i = 0; i < length; ++i) {
JS::Rooted<JS::Value> temp(aCx);
if (!JS_GetElement(aCx, seq, i, temp.address())) {
if (IsArrayLike(aCx, seq)) {
uint32_t length;
// JS_GetArrayLength actually works on all objects
if (!JS_GetArrayLength(aCx, seq, &length)) {
return NS_ERROR_FAILURE;
}
JS::RootedString jsString(aCx, JS_ValueToString(aCx, temp));
if (!jsString) {
return NS_ERROR_FAILURE;
Sequence<nsString> orientations;
if (!orientations.SetCapacity(length)) {
return NS_ERROR_OUT_OF_MEMORY;
}
nsDependentJSString str;
if (!str.init(aCx, jsString)) {
return NS_ERROR_FAILURE;
for (uint32_t i = 0; i < length; ++i) {
JS::Rooted<JS::Value> temp(aCx);
if (!JS_GetElement(aCx, seq, i, temp.address())) {
return NS_ERROR_FAILURE;
}
JS::RootedString jsString(aCx, JS_ValueToString(aCx, temp));
if (!jsString) {
return NS_ERROR_FAILURE;
}
nsDependentJSString str;
if (!str.init(aCx, jsString)) {
return NS_ERROR_FAILURE;
}
*orientations.AppendElement() = str;
}
*orientations.AppendElement() = str;
ErrorResult rv;
*aReturn = MozLockOrientation(orientations, rv);
return rv.ErrorCode();
}
ErrorResult rv;
*aReturn = MozLockOrientation(orientations, rv);
return rv.ErrorCode();
}
JS::RootedString jsString(aCx, JS_ValueToString(aCx, aOrientation));

View File

@ -186,33 +186,35 @@ UnwrapObject(JSContext* cx, JSObject* obj, U& value)
}
inline bool
IsNotDateOrRegExp(JSContext* cx, JSObject* obj)
IsNotDateOrRegExp(JSContext* cx, JS::Handle<JSObject*> obj)
{
MOZ_ASSERT(obj);
return !JS_ObjectIsDate(cx, obj) && !JS_ObjectIsRegExp(cx, obj);
}
MOZ_ALWAYS_INLINE bool
IsArrayLike(JSContext* cx, JSObject* obj)
IsArrayLike(JSContext* cx, JS::Handle<JSObject*> obj)
{
return IsNotDateOrRegExp(cx, obj);
}
MOZ_ALWAYS_INLINE bool
IsConvertibleToDictionary(JSContext* cx, JSObject* obj)
IsObjectValueConvertibleToDictionary(JSContext* cx,
JS::Handle<JS::Value> objVal)
{
JS::Rooted<JSObject*> obj(cx, &objVal.toObject());
return IsNotDateOrRegExp(cx, obj);
}
MOZ_ALWAYS_INLINE bool
IsConvertibleToDictionary(JSContext* cx, JS::Value val)
IsConvertibleToDictionary(JSContext* cx, JS::Handle<JS::Value> val)
{
return val.isNullOrUndefined() ||
(val.isObject() && IsConvertibleToDictionary(cx, &val.toObject()));
(val.isObject() && IsObjectValueConvertibleToDictionary(cx, val));
}
MOZ_ALWAYS_INLINE bool
IsConvertibleToCallbackInterface(JSContext* cx, JSObject* obj)
IsConvertibleToCallbackInterface(JSContext* cx, JS::Handle<JSObject*> obj)
{
return IsNotDateOrRegExp(cx, obj);
}

View File

@ -231,6 +231,10 @@ DOMInterfaces = {
'nativeType': 'nsDOMCSSValueList'
},
'DataContainerEvent': {
'nativeType': 'nsDOMDataContainerEvent',
},
'DelayNode': [
{
'resultNotAddRefed': [ 'delayTime' ],

View File

@ -2738,7 +2738,7 @@ for (uint32_t i = 0; i < length; ++i) {
memberType = arrayObjectMemberTypes[0]
name = memberType.name
arrayObject = CGGeneric("done = (failed = !%s.TrySetTo%s(cx, ${valHandle}, ${valPtr}, tryNext)) || !tryNext;" % (unionArgumentObj, name))
arrayObject = CGIfWrapper(arrayObject, "IsArrayLike(cx, &argObj)")
arrayObject = CGIfWrapper(arrayObject, "IsArrayLike(cx, argObj)")
names.append(name)
else:
arrayObject = None
@ -2750,7 +2750,7 @@ for (uint32_t i = 0; i < length; ++i) {
name = memberType.name
dateObject = CGGeneric("%s.SetTo%s(cx, ${val}, ${valPtr});\n"
"done = true;" % (unionArgumentObj, name))
dateObject = CGIfWrapper(dateObject, "JS_ObjectIsDate(cx, &argObj)");
dateObject = CGIfWrapper(dateObject, "JS_ObjectIsDate(cx, argObj)");
names.append(name)
else:
dateObject = None
@ -2774,7 +2774,7 @@ for (uint32_t i = 0; i < length; ++i) {
objectMemberTypes = filter(lambda t: t.isObject(), memberTypes)
if len(objectMemberTypes) > 0:
object = CGGeneric("%s.SetToObject(cx, &argObj);\n"
object = CGGeneric("%s.SetToObject(cx, argObj);\n"
"done = true;" % unionArgumentObj)
else:
object = None
@ -2804,8 +2804,8 @@ for (uint32_t i = 0; i < length; ++i) {
if any([arrayObject, dateObject, callbackObject, dictionaryObject,
object]):
templateBody.prepend(CGGeneric("JSObject& argObj = ${val}.toObject();"))
templateBody = CGIfWrapper(templateBody, "${val}.isObject()")
templateBody.prepend(CGGeneric("JS::Rooted<JSObject*> argObj(cx, &${valHandle}.toObject());"))
templateBody = CGIfWrapper(templateBody, "${valHandle}.isObject()")
else:
templateBody = CGGeneric()
@ -2955,12 +2955,18 @@ for (uint32_t i = 0; i < length; ++i) {
templateBody = ""
if descriptor.interface.isCallback():
templateBody += str(CallbackObjectUnwrapper(
# NOTE: This is only used for EventListener at this point
callbackConversion = str(CallbackObjectUnwrapper(
descriptor,
"&${val}.toObject()",
"callbackObj",
"${declName}",
exceptionCode,
codeOnFailure=failureCode))
templateBody += (
"{ // Scope for callbackObj\n"
" JS::Rooted<JSObject*> callbackObj(cx, &${valHandle}.toObject());\n" +
CGIndenter(CGGeneric(callbackConversion)).define() +
"\n}")
elif not descriptor.skipGen and not descriptor.interface.isConsequential() and not descriptor.interface.isExternal():
if failureCode is not None:
templateBody += str(CastableObjectUnwrapper(
@ -3307,7 +3313,7 @@ for (uint32_t i = 0; i < length; ++i) {
# a dictionary, and return failureCode if not.
template = CGIfWrapper(
CGGeneric(failureCode),
"!IsConvertibleToDictionary(cx, &${valHandle}.toObject())").define() + "\n\n"
"!IsObjectValueConvertibleToDictionary(cx, ${valHandle})").define() + "\n\n"
else:
template = ""
@ -7929,8 +7935,10 @@ class CGBindingRoot(CGThing):
# Do codegen for all the descriptors
cgthings.extend([CGDescriptor(x) for x in descriptors])
# Do codegen for all the callback interfaces
cgthings.extend([CGCallbackInterface(x) for x in callbackDescriptors])
# Do codegen for all the callback interfaces. Again, skip
# worker callbacks.
cgthings.extend([CGCallbackInterface(x) for x in callbackDescriptors if
not x.workers])
# Do codegen for JS implemented classes
def getParentDescriptor(desc):

View File

@ -8,6 +8,7 @@ srcdir = @srcdir@
VPATH = @srcdir@
LIBRARY_NAME = dombindings_s
MSVC_ENABLE_PGO := 1
LIBXUL_LIBRARY = 1
FORCE_STATIC_LIB = 1
EXPORT_LIBRARY = 1

View File

@ -17,9 +17,9 @@ nsDOMCameraManager::GetCameraName(uint32_t aDeviceNum, nsCString& aDeviceName)
return NS_ERROR_NOT_IMPLEMENTED;
}
/* [implicit_jscontext] jsval getListOfCameras (); */
/* void getListOfCameras ([optional] out unsigned long aCount, [array, size_is (aCount), retval] out string aCameras); */
NS_IMETHODIMP
nsDOMCameraManager::GetListOfCameras(JSContext* cx, JS::Value* _retval)
nsDOMCameraManager::GetListOfCameras(uint32_t *aCount, char * **aCameras)
{
return NS_ERROR_NOT_IMPLEMENTED;
}

View File

@ -33,7 +33,7 @@ nsresult
nsDOMCameraManager::GetCameraName(uint32_t aDeviceNum, nsCString& aDeviceName)
{
int32_t count = android::Camera::getNumberOfCameras();
DOM_CAMERA_LOGI("getListOfCameras : getNumberOfCameras() returned %d\n", count);
DOM_CAMERA_LOGI("GetCameraName : getNumberOfCameras() returned %d\n", count);
if (aDeviceNum > count) {
DOM_CAMERA_LOGE("GetCameraName : invalid device number");
return NS_ERROR_NOT_AVAILABLE;
@ -63,53 +63,70 @@ nsDOMCameraManager::GetCameraName(uint32_t aDeviceNum, nsCString& aDeviceName)
return NS_OK;
}
/* [implicit_jscontext] jsval getListOfCameras (); */
/* void getListOfCameras ([optional] out unsigned long aCount, [array, size_is (aCount), retval] out string aCameras); */
NS_IMETHODIMP
nsDOMCameraManager::GetListOfCameras(JSContext* cx, JS::Value* _retval)
nsDOMCameraManager::GetListOfCameras(uint32_t *aCount, char * **aCameras)
{
JSObject* a = JS_NewArrayObject(cx, 0, nullptr);
uint32_t index = 0;
int32_t count;
int32_t count = android::Camera::getNumberOfCameras();
if (!a) {
DOM_CAMERA_LOGE("getListOfCameras : Could not create array object");
return NS_ERROR_OUT_OF_MEMORY;
}
count = android::Camera::getNumberOfCameras();
if (count <= 0) {
return NS_ERROR_NOT_AVAILABLE;
DOM_CAMERA_LOGI("GetListOfCameras : getNumberOfCameras() returned %d\n", count);
if (count < 1) {
*aCameras = nullptr;
*aCount = 0;
return NS_OK;
}
DOM_CAMERA_LOGI("getListOfCameras : getNumberOfCameras() returned %d\n", count);
while (count--) {
// Allocate 2 extra slots to reserve space for 'front' and 'back' cameras
// at the front of the array--we will collapse any empty slots below.
int32_t arraySize = count + 2;
char** cameras = static_cast<char**>(NS_Alloc(arraySize * sizeof(char*)));
for (int32_t i = 0; i < arraySize; ++i) {
cameras[i] = nullptr;
}
uint32_t extraIndex = 2;
bool gotFront = false;
bool gotBack = false;
for (int32_t i = 0; i < count; ++i) {
nsCString cameraName;
nsresult result = GetCameraName(count, cameraName);
nsresult result = GetCameraName(i, cameraName);
if (result != NS_OK) {
continue;
}
JSString* v = JS_NewStringCopyZ(cx, cameraName.get());
JS::Value jv;
if (!cameraName.Compare("back")) {
// The first camera we find named 'back' gets slot 0; and the first
// we find named 'front' gets slot 1. All others appear after these.
uint32_t index;
if (!gotBack && !cameraName.Compare("back")) {
index = 0;
} else if (!cameraName.Compare("front")) {
gotBack = true;
} else if (!gotFront && !cameraName.Compare("front")) {
index = 1;
gotFront = true;
} else {
static uint32_t extraIndex = 2;
index = extraIndex++;
}
if (!v) {
DOM_CAMERA_LOGE("getListOfCameras : out of memory populating camera list");
return NS_ERROR_NOT_AVAILABLE;
}
jv = STRING_TO_JSVAL(v);
if (!JS_SetElement(cx, a, index, &jv)) {
DOM_CAMERA_LOGE("getListOfCameras : failed building list of cameras");
return NS_ERROR_NOT_AVAILABLE;
}
MOZ_ASSERT(index < arraySize);
cameras[index] = ToNewCString(cameraName);
}
*_retval = OBJECT_TO_JSVAL(a);
// Make a forward pass over the array to compact it; after this loop,
// 'offset' will contain the number of nullptrs in the array, which
// we use to adjust the value returned in 'aCount'.
int32_t offset = 0;
for (int32_t i = 0; i < arraySize; ++i) {
if (cameras[i] == nullptr) {
offset++;
} else if (offset != 0) {
cameras[i - offset] = cameras[i];
cameras[i] = nullptr;
}
}
MOZ_ASSERT(offset >= 2);
*aCameras = cameras;
*aCount = arraySize - offset;
return NS_OK;
}

View File

@ -420,21 +420,20 @@ interface nsICameraGetCameraCallback : nsISupports
void handleEvent(in nsICameraControl camera);
};
[scriptable, uuid(671ee624-0336-441a-a24e-26b5319f14fe)]
[scriptable, uuid(f01aabcd-b822-423a-b077-3d0748296428)]
interface nsIDOMCameraManager : nsISupports
{
/* get a camera instance; options will be used to specify which
camera to get from the list returned by getListOfCameras(), e.g.:
{
camera: front
camera: "front"
}
*/
[implicit_jscontext]
void getCamera([optional] in jsval aOptions, in nsICameraGetCameraCallback onSuccess, [optional] in nsICameraErrorCallback onError);
/* return a JSON array of camera identifiers, e.g.
/* return an array of camera identifiers, e.g.
[ "front", "back" ]
*/
[implicit_jscontext]
jsval getListOfCameras();
void getListOfCameras([optional] out unsigned long aCount, [retval, array, size_is(aCount)] out string aCameras);
};

View File

@ -5,12 +5,17 @@
var oldVal = false;
// Array Remove - By John Resig (MIT Licensed)
Array.prototype.remove = function(from, to) {
var rest = this.slice((to || from) + 1 || this.length);
this.length = from < 0 ? this.length + from : from;
return this.push.apply(this, rest);
};
Object.defineProperty(Array.prototype, "remove", {
enumerable: false,
configurable: false,
writable: false,
value: function(from, to) {
// Array Remove - By John Resig (MIT Licensed)
var rest = this.slice((to || from) + 1 || this.length);
this.length = from < 0 ? this.length + from : from;
return this.push.apply(this, rest);
}
});
function devicestorage_setup() {

View File

@ -46,8 +46,9 @@ XPIDL_SOURCES += [
'nsIDOMScrollAreaEvent.idl',
'nsIDOMSimpleGestureEvent.idl',
'nsIDOMSmartCardEvent.idl',
'nsIDOMStyleSheetAddedEvent.idl',
'nsIDOMStyleSheetRemovedEvent.idl',
'nsIDOMStyleRuleChangeEvent.idl',
'nsIDOMStyleSheetChangeEvent.idl',
'nsIDOMStyleSheetApplicableStateChangeEvent.idl',
'nsIDOMTouchEvent.idl',
'nsIDOMTransitionEvent.idl',
'nsIDOMUIEvent.idl',

View File

@ -5,23 +5,24 @@
#include "nsIDOMEvent.idl"
interface nsIDOMCSSRule;
interface nsIDOMCSSStyleSheet;
[scriptable, builtinclass, uuid(05a78874-43d7-459d-be32-ba9271527153)]
interface nsIDOMStyleSheetAddedEvent : nsIDOMEvent
[scriptable, builtinclass, uuid(36098d39-b471-47e9-976e-33fee3d81467)]
interface nsIDOMStyleRuleChangeEvent : nsIDOMEvent
{
readonly attribute nsIDOMCSSStyleSheet stylesheet;
readonly attribute boolean documentSheet;
[noscript] void initStyleSheetAddedEvent(in DOMString aTypeArg,
readonly attribute nsIDOMCSSRule rule;
[noscript] void initStyleRuleChangeEvent(in DOMString aTypeArg,
in boolean aCanBubbleArg,
in boolean aCancelableArg,
in nsIDOMCSSStyleSheet aStyleSheet,
in boolean aDocumentSheet);
in nsIDOMCSSRule aRule);
};
dictionary StyleSheetAddedEventInit : EventInit
dictionary StyleRuleChangeEventInit : EventInit
{
nsIDOMCSSStyleSheet stylesheet;
boolean documentSheet;
nsIDOMCSSRule rule;
};

View File

@ -0,0 +1,27 @@
/* -*- 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/. */
#include "nsIDOMEvent.idl"
interface nsIDOMCSSStyleSheet;
[scriptable, builtinclass, uuid(75f27960-fd1a-4e05-8b8b-55d97ea22a9a)]
interface nsIDOMStyleSheetApplicableStateChangeEvent : nsIDOMEvent
{
readonly attribute nsIDOMCSSStyleSheet stylesheet;
readonly attribute boolean applicable;
[noscript] void initStyleSheetApplicableStateChangeEvent(in DOMString aTypeArg,
in boolean aCanBubbleArg,
in boolean aCancelableArg,
in nsIDOMCSSStyleSheet aStyleSheet,
in boolean aApplicable);
};
dictionary StyleSheetApplicableStateChangeEventInit : EventInit
{
nsIDOMCSSStyleSheet stylesheet;
boolean applicable;
};

View File

@ -0,0 +1,27 @@
/* -*- 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/. */
#include "nsIDOMEvent.idl"
interface nsIDOMCSSStyleSheet;
[scriptable, builtinclass, uuid(f94c6a47-58f0-4996-b1db-3ea1d14c4ddd)]
interface nsIDOMStyleSheetChangeEvent : nsIDOMEvent
{
readonly attribute nsIDOMCSSStyleSheet stylesheet;
readonly attribute boolean documentSheet;
[noscript] void initStyleSheetChangeEvent(in DOMString aTypeArg,
in boolean aCanBubbleArg,
in boolean aCancelableArg,
in nsIDOMCSSStyleSheet aStyleSheet,
in boolean aDocumentSheet);
};
dictionary StyleSheetChangeEventInit : EventInit
{
nsIDOMCSSStyleSheet stylesheet;
boolean documentSheet;
};

View File

@ -1,27 +0,0 @@
/* -*- 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/. */
#include "nsIDOMEvent.idl"
interface nsIDOMCSSStyleSheet;
[scriptable, builtinclass, uuid(76a7afe1-5b7b-48ee-aef0-7e89b5b0b8e6)]
interface nsIDOMStyleSheetRemovedEvent : nsIDOMEvent
{
readonly attribute nsIDOMCSSStyleSheet stylesheet;
readonly attribute boolean documentSheet;
[noscript] void initStyleSheetRemovedEvent(in DOMString aTypeArg,
in boolean aCanBubbleArg,
in boolean aCancelableArg,
in nsIDOMCSSStyleSheet aStyleSheet,
in boolean aDocumentSheet);
};
dictionary StyleSheetRemovedEventInit : EventInit
{
nsIDOMCSSStyleSheet stylesheet;
boolean documentSheet;
};

View File

@ -21,6 +21,7 @@ VPATH += $(srcdir)/fallback
endif
LIBRARY_NAME = dom_mobilemessage_s
MSVC_ENABLE_PGO := 1
LIBXUL_LIBRARY = 1
FORCE_STATIC_LIB = 1
FAIL_ON_WARNINGS := 1

View File

@ -11,6 +11,7 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
LIBRARY_NAME = gkplugin
MSVC_ENABLE_PGO := 1
EXPORT_LIBRARY = 1
IS_COMPONENT = 1
MODULE_NAME = nsPluginModule

View File

@ -10,6 +10,7 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
LIBRARY_NAME = domquota_s
MSVC_ENABLE_PGO := 1
LIBXUL_LIBRARY = 1
FORCE_STATIC_LIB = 1
FAIL_ON_WARNINGS := 1

View File

@ -12,6 +12,7 @@ FAIL_ON_WARNINGS := 1
include $(DEPTH)/config/autoconf.mk
LIBRARY_NAME = jsdomevents_s
MSVC_ENABLE_PGO := 1
LIBXUL_LIBRARY = 1

View File

@ -12,6 +12,7 @@ FAIL_ON_WARNINGS := 1
include $(DEPTH)/config/autoconf.mk
LIBRARY_NAME = jsdomstorage_s
MSVC_ENABLE_PGO := 1
LIBXUL_LIBRARY = 1
CPPSRCS = \

View File

@ -546,8 +546,9 @@ var interfaceNamesInGlobalScope =
"SpeechRecognitionError",
"SpeechSynthesisEvent",
"PushManager",
"StyleSheetAddedEvent",
"StyleSheetRemovedEvent",
"StyleRuleChangeEvent",
"StyleSheetChangeEvent",
"StyleSheetApplicableStateChangeEvent",
"MozMobileMessageThread",
"PaymentRequestInfo",
]

View File

@ -0,0 +1,29 @@
/* -*- 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 nsIVariant;
interface DataContainerEvent : Event {
/**
* Return the data associated with the given key.
*
* @param key the key
* @return the data associated with the key
*/
nsIVariant? getData(DOMString? key);
/**
* Set the data for the given key.
*
* @param key the data key
* @param data the data
* @throws NS_ERROR_UNEXPECTED if the method is called during event
* dispatch
*/
[Throws]
void setData(DOMString? key, any data);
};

View File

@ -314,6 +314,9 @@ partial interface Document {
TouchList createTouchList();
[Creator, Func="nsGenericHTMLElement::TouchEventsEnabled"]
TouchList createTouchList(sequence<Touch> touches);
[ChromeOnly]
attribute boolean styleSheetChangeEventsEnabled;
};
Document implements XPathEvaluator;

View File

@ -48,6 +48,7 @@ webidl_files = \
CSSStyleSheet.webidl \
CSSValue.webidl \
CSSValueList.webidl \
DataContainerEvent.webidl \
DelayNode.webidl \
DesktopNotification.webidl \
DeviceMotionEvent.webidl \

View File

@ -10,6 +10,7 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
LIBRARY_NAME = domworkers_s
MSVC_ENABLE_PGO := 1
LIBXUL_LIBRARY = 1
FORCE_STATIC_LIB = 1
FAIL_ON_WARNINGS := 1

View File

@ -1,3 +0,0 @@
ifeq ($(OS_TARGET),WINNT)
NO_PROFILE_GUIDED_OPTIMIZE := 1 # Don't PGO
endif

View File

@ -95,9 +95,8 @@ interface nsIWebBrowserPersist : nsICancelable
* Value indicating the success or failure of the persist
* operation.
*
* @return NS_OK Operation was successful or is still ongoing.
* @return NS_BINDING_ABORTED Operation cancelled.
* @return NS_ERROR_FAILURE Non-specific failure.
* @throws NS_BINDING_ABORTED Operation cancelled.
* @throws NS_ERROR_FAILURE Non-specific failure.
*/
readonly attribute nsresult result;
@ -141,8 +140,7 @@ interface nsIWebBrowserPersist : nsICancelable
* @see nsIURI
* @see nsIInputStream
*
* @return NS_OK Operation has been started.
* @return NS_ERROR_INVALID_ARG One or more arguments was invalid.
* @throws NS_ERROR_INVALID_ARG One or more arguments was invalid.
*/
void saveURI(in nsIURI aURI, in nsISupports aCacheKey,
in nsIURI aReferrer, in nsIInputStream aPostData,
@ -263,8 +261,7 @@ interface nsIWebBrowserPersist : nsICancelable
* @see nsIFile
* @see nsIURI
*
* @return NS_OK Operation has been started.
* @return NS_ERROR_INVALID_ARG One or more arguments was invalid.
* @throws NS_ERROR_INVALID_ARG One or more arguments was invalid.
*/
void saveDocument(in nsIDOMDocument aDocument,
in nsISupports aFile, in nsISupports aDataPath,

View File

@ -1,3 +0,0 @@
ifeq ($(OS_TARGET),WINNT)
NO_PROFILE_GUIDED_OPTIMIZE := 1 # Don't PGO
endif

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