Merge inbound to m-c.

This commit is contained in:
Ryan VanderMeulen 2013-02-28 22:28:03 -05:00
commit 802155ba07
181 changed files with 2325 additions and 1826 deletions

View File

@ -53,13 +53,13 @@ WebappsActor.prototype = {
reg._registerActivities(manifest, aApp, true);
reg._saveApps(function() {
aApp.manifest = manifest;
reg.broadcastMessage("Webapps:AddApp", { id: aId, app: aApp });
reg.broadcastMessage("Webapps:Install:Return:OK",
{ app: aApp,
oid: "foo",
requestID: "bar"
});
delete aApp.manifest;
reg.broadcastMessage("Webapps:AddApp", { id: aId, app: aApp });
self.conn.send({ from: self.actorID,
type: "webappsEvent",
appId: aId

View File

@ -212,7 +212,6 @@
@BINPATH@/components/dom_xbl.xpt
@BINPATH@/components/dom_xpath.xpt
@BINPATH@/components/dom_xul.xpt
@BINPATH@/components/dom_loadsave.xpt
@BINPATH@/components/dom_time.xpt
@BINPATH@/components/downloads.xpt
@BINPATH@/components/editor.xpt

View File

@ -202,6 +202,10 @@ XPCOMUtils.defineLazyGetter(this, "PageMenu", function() {
* one listener that calls all real handlers.
*/
function pageShowEventHandlers(event) {
// Filter out events that are not about the document load we are interested in
if (event.target != content.document)
return;
charsetLoadListener();
XULBrowserWindow.asyncUpdateUI();
@ -1338,6 +1342,15 @@ var gBrowserInit = {
var isLoadingBlank = isBlankPageURL(uriToLoad);
gBrowser.addEventListener("pageshow", function(event) {
// The XULWindow::mPrimaryContentShell isn't up-to-date when pageshow
// is fired by a swapFrameLoaders() call (i.e. when we swap the docShells
// of two tabs). Get around this by using setTimeout - everything should
// be in the right state on the next tick.
if (content)
setTimeout(pageShowEventHandlers, 0, event);
}, true);
if (uriToLoad && uriToLoad != "about:blank") {
if (uriToLoad instanceof Ci.nsISupportsArray) {
let count = uriToLoad.Count();
@ -1396,12 +1409,6 @@ var gBrowserInit = {
AddonManager.addAddonListener(AddonsMgrListener);
WebrtcIndicator.init();
gBrowser.addEventListener("pageshow", function(event) {
// Filter out events that are not about the document load we are interested in
if (content && event.target == content.document)
setTimeout(pageShowEventHandlers, 0, event);
}, true);
// Ensure login manager is up and running.
Services.logins;

View File

@ -185,6 +185,7 @@ _BROWSER_FILES = \
browser_pluginnotification.js \
browser_plugins_added_dynamically.js \
browser_CTPScriptPlugin.js \
browser_CTP_drag_drop.js \
browser_pluginplaypreview.js \
browser_pluginplaypreview2.js \
browser_private_browsing_window.js \

View File

@ -0,0 +1,53 @@
let gHttpTestRoot = getRootDirectory(gTestPath).replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
let gNextTest = null;
let gNewWindow = null;
Components.utils.import("resource://gre/modules/Services.jsm");
function test() {
waitForExplicitFinish();
registerCleanupFunction(function() { Services.prefs.clearUserPref("plugins.click_to_play"); });
Services.prefs.setBoolPref("plugins.click_to_play", true);
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.selectedBrowser.addEventListener("PluginBindingAttached", handleEvent, true, true);
gNextTest = part1;
gBrowser.selectedBrowser.contentDocument.location = gHttpTestRoot + "plugin_test.html";
}
function handleEvent() {
gNextTest();
}
function part1() {
gBrowser.selectedBrowser.removeEventListener("PluginBindingAttached", handleEvent);
ok(PopupNotifications.getNotification("click-to-play-plugins", gBrowser.selectedBrowser), "Should have a click-to-play notification in the initial tab");
gNextTest = part2;
gNewWindow = gBrowser.replaceTabWithWindow(gBrowser.selectedTab);
gNewWindow.addEventListener("load", handleEvent, true);
}
function part2() {
gNewWindow.removeEventListener("load", handleEvent);
let condition = function() PopupNotifications.getNotification("click-to-play-plugins", gNewWindow.gBrowser.selectedBrowser);
waitForCondition(condition, part3, "Waited too long for click-to-play notification");
}
function part3() {
ok(PopupNotifications.getNotification("click-to-play-plugins", gNewWindow.gBrowser.selectedBrowser), "Should have a click-to-play notification in the tab in the new window");
ok(!PopupNotifications.getNotification("click-to-play-plugins", gBrowser.selectedBrowser), "Should not have a click-to-play notification in the old window now");
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.swapBrowsersAndCloseOther(gBrowser.selectedTab, gNewWindow.gBrowser.selectedTab);
let condition = function() PopupNotifications.getNotification("click-to-play-plugins", gBrowser.selectedBrowser);
waitForCondition(condition, part4, "Waited too long for click-to-play notification");
}
function part4() {
ok(PopupNotifications.getNotification("click-to-play-plugins", gBrowser.selectedBrowser), "Should have a click-to-play notification in the initial tab again");
gBrowser.removeCurrentTab();
finish();
}

View File

@ -328,11 +328,11 @@ function openLinkIn(url, where, params) {
// (e.g. "javascript:window.open('');").
var fm = Components.classes["@mozilla.org/focus-manager;1"].
getService(Components.interfaces.nsIFocusManager);
if (window == fm.activeWindow || isBlankPageURL(url))
if (window == fm.activeWindow || w.isBlankPageURL(url))
w.focus();
w.gBrowser.selectedBrowser.focus();
if (!loadInBackground && isBlankPageURL(url))
if (!loadInBackground && w.isBlankPageURL(url))
w.focusAndSelectUrlBar();
}

View File

@ -24,39 +24,56 @@ function test()
let scriptShown = false;
let framesAdded = false;
let resumed = false;
let testStarted = false;
debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
gTab = aTab;
gDebuggee = aDebuggee;
gPane = aPane;
gDebugger = gPane.panelWin;
resumed = true;
gTab = addTab(TAB_URL, function onAddTab() {
info("tab added");
gDebuggee = gTab.linkedBrowser.contentWindow.wrappedJSObject;
let target = TargetFactory.forTab(gTab);
gDevTools.showToolbox(target, "jsdebugger").then(function(toolbox) {
info("jsdebugger panel opened");
gPane = toolbox.getCurrentPanel();
gDebugger = gPane.panelWin;
gDebugger.addEventListener("Debugger:AfterScriptsAdded",
onAfterScriptsAdded);
});
});
function onAfterScriptsAdded()
{
info("scripts added");
gDebugger.removeEventListener("Debugger:AfterScriptsAdded",
onAfterScriptsAdded, true);
gDebugger.addEventListener("Debugger:SourceShown", onScriptShown);
gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
framesAdded = true;
executeSoon(startTest);
});
gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded",
function onFramesAdded() {
info("frames added");
framesAdded = true;
executeSoon(startTest);
});
executeSoon(function() {
gDebuggee.firstCall();
});
});
}
function onScriptShown(aEvent)
{
scriptShown = aEvent.detail.url.indexOf("-02.js") != -1;
info("script shown " + aEvent.detail.url);
executeSoon(startTest);
}
function startTest()
{
if (scriptShown && framesAdded && resumed && !testStarted) {
if (scriptShown && framesAdded && !testStarted) {
gDebugger.removeEventListener("Debugger:SourceShown", onScriptShown);
testStarted = true;
info("test started");
Services.tm.currentThread.dispatch({ run: performTest }, 0);
}
}

View File

@ -474,6 +474,7 @@ Toolbox.prototype = {
iframe.className = "toolbox-panel-iframe";
iframe.id = "toolbox-panel-iframe-" + id;
iframe.setAttribute("flex", 1);
iframe.setAttribute("forceOwnRefreshDriver", "");
let vbox = this.doc.getElementById("toolbox-panel-" + id);
vbox.appendChild(iframe);

View File

@ -28,5 +28,5 @@
modifiers="accel"/>
</keyset>
<iframe id="toolbox-iframe" flex="1"></iframe>
<iframe id="toolbox-iframe" flex="1" forceOwnRefreshDriver=""></iframe>
</window>

View File

@ -211,7 +211,6 @@
@BINPATH@/components/dom_xbl.xpt
@BINPATH@/components/dom_xpath.xpt
@BINPATH@/components/dom_xul.xpt
@BINPATH@/components/dom_loadsave.xpt
@BINPATH@/components/downloads.xpt
@BINPATH@/components/editor.xpt
@BINPATH@/components/embed_base.xpt

View File

@ -26,26 +26,10 @@ const BrowserTouchHandler = {
json: aMessage.json,
target: aMessage.target };
// Touch input selection handling
if (!InputSourceHelper.isPrecise) {
if (SelectionHelperUI.isActive) {
// Selection handler is active.
if (aMessage.json.types.indexOf("selected-text") != -1) {
// long tap on existing selection. The incoming message has the
// string data, so reset the selection handler and invoke the
// context menu.
SelectionHelperUI.closeEditSession();
} else {
// Weird, context menu request with no selected text and
// SelectionHelperUI is active? Might be a bug, warn. Fall
// through anyway, the context menu handler will look in the
// incoming message for content types it knows how to handle.
Util.dumpLn("long tap on empty selection with SelectionHelperUI active?");
SelectionHelperUI.closeEditSession();
}
} else if (SelectionHelperUI.canHandle(aMessage)) {
SelectionHelperUI.openEditSession(aMessage);
return;
}
if (!InputSourceHelper.isPrecise && !SelectionHelperUI.isActive &&
SelectionHelperUI.canHandle(aMessage)) {
SelectionHelperUI.openEditSession(aMessage);
return;
}
// Check to see if we have context menu item(s) that apply to what

View File

@ -33,6 +33,7 @@ var ContextCommands = {
this.clipboard.copyString(ContextMenuUI.popupState.string,
this.docRef);
this.showToast(Strings.browser.GetStringFromName("selectionHelper.textCopied"));
SelectionHelperUI.closeEditSessionAndClear();
}
} else {
// chrome
@ -52,6 +53,7 @@ var ContextCommands = {
let y = ContextMenuUI.popupState.y;
let json = {x: x, y: y, command: "paste" };
target.messageManager.sendAsyncMessage("Browser:ContextCommand", json);
SelectionHelperUI.closeEditSessionAndClear();
} else {
// chrome
target.editor.paste(Ci.nsIClipboard.kGlobalClipboard);

View File

@ -79,10 +79,10 @@ XPCOMUtils.defineLazyServiceGetter(this, "CrashReporter",
* so it is not possible to set a lazy getter for Geometry.jsm.
*/
Cu.import("resource://gre/modules/Geometry.jsm");
/*
* Browser scripts
*/
let ScriptContexts = {};
[
["WebProgress", "chrome://browser/content/WebProgress.js"],
["FindHelperUI", "chrome://browser/content/helperui/FindHelperUI.js"],
@ -134,12 +134,16 @@ Cu.import("resource://gre/modules/Geometry.jsm");
].forEach(function (aScript) {
let [name, script] = aScript;
XPCOMUtils.defineLazyGetter(window, name, function() {
let sandbox = {};
Services.scriptloader.loadSubScript(script, sandbox);
let sandbox;
if (script in ScriptContexts) {
sandbox = ScriptContexts[script];
} else {
sandbox = ScriptContexts[script] = {};
Services.scriptloader.loadSubScript(script, sandbox);
}
return sandbox[name];
});
});
#ifdef MOZ_SERVICES_SYNC
XPCOMUtils.defineLazyGetter(this, "Weave", function() {
Components.utils.import("resource://services-sync/main.js");

View File

@ -419,7 +419,11 @@
</deck>
</vbox>
<flyoutpanel id="about-flyoutpanel" headertext="&aboutHeader.title;">
<!-- Selection overlay - this should be below any content that can have selectable text -->
<!-- onclick addresses dom bug 835175, str in bug 832957 -->
<box onclick="false" class="selection-overlay-hidden" id="selection-overlay"/>
<flyoutpanel id="about-flyoutpanel" headertext="&aboutHeader.title;">
<label id="about-product-label" value="&aboutHeader.product.label;"/>
<label value="&aboutHeader.company.label;"/>
#expand <label id="about-version-label">__MOZ_APP_VERSION__</label>
@ -679,10 +683,6 @@
<description id="alerts-text" flex="1"/>
</vbox>
</hbox>
<!-- Selection overlay - this should be below any content that can have selectable text -->
<!-- onclick addresses dom bug 835175, str in bug 832957 -->
<box onclick="false" class="selection-overlay-hidden" id="selection-overlay"/>
</stack>
<svg:svg height="0">

View File

@ -345,8 +345,8 @@ var SelectionHelperUI = {
messageManager.addMessageListener("Content:SelectionDebugRect", this);
// selection related events
window.addEventListener("click", this, true);
window.addEventListener("dblclick", this, true);
window.addEventListener("click", this, false);
window.addEventListener("dblclick", this, false);
// Picking up scroll attempts
window.addEventListener("touchstart", this, true);
@ -374,8 +374,8 @@ var SelectionHelperUI = {
messageManager.removeMessageListener("Content:SelectionFail", this);
messageManager.removeMessageListener("Content:SelectionDebugRect", this);
window.removeEventListener("click", this, true);
window.removeEventListener("dblclick", this, true);
window.removeEventListener("click", this, false);
window.removeEventListener("dblclick", this, false);
window.removeEventListener("touchstart", this, true);
window.removeEventListener("touchend", this, true);

View File

@ -19,8 +19,6 @@ DEPRECATED_OPERATION(OwnerElement)
DEPRECATED_OPERATION(NodeValue)
DEPRECATED_OPERATION(TextContent)
DEPRECATED_OPERATION(EnablePrivilege)
DEPRECATED_OPERATION(Position)
DEPRECATED_OPERATION(TotalSize)
DEPRECATED_OPERATION(InputEncoding)
DEPRECATED_OPERATION(MozBeforePaint)
DEPRECATED_OPERATION(DOMExceptionCode)

View File

@ -96,7 +96,9 @@ class GlobalObject;
class HTMLBodyElement;
class Link;
class NodeFilter;
class NodeIterator;
class ProcessingInstruction;
class TreeWalker;
class UndoManager;
template<typename> class Sequence;
@ -1939,18 +1941,18 @@ public:
already_AddRefed<nsIDOMEvent> CreateEvent(const nsAString& aEventType,
mozilla::ErrorResult& rv) const;
already_AddRefed<nsRange> CreateRange(mozilla::ErrorResult& rv);
already_AddRefed<nsIDOMNodeIterator>
already_AddRefed<mozilla::dom::NodeIterator>
CreateNodeIterator(nsINode& aRoot, uint32_t aWhatToShow,
mozilla::dom::NodeFilter* aFilter,
mozilla::ErrorResult& rv) const;
already_AddRefed<nsIDOMNodeIterator>
already_AddRefed<mozilla::dom::NodeIterator>
CreateNodeIterator(nsINode& aRoot, uint32_t aWhatToShow,
const mozilla::dom::NodeFilterHolder& aFilter,
mozilla::ErrorResult& rv) const;
already_AddRefed<nsIDOMTreeWalker>
already_AddRefed<mozilla::dom::TreeWalker>
CreateTreeWalker(nsINode& aRoot, uint32_t aWhatToShow,
mozilla::dom::NodeFilter* aFilter, mozilla::ErrorResult& rv) const;
already_AddRefed<nsIDOMTreeWalker>
already_AddRefed<mozilla::dom::TreeWalker>
CreateTreeWalker(nsINode& aRoot, uint32_t aWhatToShow,
const mozilla::dom::NodeFilterHolder& aFilter,
mozilla::ErrorResult& rv) const;

View File

@ -51,7 +51,9 @@ EXPORTS_mozilla/dom = \
DOMImplementation.h \
EventSource.h \
Link.h \
NodeIterator.h \
Text.h \
TreeWalker.h \
$(NULL)
CPPSRCS = \
@ -107,7 +109,7 @@ CPPSRCS = \
nsNoDataProtocolContentPolicy.cpp \
nsNodeInfo.cpp \
nsNodeInfoManager.cpp \
nsNodeIterator.cpp \
NodeIterator.cpp \
nsNodeUtils.cpp \
nsObjectLoadingContent.cpp \
nsPlainTextSerializer.cpp \
@ -126,7 +128,7 @@ CPPSRCS = \
nsTextNode.cpp \
nsTraversal.cpp \
nsTreeSanitizer.cpp \
nsTreeWalker.cpp \
TreeWalker.cpp \
nsViewportInfo.cpp \
WebSocket.cpp \
nsXHTMLContentSerializer.cpp \

View File

@ -8,10 +8,9 @@
* Implementation of DOM Traversal's nsIDOMNodeIterator
*/
#include "nsNodeIterator.h"
#include "mozilla/dom/NodeIterator.h"
#include "nsIDOMNode.h"
#include "nsIDOMNodeFilter.h"
#include "nsError.h"
#include "nsIContent.h"
@ -19,21 +18,23 @@
#include "nsDOMClassInfoID.h"
#include "nsContentUtils.h"
#include "nsCOMPtr.h"
#include "mozilla/dom/NodeFilterBinding.h"
#include "mozilla/dom/NodeIteratorBinding.h"
using namespace mozilla::dom;
DOMCI_DATA(NodeIterator, mozilla::dom::NodeIterator)
namespace mozilla {
namespace dom {
/*
* NodePointer implementation
*/
nsNodeIterator::NodePointer::NodePointer(nsINode *aNode,
bool aBeforeNode) :
NodeIterator::NodePointer::NodePointer(nsINode *aNode, bool aBeforeNode) :
mNode(aNode),
mBeforeNode(aBeforeNode)
{
}
bool nsNodeIterator::NodePointer::MoveToNext(nsINode *aRoot)
bool NodeIterator::NodePointer::MoveToNext(nsINode *aRoot)
{
if (!mNode)
return false;
@ -52,7 +53,7 @@ bool nsNodeIterator::NodePointer::MoveToNext(nsINode *aRoot)
return MoveForward(aRoot, mNode);
}
bool nsNodeIterator::NodePointer::MoveToPrevious(nsINode *aRoot)
bool NodeIterator::NodePointer::MoveToPrevious(nsINode *aRoot)
{
if (!mNode)
return false;
@ -70,10 +71,10 @@ bool nsNodeIterator::NodePointer::MoveToPrevious(nsINode *aRoot)
return true;
}
void nsNodeIterator::NodePointer::AdjustAfterRemoval(nsINode *aRoot,
nsINode *aContainer,
nsIContent *aChild,
nsIContent *aPreviousSibling)
void NodeIterator::NodePointer::AdjustAfterRemoval(nsINode *aRoot,
nsINode *aContainer,
nsIContent *aChild,
nsIContent *aPreviousSibling)
{
// If mNode is null or the root there is nothing to do.
if (!mNode || mNode == aRoot)
@ -105,7 +106,7 @@ void nsNodeIterator::NodePointer::AdjustAfterRemoval(nsINode *aRoot,
MoveBackward(aContainer, aPreviousSibling);
}
bool nsNodeIterator::NodePointer::MoveForward(nsINode *aRoot, nsINode *aNode)
bool NodeIterator::NodePointer::MoveForward(nsINode *aRoot, nsINode *aNode)
{
while (1) {
if (aNode == aRoot)
@ -122,7 +123,7 @@ bool nsNodeIterator::NodePointer::MoveForward(nsINode *aRoot, nsINode *aNode)
return false;
}
void nsNodeIterator::NodePointer::MoveBackward(nsINode *aParent, nsINode *aNode)
void NodeIterator::NodePointer::MoveBackward(nsINode *aParent, nsINode *aNode)
{
if (aNode) {
do {
@ -138,9 +139,9 @@ void nsNodeIterator::NodePointer::MoveBackward(nsINode *aParent, nsINode *aNode)
* Factories, constructors and destructors
*/
nsNodeIterator::nsNodeIterator(nsINode *aRoot,
uint32_t aWhatToShow,
const NodeFilterHolder &aFilter) :
NodeIterator::NodeIterator(nsINode *aRoot,
uint32_t aWhatToShow,
const NodeFilterHolder &aFilter) :
nsTraversal(aRoot, aWhatToShow, aFilter),
mDetached(false),
mPointer(mRoot, true)
@ -148,7 +149,7 @@ nsNodeIterator::nsNodeIterator(nsINode *aRoot,
aRoot->AddMutationObserver(this);
}
nsNodeIterator::~nsNodeIterator()
NodeIterator::~NodeIterator()
{
/* destructor code */
if (!mDetached && mRoot)
@ -159,50 +160,44 @@ nsNodeIterator::~nsNodeIterator()
* nsISupports and cycle collection stuff
*/
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsNodeIterator)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(NodeIterator)
if (!tmp->mDetached && tmp->mRoot)
tmp->mRoot->RemoveMutationObserver(tmp);
NS_IMPL_CYCLE_COLLECTION_UNLINK(mRoot)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mFilter)
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsNodeIterator)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(NodeIterator)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mRoot)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mFilter)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
DOMCI_DATA(NodeIterator, nsNodeIterator)
// QueryInterface implementation for nsNodeIterator
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsNodeIterator)
// QueryInterface implementation for NodeIterator
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(NodeIterator)
NS_INTERFACE_MAP_ENTRY(nsIDOMNodeIterator)
NS_INTERFACE_MAP_ENTRY(nsIMutationObserver)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMNodeIterator)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(NodeIterator)
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsNodeIterator)
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsNodeIterator)
NS_IMPL_CYCLE_COLLECTING_ADDREF(NodeIterator)
NS_IMPL_CYCLE_COLLECTING_RELEASE(NodeIterator)
/* readonly attribute nsIDOMNode root; */
NS_IMETHODIMP nsNodeIterator::GetRoot(nsIDOMNode * *aRoot)
NS_IMETHODIMP NodeIterator::GetRoot(nsIDOMNode * *aRoot)
{
if (mRoot)
return CallQueryInterface(mRoot, aRoot);
*aRoot = nullptr;
NS_ADDREF(*aRoot = Root()->AsDOMNode());
return NS_OK;
}
/* readonly attribute unsigned long whatToShow; */
NS_IMETHODIMP nsNodeIterator::GetWhatToShow(uint32_t *aWhatToShow)
NS_IMETHODIMP NodeIterator::GetWhatToShow(uint32_t *aWhatToShow)
{
*aWhatToShow = mWhatToShow;
*aWhatToShow = WhatToShow();
return NS_OK;
}
/* readonly attribute nsIDOMNodeFilter filter; */
NS_IMETHODIMP nsNodeIterator::GetFilter(nsIDOMNodeFilter **aFilter)
NS_IMETHODIMP NodeIterator::GetFilter(nsIDOMNodeFilter **aFilter)
{
NS_ENSURE_ARG_POINTER(aFilter);
@ -212,28 +207,25 @@ NS_IMETHODIMP nsNodeIterator::GetFilter(nsIDOMNodeFilter **aFilter)
}
/* nsIDOMNode nextNode () raises (DOMException); */
NS_IMETHODIMP nsNodeIterator::NextNode(nsIDOMNode **_retval)
NS_IMETHODIMP NodeIterator::NextNode(nsIDOMNode **_retval)
{
return NextOrPrevNode(&NodePointer::MoveToNext, _retval);
return ImplNodeGetter(&NodeIterator::NextNode, _retval);
}
/* nsIDOMNode previousNode () raises (DOMException); */
NS_IMETHODIMP nsNodeIterator::PreviousNode(nsIDOMNode **_retval)
NS_IMETHODIMP NodeIterator::PreviousNode(nsIDOMNode **_retval)
{
return NextOrPrevNode(&NodePointer::MoveToPrevious, _retval);
return ImplNodeGetter(&NodeIterator::PreviousNode, _retval);
}
nsresult
nsNodeIterator::NextOrPrevNode(NodePointer::MoveToMethodType aMove,
nsIDOMNode **_retval)
already_AddRefed<nsINode>
NodeIterator::NextOrPrevNode(NodePointer::MoveToMethodType aMove,
ErrorResult& aResult)
{
nsresult rv;
int16_t filtered;
*_retval = nullptr;
if (mDetached || mInAcceptNode)
return NS_ERROR_DOM_INVALID_STATE_ERR;
if (mDetached || mInAcceptNode) {
aResult.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
return nullptr;
}
mWorkingPointer = mPointer;
@ -245,23 +237,27 @@ nsNodeIterator::NextOrPrevNode(NodePointer::MoveToMethodType aMove,
while ((mWorkingPointer.*aMove)(mRoot)) {
nsCOMPtr<nsINode> testNode = mWorkingPointer.mNode;
rv = TestNode(testNode, &filtered);
NS_ENSURE_SUCCESS(rv, rv);
int16_t filtered = TestNode(testNode, aResult);
if (aResult.Failed()) {
return nullptr;
}
if (mDetached)
return NS_ERROR_DOM_INVALID_STATE_ERR;
if (mDetached) {
aResult.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
return nullptr;
}
if (filtered == nsIDOMNodeFilter::FILTER_ACCEPT) {
mPointer = mWorkingPointer;
return CallQueryInterface(testNode, _retval);
return testNode.forget();
}
}
return NS_OK;
return nullptr;
}
/* void detach (); */
NS_IMETHODIMP nsNodeIterator::Detach(void)
NS_IMETHODIMP NodeIterator::Detach(void)
{
if (!mDetached) {
mRoot->RemoveMutationObserver(this);
@ -275,19 +271,17 @@ NS_IMETHODIMP nsNodeIterator::Detach(void)
}
/* readonly attribute nsIDOMNode referenceNode; */
NS_IMETHODIMP nsNodeIterator::GetReferenceNode(nsIDOMNode * *aRefNode)
NS_IMETHODIMP NodeIterator::GetReferenceNode(nsIDOMNode * *aRefNode)
{
if (mPointer.mNode)
return CallQueryInterface(mPointer.mNode, aRefNode);
*aRefNode = nullptr;
nsCOMPtr<nsIDOMNode> node(do_QueryInterface(GetReferenceNode()));
node.forget(aRefNode);
return NS_OK;
}
/* readonly attribute boolean pointerBeforeReferenceNode; */
NS_IMETHODIMP nsNodeIterator::GetPointerBeforeReferenceNode(bool *aBeforeNode)
NS_IMETHODIMP NodeIterator::GetPointerBeforeReferenceNode(bool *aBeforeNode)
{
*aBeforeNode = mPointer.mBeforeNode;
*aBeforeNode = PointerBeforeReferenceNode();
return NS_OK;
}
@ -295,14 +289,23 @@ NS_IMETHODIMP nsNodeIterator::GetPointerBeforeReferenceNode(bool *aBeforeNode)
* nsIMutationObserver interface
*/
void nsNodeIterator::ContentRemoved(nsIDocument *aDocument,
nsIContent *aContainer,
nsIContent *aChild,
int32_t aIndexInContainer,
nsIContent *aPreviousSibling)
void NodeIterator::ContentRemoved(nsIDocument *aDocument,
nsIContent *aContainer,
nsIContent *aChild,
int32_t aIndexInContainer,
nsIContent *aPreviousSibling)
{
nsINode *container = NODE_FROM(aContainer, aDocument);
mPointer.AdjustAfterRemoval(mRoot, container, aChild, aPreviousSibling);
mWorkingPointer.AdjustAfterRemoval(mRoot, container, aChild, aPreviousSibling);
}
JSObject*
NodeIterator::WrapObject(JSContext *cx, JSObject *scope)
{
return NodeIteratorBinding::Wrap(cx, scope, this);
}
} // namespace dom
} // namespace mozilla

View File

@ -0,0 +1,121 @@
/* -*- 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/. */
/*
* Implementation of DOM Traversal's nsIDOMNodeIterator
*/
#ifndef mozilla_dom_NodeIterator_h
#define mozilla_dom_NodeIterator_h
#include "nsIDOMNodeIterator.h"
#include "nsTraversal.h"
#include "nsCycleCollectionParticipant.h"
#include "nsStubMutationObserver.h"
class nsINode;
class nsIDOMNode;
namespace mozilla {
namespace dom {
class NodeIterator MOZ_FINAL : public nsIDOMNodeIterator,
public nsTraversal,
public nsStubMutationObserver
{
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_NSIDOMNODEITERATOR
NodeIterator(nsINode *aRoot,
uint32_t aWhatToShow,
const NodeFilterHolder &aFilter);
virtual ~NodeIterator();
NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(NodeIterator, nsIDOMNodeIterator)
// WebIDL API
nsINode* Root() const
{
return mRoot;
}
nsINode* GetReferenceNode() const
{
return mPointer.mNode;
}
bool PointerBeforeReferenceNode() const
{
return mPointer.mBeforeNode;
}
uint32_t WhatToShow() const
{
return mWhatToShow;
}
already_AddRefed<NodeFilter> GetFilter()
{
return mFilter.ToWebIDLCallback();
}
already_AddRefed<nsINode> NextNode(ErrorResult& aResult)
{
return NextOrPrevNode(&NodePointer::MoveToNext, aResult);
}
already_AddRefed<nsINode> PreviousNode(ErrorResult& aResult)
{
return NextOrPrevNode(&NodePointer::MoveToPrevious, aResult);
}
// The XPCOM Detach() is fine for our purposes
JSObject* WrapObject(JSContext *cx, JSObject *scope);
private:
struct NodePointer {
NodePointer() : mNode(nullptr) {}
NodePointer(nsINode *aNode, bool aBeforeNode);
typedef bool (NodePointer::*MoveToMethodType)(nsINode*);
bool MoveToNext(nsINode *aRoot);
bool MoveToPrevious(nsINode *aRoot);
bool MoveForward(nsINode *aRoot, nsINode *aNode);
void MoveBackward(nsINode *aParent, nsINode *aNode);
void AdjustAfterRemoval(nsINode *aRoot, nsINode *aContainer, nsIContent *aChild, nsIContent *aPreviousSibling);
void Clear() { mNode = nullptr; }
nsINode *mNode;
bool mBeforeNode;
};
// Implementation for some of our XPCOM getters
typedef already_AddRefed<nsINode> (NodeIterator::*NodeGetter)(ErrorResult&);
inline nsresult ImplNodeGetter(NodeGetter aGetter, nsIDOMNode** aRetval)
{
mozilla::ErrorResult rv;
nsCOMPtr<nsINode> node = (this->*aGetter)(rv);
if (rv.Failed()) {
return rv.ErrorCode();
}
*aRetval = node ? node.forget().get()->AsDOMNode() : nullptr;
return NS_OK;
}
// Have to return a strong ref, because the act of testing the node can
// remove it from the DOM so we're holding the only ref to it.
already_AddRefed<nsINode>
NextOrPrevNode(NodePointer::MoveToMethodType aMove, ErrorResult& aResult);
bool mDetached;
NodePointer mPointer;
NodePointer mWorkingPointer;
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_NodeIterator_h

View File

@ -8,31 +8,33 @@
* Implementation of DOM Traversal's nsIDOMTreeWalker
*/
#include "nsTreeWalker.h"
#include "mozilla/dom/TreeWalker.h"
#include "nsIDOMNode.h"
#include "nsIDOMNodeFilter.h"
#include "nsError.h"
#include "nsINode.h"
#include "nsDOMClassInfoID.h"
#include "nsContentUtils.h"
#include "mozilla/dom/NodeFilterBinding.h"
#include "mozilla/dom/TreeWalkerBinding.h"
using namespace mozilla::dom;
DOMCI_DATA(TreeWalker, mozilla::dom::TreeWalker)
namespace mozilla {
namespace dom {
/*
* Factories, constructors and destructors
*/
nsTreeWalker::nsTreeWalker(nsINode *aRoot,
uint32_t aWhatToShow,
const NodeFilterHolder &aFilter) :
TreeWalker::TreeWalker(nsINode *aRoot,
uint32_t aWhatToShow,
const NodeFilterHolder &aFilter) :
nsTraversal(aRoot, aWhatToShow, aFilter),
mCurrentNode(aRoot)
{
}
nsTreeWalker::~nsTreeWalker()
TreeWalker::~TreeWalker()
{
/* destructor code */
}
@ -41,19 +43,20 @@ nsTreeWalker::~nsTreeWalker()
* nsISupports and cycle collection stuff
*/
NS_IMPL_CYCLE_COLLECTION_3(nsTreeWalker, mFilter, mCurrentNode, mRoot)
NS_IMPL_CYCLE_COLLECTION_3(TreeWalker, mFilter, mCurrentNode, mRoot)
DOMCI_DATA(TreeWalker, nsTreeWalker)
// QueryInterface implementation for nsTreeWalker
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsTreeWalker)
// QueryInterface implementation for TreeWalker
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TreeWalker)
NS_INTERFACE_MAP_ENTRY(nsIDOMTreeWalker)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMTreeWalker)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(TreeWalker)
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsTreeWalker)
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsTreeWalker)
// Have to pass in dom::TreeWalker because a11y has an a11y::TreeWalker that
// passes TreeWalker so refcount logging would get confused on the name
// collision.
NS_IMPL_CYCLE_COLLECTING_ADDREF(dom::TreeWalker)
NS_IMPL_CYCLE_COLLECTING_RELEASE(dom::TreeWalker)
@ -62,26 +65,21 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(nsTreeWalker)
*/
/* readonly attribute nsIDOMNode root; */
NS_IMETHODIMP nsTreeWalker::GetRoot(nsIDOMNode * *aRoot)
NS_IMETHODIMP TreeWalker::GetRoot(nsIDOMNode * *aRoot)
{
if (mRoot) {
return CallQueryInterface(mRoot, aRoot);
}
*aRoot = nullptr;
NS_ADDREF(*aRoot = Root()->AsDOMNode());
return NS_OK;
}
/* readonly attribute unsigned long whatToShow; */
NS_IMETHODIMP nsTreeWalker::GetWhatToShow(uint32_t *aWhatToShow)
NS_IMETHODIMP TreeWalker::GetWhatToShow(uint32_t *aWhatToShow)
{
*aWhatToShow = mWhatToShow;
*aWhatToShow = WhatToShow();
return NS_OK;
}
/* readonly attribute nsIDOMNodeFilter filter; */
NS_IMETHODIMP nsTreeWalker::GetFilter(nsIDOMNodeFilter * *aFilter)
NS_IMETHODIMP TreeWalker::GetFilter(nsIDOMNodeFilter * *aFilter)
{
NS_ENSURE_ARG_POINTER(aFilter);
@ -91,7 +89,7 @@ NS_IMETHODIMP nsTreeWalker::GetFilter(nsIDOMNodeFilter * *aFilter)
}
/* attribute nsIDOMNode currentNode; */
NS_IMETHODIMP nsTreeWalker::GetCurrentNode(nsIDOMNode * *aCurrentNode)
NS_IMETHODIMP TreeWalker::GetCurrentNode(nsIDOMNode * *aCurrentNode)
{
if (mCurrentNode) {
return CallQueryInterface(mCurrentNode, aCurrentNode);
@ -101,7 +99,7 @@ NS_IMETHODIMP nsTreeWalker::GetCurrentNode(nsIDOMNode * *aCurrentNode)
return NS_OK;
}
NS_IMETHODIMP nsTreeWalker::SetCurrentNode(nsIDOMNode * aCurrentNode)
NS_IMETHODIMP TreeWalker::SetCurrentNode(nsIDOMNode * aCurrentNode)
{
NS_ENSURE_TRUE(aCurrentNode, NS_ERROR_DOM_NOT_SUPPORTED_ERR);
NS_ENSURE_TRUE(mRoot, NS_ERROR_UNEXPECTED);
@ -109,11 +107,20 @@ NS_IMETHODIMP nsTreeWalker::SetCurrentNode(nsIDOMNode * aCurrentNode)
nsCOMPtr<nsINode> node = do_QueryInterface(aCurrentNode);
NS_ENSURE_TRUE(node, NS_ERROR_UNEXPECTED);
nsresult rv = nsContentUtils::CheckSameOrigin(mRoot, node);
NS_ENSURE_SUCCESS(rv, rv);
ErrorResult rv;
SetCurrentNode(*node, rv);
return rv.ErrorCode();
}
mCurrentNode.swap(node);
return NS_OK;
void
TreeWalker::SetCurrentNode(nsINode& aNode, ErrorResult& aResult)
{
aResult = nsContentUtils::CheckSameOrigin(mRoot, &aNode);
if (aResult.Failed()) {
return;
}
mCurrentNode = &aNode;
}
/*
@ -121,112 +128,151 @@ NS_IMETHODIMP nsTreeWalker::SetCurrentNode(nsIDOMNode * aCurrentNode)
*/
/* nsIDOMNode parentNode (); */
NS_IMETHODIMP nsTreeWalker::ParentNode(nsIDOMNode **_retval)
NS_IMETHODIMP TreeWalker::ParentNode(nsIDOMNode **_retval)
{
*_retval = nullptr;
nsresult rv;
return ImplNodeGetter(&TreeWalker::ParentNode, _retval);
}
already_AddRefed<nsINode>
TreeWalker::ParentNode(ErrorResult& aResult)
{
nsCOMPtr<nsINode> node = mCurrentNode;
while (node && node != mRoot) {
node = node->GetParentNode();
if (node) {
int16_t filtered;
rv = TestNode(node, &filtered);
NS_ENSURE_SUCCESS(rv, rv);
int16_t filtered = TestNode(node, aResult);
if (aResult.Failed()) {
return nullptr;
}
if (filtered == nsIDOMNodeFilter::FILTER_ACCEPT) {
mCurrentNode = node;
return CallQueryInterface(node, _retval);
return node.forget();
}
}
}
return NS_OK;
return nullptr;
}
/* nsIDOMNode firstChild (); */
NS_IMETHODIMP nsTreeWalker::FirstChild(nsIDOMNode **_retval)
NS_IMETHODIMP TreeWalker::FirstChild(nsIDOMNode **_retval)
{
return FirstChildInternal(false, _retval);
return ImplNodeGetter(&TreeWalker::FirstChild, _retval);
}
already_AddRefed<nsINode>
TreeWalker::FirstChild(ErrorResult& aResult)
{
return FirstChildInternal(false, aResult);
}
/* nsIDOMNode lastChild (); */
NS_IMETHODIMP nsTreeWalker::LastChild(nsIDOMNode **_retval)
NS_IMETHODIMP TreeWalker::LastChild(nsIDOMNode **_retval)
{
return FirstChildInternal(true, _retval);
return ImplNodeGetter(&TreeWalker::LastChild, _retval);
}
already_AddRefed<nsINode>
TreeWalker::LastChild(ErrorResult& aResult)
{
return FirstChildInternal(true, aResult);
}
/* nsIDOMNode previousSibling (); */
NS_IMETHODIMP nsTreeWalker::PreviousSibling(nsIDOMNode **_retval)
NS_IMETHODIMP TreeWalker::PreviousSibling(nsIDOMNode **_retval)
{
return NextSiblingInternal(true, _retval);
return ImplNodeGetter(&TreeWalker::PreviousSibling, _retval);
}
already_AddRefed<nsINode>
TreeWalker::PreviousSibling(ErrorResult& aResult)
{
return NextSiblingInternal(true, aResult);
}
/* nsIDOMNode nextSibling (); */
NS_IMETHODIMP nsTreeWalker::NextSibling(nsIDOMNode **_retval)
NS_IMETHODIMP TreeWalker::NextSibling(nsIDOMNode **_retval)
{
return NextSiblingInternal(false, _retval);
return ImplNodeGetter(&TreeWalker::NextSibling, _retval);
}
already_AddRefed<nsINode>
TreeWalker::NextSibling(ErrorResult& aResult)
{
return NextSiblingInternal(false, aResult);
}
/* nsIDOMNode previousNode (); */
NS_IMETHODIMP nsTreeWalker::PreviousNode(nsIDOMNode **_retval)
NS_IMETHODIMP TreeWalker::PreviousNode(nsIDOMNode **_retval)
{
nsresult rv;
int16_t filtered;
*_retval = nullptr;
return ImplNodeGetter(&TreeWalker::PreviousNode, _retval);
}
already_AddRefed<nsINode>
TreeWalker::PreviousNode(ErrorResult& aResult)
{
nsCOMPtr<nsINode> node = mCurrentNode;
while (node != mRoot) {
while (nsINode *previousSibling = node->GetPreviousSibling()) {
node = previousSibling;
rv = TestNode(node, &filtered);
NS_ENSURE_SUCCESS(rv, rv);
int16_t filtered = TestNode(node, aResult);
if (aResult.Failed()) {
return nullptr;
}
nsINode *lastChild;
while (filtered != nsIDOMNodeFilter::FILTER_REJECT &&
(lastChild = node->GetLastChild())) {
node = lastChild;
rv = TestNode(node, &filtered);
NS_ENSURE_SUCCESS(rv, rv);
filtered = TestNode(node, aResult);
if (aResult.Failed()) {
return nullptr;
}
}
if (filtered == nsIDOMNodeFilter::FILTER_ACCEPT) {
mCurrentNode = node;
return CallQueryInterface(node, _retval);
return node.forget();
}
}
if (node == mRoot)
if (node == mRoot) {
break;
}
node = node->GetParentNode();
if (!node)
if (!node) {
break;
}
rv = TestNode(node, &filtered);
NS_ENSURE_SUCCESS(rv, rv);
int16_t filtered = TestNode(node, aResult);
if (aResult.Failed()) {
return nullptr;
}
if (filtered == nsIDOMNodeFilter::FILTER_ACCEPT) {
mCurrentNode = node;
return CallQueryInterface(node, _retval);
return node.forget();
}
}
return NS_OK;
return nullptr;
}
/* nsIDOMNode nextNode (); */
NS_IMETHODIMP nsTreeWalker::NextNode(nsIDOMNode **_retval)
NS_IMETHODIMP TreeWalker::NextNode(nsIDOMNode **_retval)
{
nsresult rv;
int16_t filtered = nsIDOMNodeFilter::FILTER_ACCEPT; // pre-init for inner loop
return ImplNodeGetter(&TreeWalker::NextNode, _retval);
}
*_retval = nullptr;
already_AddRefed<nsINode>
TreeWalker::NextNode(ErrorResult& aResult)
{
int16_t filtered = nsIDOMNodeFilter::FILTER_ACCEPT; // pre-init for inner loop
nsCOMPtr<nsINode> node = mCurrentNode;
@ -237,13 +283,15 @@ NS_IMETHODIMP nsTreeWalker::NextNode(nsIDOMNode **_retval)
(firstChild = node->GetFirstChild())) {
node = firstChild;
rv = TestNode(node, &filtered);
NS_ENSURE_SUCCESS(rv, rv);
filtered = TestNode(node, aResult);
if (aResult.Failed()) {
return nullptr;
}
if (filtered == nsIDOMNodeFilter::FILTER_ACCEPT) {
// Node found
mCurrentNode = node;
return CallQueryInterface(node, _retval);
return node.forget();
}
}
@ -266,49 +314,49 @@ NS_IMETHODIMP nsTreeWalker::NextNode(nsIDOMNode **_retval)
node = sibling;
// Found a sibling. Either ours or ancestor's
rv = TestNode(node, &filtered);
NS_ENSURE_SUCCESS(rv, rv);
filtered = TestNode(node, aResult);
if (aResult.Failed()) {
return nullptr;
}
if (filtered == nsIDOMNodeFilter::FILTER_ACCEPT) {
// Node found
mCurrentNode = node;
return CallQueryInterface(node, _retval);
return node.forget();
}
}
return NS_OK;
return nullptr;
}
/*
* nsTreeWalker helper functions
* TreeWalker helper functions
*/
/*
* Implements FirstChild and LastChild which only vary in which direction
* they search.
* @param aReversed Controls whether we search forwards or backwards
* @param _retval Returned node. Null if no child is found
* @returns Errorcode
* @param aResult Whether we threw or not.
* @returns The desired node. Null if no child is found
*/
nsresult nsTreeWalker::FirstChildInternal(bool aReversed, nsIDOMNode **_retval)
already_AddRefed<nsINode>
TreeWalker::FirstChildInternal(bool aReversed, ErrorResult& aResult)
{
nsresult rv;
int16_t filtered;
*_retval = nullptr;
nsCOMPtr<nsINode> node = aReversed ? mCurrentNode->GetLastChild()
: mCurrentNode->GetFirstChild();
while (node) {
rv = TestNode(node, &filtered);
NS_ENSURE_SUCCESS(rv, rv);
int16_t filtered = TestNode(node, aResult);
if (aResult.Failed()) {
return nullptr;
}
switch (filtered) {
case nsIDOMNodeFilter::FILTER_ACCEPT:
// Node found
mCurrentNode = node;
return CallQueryInterface(node, _retval);
return node.forget();
case nsIDOMNodeFilter::FILTER_SKIP: {
nsINode *child = aReversed ? node->GetLastChild()
: node->GetFirstChild();
@ -334,7 +382,7 @@ nsresult nsTreeWalker::FirstChildInternal(bool aReversed, nsIDOMNode **_retval)
nsINode *parent = node->GetParentNode();
if (!parent || parent == mRoot || parent == mCurrentNode) {
return NS_OK;
return nullptr;
}
node = parent;
@ -342,27 +390,24 @@ nsresult nsTreeWalker::FirstChildInternal(bool aReversed, nsIDOMNode **_retval)
} while (node);
}
return NS_OK;
return nullptr;
}
/*
* Implements NextSibling and PreviousSibling which only vary in which
* direction they search.
* @param aReversed Controls whether we search forwards or backwards
* @param _retval Returned node. Null if no child is found
* @returns Errorcode
* @param aResult Whether we threw or not.
* @returns The desired node. Null if no child is found
*/
nsresult nsTreeWalker::NextSiblingInternal(bool aReversed, nsIDOMNode **_retval)
already_AddRefed<nsINode>
TreeWalker::NextSiblingInternal(bool aReversed, ErrorResult& aResult)
{
nsresult rv;
int16_t filtered;
*_retval = nullptr;
nsCOMPtr<nsINode> node = mCurrentNode;
if (node == mRoot)
return NS_OK;
if (node == mRoot) {
return nullptr;
}
while (1) {
nsINode* sibling = aReversed ? node->GetPreviousSibling()
@ -371,13 +416,15 @@ nsresult nsTreeWalker::NextSiblingInternal(bool aReversed, nsIDOMNode **_retval)
while (sibling) {
node = sibling;
rv = TestNode(node, &filtered);
NS_ENSURE_SUCCESS(rv, rv);
int16_t filtered = TestNode(node, aResult);
if (aResult.Failed()) {
return nullptr;
}
if (filtered == nsIDOMNodeFilter::FILTER_ACCEPT) {
// Node found
mCurrentNode.swap(node);
return CallQueryInterface(mCurrentNode, _retval);
mCurrentNode = node;
return node.forget();
}
// If rejected or no children, try a sibling
@ -391,13 +438,26 @@ nsresult nsTreeWalker::NextSiblingInternal(bool aReversed, nsIDOMNode **_retval)
node = node->GetParentNode();
if (!node || node == mRoot)
return NS_OK;
if (!node || node == mRoot) {
return nullptr;
}
// Is parent transparent in filtered view?
rv = TestNode(node, &filtered);
NS_ENSURE_SUCCESS(rv, rv);
if (filtered == nsIDOMNodeFilter::FILTER_ACCEPT)
return NS_OK;
int16_t filtered = TestNode(node, aResult);
if (aResult.Failed()) {
return nullptr;
}
if (filtered == nsIDOMNodeFilter::FILTER_ACCEPT) {
return nullptr;
}
}
}
JSObject*
TreeWalker::WrapObject(JSContext *cx, JSObject *scope)
{
return TreeWalkerBinding::Wrap(cx, scope, this);
}
} // namespace dom
} // namespace mozilla

View File

@ -0,0 +1,110 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim: set ts=4 et sw=4 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/. */
/*
* Implementation of DOM Traversal's nsIDOMTreeWalker
*/
#ifndef mozilla_dom_TreeWalker_h
#define mozilla_dom_TreeWalker_h
#include "nsIDOMTreeWalker.h"
#include "nsTraversal.h"
#include "nsCOMPtr.h"
#include "nsTArray.h"
#include "nsCycleCollectionParticipant.h"
class nsINode;
class nsIDOMNode;
namespace mozilla {
namespace dom {
class TreeWalker MOZ_FINAL : public nsIDOMTreeWalker, public nsTraversal
{
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_NSIDOMTREEWALKER
TreeWalker(nsINode *aRoot,
uint32_t aWhatToShow,
const NodeFilterHolder &aFilter);
virtual ~TreeWalker();
NS_DECL_CYCLE_COLLECTION_CLASS(TreeWalker)
// WebIDL API
nsINode* Root() const
{
return mRoot;
}
uint32_t WhatToShow() const
{
return mWhatToShow;
}
already_AddRefed<NodeFilter> GetFilter()
{
return mFilter.ToWebIDLCallback();
}
nsINode* CurrentNode() const
{
return mCurrentNode;
}
void SetCurrentNode(nsINode& aNode, ErrorResult& aResult);
// All our traversal methods return strong refs because filtering can
// remove nodes from the tree.
already_AddRefed<nsINode> ParentNode(ErrorResult& aResult);
already_AddRefed<nsINode> FirstChild(ErrorResult& aResult);
already_AddRefed<nsINode> LastChild(ErrorResult& aResult);
already_AddRefed<nsINode> PreviousSibling(ErrorResult& aResult);
already_AddRefed<nsINode> NextSibling(ErrorResult& aResult);
already_AddRefed<nsINode> PreviousNode(ErrorResult& aResult);
already_AddRefed<nsINode> NextNode(ErrorResult& aResult);
JSObject* WrapObject(JSContext *cx, JSObject *scope);
private:
nsCOMPtr<nsINode> mCurrentNode;
/*
* Implements FirstChild and LastChild which only vary in which direction
* they search.
* @param aReversed Controls whether we search forwards or backwards
* @param aResult Whether we threw or not.
* @returns The desired node. Null if no child is found
*/
already_AddRefed<nsINode> FirstChildInternal(bool aReversed,
ErrorResult& aResult);
/*
* Implements NextSibling and PreviousSibling which only vary in which
* direction they search.
* @param aReversed Controls whether we search forwards or backwards
* @param aResult Whether we threw or not.
* @returns The desired node. Null if no child is found
*/
already_AddRefed<nsINode> NextSiblingInternal(bool aReversed,
ErrorResult& aResult);
// Implementation for our various XPCOM getters
typedef already_AddRefed<nsINode> (TreeWalker::*NodeGetter)(ErrorResult&);
inline nsresult ImplNodeGetter(NodeGetter aGetter, nsIDOMNode** aRetval)
{
mozilla::ErrorResult rv;
nsCOMPtr<nsINode> node = (this->*aGetter)(rv);
if (rv.Failed()) {
return rv.ErrorCode();
}
*aRetval = node ? node.forget().get()->AsDOMNode() : nullptr;
return NS_OK;
}
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_TreeWalker_h

View File

@ -56,9 +56,9 @@
#include "nsRange.h"
#include "nsIDOMText.h"
#include "nsIDOMComment.h"
#include "DocumentType.h"
#include "nsNodeIterator.h"
#include "nsTreeWalker.h"
#include "mozilla/dom/DocumentType.h"
#include "mozilla/dom/NodeIterator.h"
#include "mozilla/dom/TreeWalker.h"
#include "nsIServiceManager.h"
@ -4746,7 +4746,7 @@ nsDocument::CreateProcessingInstruction(const nsAString& aTarget,
already_AddRefed<ProcessingInstruction>
nsIDocument::CreateProcessingInstruction(const nsAString& aTarget,
const nsAString& aData,
mozilla::ErrorResult& rv) const
ErrorResult& rv) const
{
nsresult res = nsContentUtils::CheckQName(aTarget, false);
if (NS_FAILED(res)) {
@ -4823,7 +4823,7 @@ nsDocument::CreateAttributeNS(const nsAString & aNamespaceURI,
already_AddRefed<nsIDOMAttr>
nsIDocument::CreateAttributeNS(const nsAString& aNamespaceURI,
const nsAString& aQualifiedName,
mozilla::ErrorResult& rv)
ErrorResult& rv)
{
WarnOnceAbout(eCreateAttributeNS);
@ -5361,23 +5361,19 @@ nsDocument::CreateNodeIterator(nsIDOMNode *aRoot,
return rv.ErrorCode();
}
already_AddRefed<nsIDOMNodeIterator>
already_AddRefed<NodeIterator>
nsIDocument::CreateNodeIterator(nsINode& aRoot, uint32_t aWhatToShow,
NodeFilter* aFilter,
mozilla::ErrorResult& rv) const
ErrorResult& rv) const
{
NodeFilterHolder holder(aFilter);
// We don't really know how to handle WebIDL callbacks yet, in
// nsTraversal, so just go ahead and convert to an XPCOM callback.
nsCOMPtr<nsIDOMNodeFilter> filter = holder.ToXPCOMCallback();
NodeFilterHolder holder2(filter);
return CreateNodeIterator(aRoot, aWhatToShow, holder2, rv);
return CreateNodeIterator(aRoot, aWhatToShow, holder, rv);
}
already_AddRefed<nsIDOMNodeIterator>
already_AddRefed<NodeIterator>
nsIDocument::CreateNodeIterator(nsINode& aRoot, uint32_t aWhatToShow,
const NodeFilterHolder& aFilter,
mozilla::ErrorResult& rv) const
ErrorResult& rv) const
{
nsINode* root = &aRoot;
nsresult res = nsContentUtils::CheckSameOrigin(this, root);
@ -5386,8 +5382,8 @@ nsIDocument::CreateNodeIterator(nsINode& aRoot, uint32_t aWhatToShow,
return nullptr;
}
nsRefPtr<nsNodeIterator> iterator = new nsNodeIterator(root, aWhatToShow,
aFilter);
nsRefPtr<NodeIterator> iterator = new NodeIterator(root, aWhatToShow,
aFilter);
return iterator.forget();
}
@ -5414,23 +5410,19 @@ nsDocument::CreateTreeWalker(nsIDOMNode *aRoot,
return rv.ErrorCode();
}
already_AddRefed<nsIDOMTreeWalker>
already_AddRefed<TreeWalker>
nsIDocument::CreateTreeWalker(nsINode& aRoot, uint32_t aWhatToShow,
NodeFilter* aFilter,
mozilla::ErrorResult& rv) const
ErrorResult& rv) const
{
NodeFilterHolder holder(aFilter);
// We don't really know how to handle WebIDL callbacks yet, in
// nsTraversal, so just go ahead and convert to an XPCOM callback.
nsCOMPtr<nsIDOMNodeFilter> filter = holder.ToXPCOMCallback();
NodeFilterHolder holder2(filter);
return CreateTreeWalker(aRoot, aWhatToShow, holder2, rv);
return CreateTreeWalker(aRoot, aWhatToShow, holder, rv);
}
already_AddRefed<nsIDOMTreeWalker>
already_AddRefed<TreeWalker>
nsIDocument::CreateTreeWalker(nsINode& aRoot, uint32_t aWhatToShow,
const NodeFilterHolder& aFilter,
mozilla::ErrorResult& rv) const
ErrorResult& rv) const
{
nsINode* root = &aRoot;
nsresult res = nsContentUtils::CheckSameOrigin(this, root);
@ -5439,7 +5431,7 @@ nsIDocument::CreateTreeWalker(nsINode& aRoot, uint32_t aWhatToShow,
return nullptr;
}
nsRefPtr<nsTreeWalker> walker = new nsTreeWalker(root, aWhatToShow, aFilter);
nsRefPtr<TreeWalker> walker = new TreeWalker(root, aWhatToShow, aFilter);
return walker.forget();
}

View File

@ -372,6 +372,7 @@ GK_ATOM(fontpicker, "fontpicker")
GK_ATOM(footer, "footer")
GK_ATOM(_for, "for")
GK_ATOM(forEach, "for-each")
GK_ATOM(forceOwnRefreshDriver, "forceOwnRefreshDriver")
GK_ATOM(form, "form")
GK_ATOM(formaction, "formaction")
GK_ATOM(format, "format")

View File

@ -1,69 +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/. */
/*
* Implementation of DOM Traversal's nsIDOMNodeIterator
*/
#ifndef nsNodeIterator_h___
#define nsNodeIterator_h___
#include "nsIDOMNodeIterator.h"
#include "nsTraversal.h"
#include "nsCycleCollectionParticipant.h"
#include "nsStubMutationObserver.h"
class nsINode;
class nsIDOMNode;
class nsIDOMNodeFilter;
class nsNodeIterator : public nsIDOMNodeIterator,
public nsTraversal,
public nsStubMutationObserver
{
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_NSIDOMNODEITERATOR
nsNodeIterator(nsINode *aRoot,
uint32_t aWhatToShow,
const mozilla::dom::NodeFilterHolder &aFilter);
virtual ~nsNodeIterator();
NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsNodeIterator, nsIDOMNodeIterator)
private:
struct NodePointer {
NodePointer() : mNode(nullptr) {}
NodePointer(nsINode *aNode, bool aBeforeNode);
typedef bool (NodePointer::*MoveToMethodType)(nsINode*);
bool MoveToNext(nsINode *aRoot);
bool MoveToPrevious(nsINode *aRoot);
bool MoveForward(nsINode *aRoot, nsINode *aNode);
void MoveBackward(nsINode *aParent, nsINode *aNode);
void AdjustAfterRemoval(nsINode *aRoot, nsINode *aContainer, nsIContent *aChild, nsIContent *aPreviousSibling);
void Clear() { mNode = nullptr; }
nsINode *mNode;
bool mBeforeNode;
};
inline nsresult
NextOrPrevNode(NodePointer::MoveToMethodType aMove,
nsIDOMNode **_retval);
bool mDetached;
NodePointer mPointer;
NodePointer mWorkingPointer;
};
#endif

View File

@ -7,10 +7,8 @@
#include "nsTraversal.h"
#include "nsIDOMNode.h"
#include "nsIDOMNodeFilter.h"
#include "nsError.h"
#include "nsINode.h"
#include "mozilla/dom/NodeFilterBinding.h"
#include "mozilla/AutoRestore.h"
#include "nsGkAtoms.h"
@ -38,37 +36,42 @@ nsTraversal::~nsTraversal()
* Tests if and how a node should be filtered. Uses mWhatToShow and
* mFilter to test the node.
* @param aNode Node to test
* @param _filtered Returned filtervalue. See nsIDOMNodeFilter.idl
* @returns Errorcode
* @param aResult Whether we succeeded
* @returns Filtervalue. See nsIDOMNodeFilter.idl
*/
nsresult nsTraversal::TestNode(nsINode* aNode, int16_t* _filtered)
int16_t
nsTraversal::TestNode(nsINode* aNode, mozilla::ErrorResult& aResult)
{
NS_ENSURE_TRUE(!mInAcceptNode, NS_ERROR_DOM_INVALID_STATE_ERR);
*_filtered = nsIDOMNodeFilter::FILTER_SKIP;
if (mInAcceptNode) {
aResult.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
return 0;
}
uint16_t nodeType = aNode->NodeType();
if (nodeType <= 12 && !((1 << (nodeType-1)) & mWhatToShow)) {
return NS_OK;
return nsIDOMNodeFilter::FILTER_SKIP;
}
if (!mFilter.GetISupports()) {
// No filter, just accept
*_filtered = nsIDOMNodeFilter::FILTER_ACCEPT;
return NS_OK;
return nsIDOMNodeFilter::FILTER_ACCEPT;
}
if (mFilter.HasWebIDLCallback()) {
AutoRestore<bool> inAcceptNode(mInAcceptNode);
mInAcceptNode = true;
ErrorResult res;
*_filtered = mFilter.GetWebIDLCallback()->AcceptNode(*aNode, res);
return res.ErrorCode();
return mFilter.GetWebIDLCallback()->
AcceptNode(*aNode, aResult, CallbackObject::eRethrowExceptions);
}
nsCOMPtr<nsIDOMNode> domNode = do_QueryInterface(aNode);
AutoRestore<bool> inAcceptNode(mInAcceptNode);
mInAcceptNode = true;
return mFilter.GetXPCOMCallback()->AcceptNode(domNode, _filtered);
int16_t filtered;
nsresult rv = mFilter.GetXPCOMCallback()->AcceptNode(domNode, &filtered);
if (NS_FAILED(rv)) {
aResult.Throw(rv);
}
return filtered;
}

View File

@ -14,9 +14,11 @@
#include "nsCOMPtr.h"
#include "nsIDocument.h"
#include "mozilla/dom/CallbackObject.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/dom/NodeFilterBinding.h"
#include "nsIDOMNodeFilter.h"
class nsINode;
class nsIDOMNodeFilter;
class nsTraversal
{
@ -36,10 +38,10 @@ protected:
* Tests if and how a node should be filtered. Uses mWhatToShow and
* mFilter to test the node.
* @param aNode Node to test
* @param _filtered Returned filtervalue. See nsIDOMNodeFilter.idl
* @returns Errorcode
* @param aResult Whether we succeeded
* @returns Filtervalue. See nsIDOMNodeFilter.idl
*/
nsresult TestNode(nsINode* aNode, int16_t* _filtered);
int16_t TestNode(nsINode* aNode, mozilla::ErrorResult& aResult);
};
#endif

View File

@ -1,60 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim: set ts=4 et sw=4 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/. */
/*
* Implementation of DOM Traversal's nsIDOMTreeWalker
*/
#ifndef nsTreeWalker_h___
#define nsTreeWalker_h___
#include "nsIDOMTreeWalker.h"
#include "nsTraversal.h"
#include "nsCOMPtr.h"
#include "nsTArray.h"
#include "nsCycleCollectionParticipant.h"
class nsINode;
class nsIDOMNode;
class nsIDOMNodeFilter;
class nsTreeWalker : public nsIDOMTreeWalker, public nsTraversal
{
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_NSIDOMTREEWALKER
nsTreeWalker(nsINode *aRoot,
uint32_t aWhatToShow,
const mozilla::dom::NodeFilterHolder &aFilter);
virtual ~nsTreeWalker();
NS_DECL_CYCLE_COLLECTION_CLASS(nsTreeWalker)
private:
nsCOMPtr<nsINode> mCurrentNode;
/*
* Implements FirstChild and LastChild which only vary in which direction
* they search.
* @param aReversed Controls whether we search forwards or backwards
* @param _retval Returned node. Null if no child is found
* @returns Errorcode
*/
nsresult FirstChildInternal(bool aReversed, nsIDOMNode **_retval);
/*
* Implements NextSibling and PreviousSibling which only vary in which
* direction they search.
* @param aReversed Controls whether we search forwards or backwards
* @param _retval Returned node. Null if no child is found
* @returns Errorcode
*/
nsresult NextSiblingInternal(bool aReversed, nsIDOMNode **_retval);
};
#endif

View File

@ -387,7 +387,6 @@ nsXMLHttpRequest::nsXMLHttpRequest()
mRequestObserver(nullptr), mState(XML_HTTP_REQUEST_UNSENT),
mUploadTransferred(0), mUploadTotal(0), mUploadComplete(true),
mProgressSinceLastProgressEvent(false),
mUploadProgress(0), mUploadProgressMax(0),
mRequestSentTime(0), mTimeoutMilliseconds(0),
mErrorLoad(false), mWaitingForOnStopRequest(false),
mProgressTimerIsActive(false), mProgressEventWasDelayed(false),
@ -1544,10 +1543,8 @@ nsXMLHttpRequest::CreateReadystatechangeEvent(nsIDOMEvent** aDOMEvent)
void
nsXMLHttpRequest::DispatchProgressEvent(nsDOMEventTargetHelper* aTarget,
const nsAString& aType,
bool aUseLSEventWrapper,
bool aLengthComputable,
uint64_t aLoaded, uint64_t aTotal,
uint64_t aPosition, uint64_t aTotalSize)
uint64_t aLoaded, uint64_t aTotal)
{
NS_ASSERTION(aTarget, "null target");
NS_ASSERTION(!aType.IsEmpty(), "missing event type");
@ -1558,9 +1555,9 @@ nsXMLHttpRequest::DispatchProgressEvent(nsDOMEventTargetHelper* aTarget,
}
bool dispatchLoadend = aType.EqualsLiteral(LOAD_STR) ||
aType.EqualsLiteral(ERROR_STR) ||
aType.EqualsLiteral(TIMEOUT_STR) ||
aType.EqualsLiteral(ABORT_STR);
aType.EqualsLiteral(ERROR_STR) ||
aType.EqualsLiteral(TIMEOUT_STR) ||
aType.EqualsLiteral(ABORT_STR);
nsCOMPtr<nsIDOMEvent> event;
nsresult rv = NS_NewDOMProgressEvent(getter_AddRefs(event),
@ -1579,17 +1576,11 @@ nsXMLHttpRequest::DispatchProgressEvent(nsDOMEventTargetHelper* aTarget,
event->SetTrusted(true);
if (aUseLSEventWrapper) {
nsCOMPtr<nsIDOMProgressEvent> xhrprogressEvent =
new nsXMLHttpProgressEvent(progress, aPosition, aTotalSize, GetOwner());
event = xhrprogressEvent;
}
aTarget->DispatchDOMEvent(nullptr, event, nullptr, nullptr);
if (dispatchLoadend) {
DispatchProgressEvent(aTarget, NS_LITERAL_STRING(LOADEND_STR),
aUseLSEventWrapper, aLengthComputable,
aLoaded, aTotal, aPosition, aTotalSize);
aLengthComputable, aLoaded, aTotal);
}
}
@ -2809,8 +2800,6 @@ nsXMLHttpRequest::Send(nsIVariant* aVariant, const Nullable<RequestBody>& aBody)
mErrorLoad = false;
mLoadLengthComputable = false;
mLoadTotal = 0;
mUploadProgress = 0;
mUploadProgressMax = 0;
if ((aVariant || !aBody.IsNull()) && httpChannel &&
!method.EqualsLiteral("GET")) {
@ -3647,13 +3636,11 @@ nsXMLHttpRequest::MaybeDispatchProgressEvents(bool aFinalProgress)
if ((XML_HTTP_REQUEST_OPENED | XML_HTTP_REQUEST_SENT) & mState) {
if (aFinalProgress) {
mUploadTotal = mUploadTransferred;
mUploadProgressMax = mUploadProgress;
}
if (mUpload && !mUploadComplete) {
DispatchProgressEvent(mUpload, NS_LITERAL_STRING(PROGRESS_STR),
true, mUploadLengthComputable, mUploadTransferred,
mUploadTotal, mUploadProgress,
mUploadProgressMax);
mUploadLengthComputable, mUploadTransferred,
mUploadTotal);
}
} else {
if (aFinalProgress) {
@ -3661,8 +3648,8 @@ nsXMLHttpRequest::MaybeDispatchProgressEvents(bool aFinalProgress)
}
mInLoadProgressEvent = true;
DispatchProgressEvent(this, NS_LITERAL_STRING(PROGRESS_STR),
true, mLoadLengthComputable, mLoadTransferred,
mLoadTotal, mLoadTransferred, mLoadTotal);
mLoadLengthComputable, mLoadTransferred,
mLoadTotal);
mInLoadProgressEvent = false;
if (mResponseType == XML_HTTP_RESPONSE_TYPE_CHUNKED_TEXT ||
mResponseType == XML_HTTP_RESPONSE_TYPE_CHUNKED_ARRAYBUFFER) {
@ -3701,8 +3688,6 @@ nsXMLHttpRequest::OnProgress(nsIRequest *aRequest, nsISupports *aContext, uint64
}
mUploadLengthComputable = lengthComputable;
mUploadTransferred = loaded;
mUploadProgress = aProgress;
mUploadProgressMax = aProgressMax;
mProgressSinceLastProgressEvent = true;
MaybeDispatchProgressEvents(false);
@ -4009,81 +3994,6 @@ nsHeaderVisitor::VisitHeader(const nsACString &header, const nsACString &value)
return NS_OK;
}
// DOM event class to handle progress notifications
nsXMLHttpProgressEvent::nsXMLHttpProgressEvent(nsIDOMProgressEvent* aInner,
uint64_t aCurrentProgress,
uint64_t aMaxProgress,
nsPIDOMWindow* aWindow)
: mWindow(aWindow)
{
mInner = aInner;
mCurProgress = aCurrentProgress;
mMaxProgress = aMaxProgress;
}
nsXMLHttpProgressEvent::~nsXMLHttpProgressEvent()
{}
DOMCI_DATA(XMLHttpProgressEvent, nsXMLHttpProgressEvent)
// QueryInterface implementation for nsXMLHttpProgressEvent
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsXMLHttpProgressEvent)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMProgressEvent)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIDOMEvent, nsIDOMProgressEvent)
NS_INTERFACE_MAP_ENTRY(nsIDOMProgressEvent)
NS_INTERFACE_MAP_ENTRY(nsIDOMLSProgressEvent)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(XMLHttpProgressEvent)
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsXMLHttpProgressEvent)
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsXMLHttpProgressEvent)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsXMLHttpProgressEvent)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mInner);
NS_IMPL_CYCLE_COLLECTION_UNLINK(mWindow);
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsXMLHttpProgressEvent)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mInner)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mWindow);
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMETHODIMP nsXMLHttpProgressEvent::GetInput(nsIDOMLSInput * *aInput)
{
*aInput = nullptr;
return NS_ERROR_NOT_IMPLEMENTED;
}
void
nsXMLHttpProgressEvent::WarnAboutLSProgressEvent(nsIDocument::DeprecatedOperations aOperation)
{
if (!mWindow) {
return;
}
nsCOMPtr<nsIDocument> document =
do_QueryInterface(mWindow->GetExtantDocument());
if (!document) {
return;
}
document->WarnOnceAbout(aOperation);
}
NS_IMETHODIMP nsXMLHttpProgressEvent::GetPosition(uint32_t *aPosition)
{
WarnAboutLSProgressEvent(nsIDocument::ePosition);
// XXX can we change the iface?
*aPosition = uint32_t(mCurProgress);
return NS_OK;
}
NS_IMETHODIMP nsXMLHttpProgressEvent::GetTotalSize(uint32_t *aTotalSize)
{
WarnAboutLSProgressEvent(nsIDocument::eTotalSize);
// XXX can we change the iface?
*aTotalSize = uint32_t(mMaxProgress);
return NS_OK;
}
// nsXMLHttpRequestXPCOMifier implementation
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsXMLHttpRequestXPCOMifier)
NS_INTERFACE_MAP_ENTRY(nsIStreamListener)

View File

@ -26,7 +26,6 @@
#include "nsCOMArray.h"
#include "nsJSUtils.h"
#include "nsTArray.h"
#include "nsIDOMLSProgressEvent.h"
#include "nsITimer.h"
#include "nsIDOMProgressEvent.h"
#include "nsDOMEventTargetHelper.h"
@ -450,29 +449,10 @@ public:
// This creates a trusted readystatechange event, which is not cancelable and
// doesn't bubble.
static nsresult CreateReadystatechangeEvent(nsIDOMEvent** aDOMEvent);
// For backwards compatibility aPosition should contain the headers for upload
// and aTotalSize is UINT64_MAX when unknown. Both those values are
// used by nsXMLHttpProgressEvent. Normal progress event should not use
// headers in aLoaded and aTotal is 0 when unknown.
void DispatchProgressEvent(nsDOMEventTargetHelper* aTarget,
const nsAString& aType,
// Whether to use nsXMLHttpProgressEvent,
// which implements LS Progress Event.
bool aUseLSEventWrapper,
bool aLengthComputable,
// For Progress Events
uint64_t aLoaded, uint64_t aTotal,
// For LS Progress Events
uint64_t aPosition, uint64_t aTotalSize);
void DispatchProgressEvent(nsDOMEventTargetHelper* aTarget,
const nsAString& aType,
bool aLengthComputable,
uint64_t aLoaded, uint64_t aTotal)
{
DispatchProgressEvent(aTarget, aType, false,
aLengthComputable, aLoaded, aTotal,
aLoaded, aLengthComputable ? aTotal : UINT64_MAX);
}
uint64_t aLoaded, uint64_t aTotal);
// Dispatch the "progress" event on the XHR or XHR.upload object if we've
// received data since the last "progress" event. Also dispatches
@ -641,8 +621,6 @@ protected:
bool mUploadLengthComputable;
bool mUploadComplete;
bool mProgressSinceLastProgressEvent;
uint64_t mUploadProgress; // For legacy
uint64_t mUploadProgressMax; // For legacy
// Timeout support
PRTime mRequestSentTime;
@ -737,33 +715,6 @@ private:
nsRefPtr<nsXMLHttpRequest> mXHR;
};
// helper class to expose a progress DOM Event
class nsXMLHttpProgressEvent : public nsIDOMProgressEvent,
public nsIDOMLSProgressEvent
{
public:
nsXMLHttpProgressEvent(nsIDOMProgressEvent* aInner,
uint64_t aCurrentProgress,
uint64_t aMaxProgress,
nsPIDOMWindow* aWindow);
virtual ~nsXMLHttpProgressEvent();
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsXMLHttpProgressEvent, nsIDOMProgressEvent)
NS_FORWARD_NSIDOMEVENT(mInner->)
NS_FORWARD_NSIDOMPROGRESSEVENT(mInner->)
NS_DECL_NSIDOMLSPROGRESSEVENT
protected:
void WarnAboutLSProgressEvent(nsIDocument::DeprecatedOperations);
nsCOMPtr<nsIDOMProgressEvent> mInner;
nsCOMPtr<nsPIDOMWindow> mWindow;
uint64_t mCurProgress;
uint64_t mMaxProgress;
};
class nsXHRParseEndListener : public nsIDOMEventListener
{
public:

View File

@ -1032,10 +1032,18 @@ WebGLContext::GetExtension(JSContext *cx, const nsAString& aName, ErrorResult& r
{
ext = WEBGL_lose_context;
}
else if (CompareWebGLExtensionName(name, "WEBGL_lose_context"))
{
ext = WEBGL_lose_context;
}
else if (CompareWebGLExtensionName(name, "MOZ_WEBGL_compressed_texture_s3tc"))
{
ext = WEBGL_compressed_texture_s3tc;
}
else if (CompareWebGLExtensionName(name, "WEBGL_compressed_texture_s3tc"))
{
ext = WEBGL_compressed_texture_s3tc;
}
else if (CompareWebGLExtensionName(name, "MOZ_WEBGL_compressed_texture_atc"))
{
ext = WEBGL_compressed_texture_atc;
@ -1052,6 +1060,10 @@ WebGLContext::GetExtension(JSContext *cx, const nsAString& aName, ErrorResult& r
{
ext = WEBGL_depth_texture;
}
else if (CompareWebGLExtensionName(name, "WEBGL_depth_texture"))
{
ext = WEBGL_depth_texture;
}
if (ext == WebGLExtensionID_unknown_extension) {
return nullptr;
@ -1438,8 +1450,12 @@ WebGLContext::GetSupportedExtensions(JSContext *cx, Nullable< nsTArray<nsString>
arr.AppendElement(NS_LITERAL_STRING("EXT_texture_filter_anisotropic"));
if (IsExtensionSupported(cx, WEBGL_lose_context))
arr.AppendElement(NS_LITERAL_STRING("MOZ_WEBGL_lose_context"));
if (IsExtensionSupported(cx, WEBGL_lose_context))
arr.AppendElement(NS_LITERAL_STRING("WEBGL_lose_context"));
if (IsExtensionSupported(cx, WEBGL_compressed_texture_s3tc))
arr.AppendElement(NS_LITERAL_STRING("MOZ_WEBGL_compressed_texture_s3tc"));
if (IsExtensionSupported(cx, WEBGL_compressed_texture_s3tc))
arr.AppendElement(NS_LITERAL_STRING("WEBGL_compressed_texture_s3tc"));
if (IsExtensionSupported(cx, WEBGL_compressed_texture_atc))
arr.AppendElement(NS_LITERAL_STRING("MOZ_WEBGL_compressed_texture_atc"));
if (IsExtensionSupported(cx, WEBGL_compressed_texture_pvrtc))
@ -1448,6 +1464,8 @@ WebGLContext::GetSupportedExtensions(JSContext *cx, Nullable< nsTArray<nsString>
arr.AppendElement(NS_LITERAL_STRING("WEBGL_debug_renderer_info"));
if (IsExtensionSupported(cx, WEBGL_depth_texture))
arr.AppendElement(NS_LITERAL_STRING("MOZ_WEBGL_depth_texture"));
if (IsExtensionSupported(cx, WEBGL_depth_texture))
arr.AppendElement(NS_LITERAL_STRING("WEBGL_depth_texture"));
}
//

View File

@ -3131,8 +3131,38 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext,
if (mCurrentTarget) {
mCurrentTarget->GetContentForEvent(aEvent, getter_AddRefs(newFocus));
const nsStyleUserInterface* ui = mCurrentTarget->StyleUserInterface();
suppressBlur = (ui->mUserFocus == NS_STYLE_USER_FOCUS_IGNORE);
activeContent = mCurrentTarget->GetContent();
// In some cases, we do not want to even blur the current focused
// element. Those cases are:
// 1. -moz-user-focus CSS property is set to 'ignore';
// 2. Element with NS_EVENT_STATE_DISABLED
// (aka :disabled pseudo-class for HTML element);
// 3. XUL control element has the disabled property set to 'true'.
//
// We can't use nsIFrame::IsFocusable() because we want to blur when
// we click on a visibility: none element.
// We can't use nsIContent::IsFocusable() because we want to blur when
// we click on a non-focusable element like a <div>.
// We have to use |aEvent->target| to not make sure we do not check an
// anonymous node of the targeted element.
suppressBlur = (ui->mUserFocus == NS_STYLE_USER_FOCUS_IGNORE);
if (!suppressBlur) {
nsCOMPtr<Element> element = do_QueryInterface(aEvent->target);
suppressBlur = element &&
element->State().HasState(NS_EVENT_STATE_DISABLED);
}
if (!suppressBlur) {
nsCOMPtr<nsIDOMXULControlElement> xulControl =
do_QueryInterface(aEvent->target);
if (xulControl) {
bool disabled;
xulControl->GetDisabled(&disabled);
suppressBlur = disabled;
}
}
}
nsIFrame* currFrame = mCurrentTarget;

View File

@ -101,6 +101,7 @@ MOCHITEST_FILES = \
test_dragstart.html \
test_bug812744.html \
test_addEventListenerExtraArg.html \
test_focus_disabled.html \
$(NULL)
MOCHITEST_CHROME_FILES = \

View File

@ -0,0 +1,124 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=375008
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 375008</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.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=375008">Mozilla Bug 375008</a>
<p id="display"></p>
<div id="content">
<div>
<input id='witness'>
</div>
<div id='not-focusable'>
<!-- Disabled elements -->
<button hidden disabled>foo</button>
<input hidden disabled>
<fieldset hidden disabled>foo</fieldset>
<select hidden disabled><option>foo</option></select>
<textarea hidden disabled></textarea>
<optgroup hidden disabled><option>foo</option></optgroup>
<option hidden disabled>foo</option>
</div>
<div id='focusable'>
<button hidden>foo</button>
<input hidden>
<select hidden><option>foo</option></select>
<textarea hidden></textarea>
<!-- Those elements are not focusable by default. -->
<fieldset tabindex=1 hidden>foo</fieldset>
<optgroup tabindex=1 hidden><option>foo</option></optgroup>
<option tabindex=1 hidden>foo</option>
</div>
<!-- Hidden elements, they have a frame but focus will go through them. -->
<div id='hidden' style='visibility: hidden;'>
<button hidden>foo</button>
<input hidden>
<fieldset hidden>foo</fieldset>
<select hidden><option>foo</option></select>
<textarea hidden></textarea>
<optgroup hidden><option>foo</option></optgroup>
<option hidden>foo</option>
</div>
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 375008 **/
/*
* This test is divided in three parts:
* - cases where focus isn't doable but blur should not happen;
* - cases where focus is doable;
* - cases where focus isn't doable but blur should still happen.
*/
SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(function() {
// On Mac, this preference needs to be turned on to be able to focus all the
// form controls we want to focus.
SpecialPowers.pushPrefEnv({"set": [[ "accessibility.mouse_focuses_formcontrol", true ]]},
runTest);
});
function runTest()
{
var witness = document.getElementById('witness');
witness.focus();
var notFocusableElements = document.getElementById('not-focusable').children;
for (var i=0; i<notFocusableElements.length; ++i) {
var element = notFocusableElements[i];
element.hidden = false;
synthesizeMouseAtCenter(element, {});
is(document.activeElement, witness,
"[" + element.tagName + "] witness should still be focused");
// Cleanup.
witness.focus();
}
var focusableElements = document.getElementById('focusable').children;
for (var i=0; i<focusableElements.length; ++i) {
var element = focusableElements[i];
element.hidden = false;
synthesizeMouseAtCenter(element, {});
is(document.activeElement, element, "focus should have moved to " + element);
// Cleanup.
element.hidden = true;
witness.focus();
}
var hiddenElements = document.getElementById('hidden').children;
for (var i=0; i<hiddenElements.length; ++i) {
var element = hiddenElements[i];
element.hidden = false;
synthesizeMouseAtCenter(element, {});
is(document.activeElement, document.body,
"focus should have moved to the body");
// Cleanup.
element.hidden = true;
witness.focus();
}
SimpleTest.finish();
}
</script>
</pre>
</body>
</html>

View File

@ -116,33 +116,6 @@ HTMLFrameElement::GetAttributeMappingFunction() const
return &MapAttributesIntoRule;
}
already_AddRefed<nsIDocument>
HTMLFrameElement::GetContentDocument(ErrorResult& aRv)
{
nsCOMPtr<nsIDOMDocument> doc;
nsresult rv = nsGenericHTMLFrameElement::GetContentDocument(getter_AddRefs(doc));
if (NS_FAILED(rv)) {
aRv.Throw(rv);
return nullptr;
}
nsCOMPtr<nsIDocument> ret = do_QueryInterface(doc);
return ret.forget();
}
already_AddRefed<nsIDOMWindow>
HTMLFrameElement::GetContentWindow(ErrorResult& aRv)
{
nsCOMPtr<nsIDOMWindow> win;
nsresult rv = nsGenericHTMLFrameElement::GetContentWindow(getter_AddRefs(win));
if (NS_FAILED(rv)) {
aRv.Throw(rv);
return nullptr;
}
return win.forget();
}
JSObject*
HTMLFrameElement::WrapNode(JSContext* aCx, JSObject* aScope,
bool* aTriedToWrap)

View File

@ -102,9 +102,8 @@ public:
SetAttrHelper(nsGkAtoms::src, aSrc);
}
already_AddRefed<nsIDocument> GetContentDocument(ErrorResult& aRv);
already_AddRefed<nsIDOMWindow> GetContentWindow(ErrorResult& aRv);
using nsGenericHTMLFrameElement::GetContentDocument;
using nsGenericHTMLFrameElement::GetContentWindow;
protected:
virtual JSObject* WrapNode(JSContext* aCx, JSObject* aScope,

View File

@ -51,69 +51,73 @@ nsresult
nsGenericHTMLFrameElement::GetContentDocument(nsIDOMDocument** aContentDocument)
{
NS_PRECONDITION(aContentDocument, "Null out param");
*aContentDocument = nullptr;
nsCOMPtr<nsIDOMWindow> win;
GetContentWindow(getter_AddRefs(win));
nsCOMPtr<nsIDOMDocument> document = do_QueryInterface(GetContentDocument());
document.forget(aContentDocument);
return NS_OK;
}
nsIDocument*
nsGenericHTMLFrameElement::GetContentDocument()
{
nsCOMPtr<nsPIDOMWindow> win = GetContentWindow();
if (!win) {
return NS_OK;
return nullptr;
}
return win->GetDocument(aContentDocument);
return win->GetDoc();
}
nsresult
nsGenericHTMLFrameElement::GetContentWindow(nsIDOMWindow** aContentWindow)
{
NS_PRECONDITION(aContentWindow, "Null out param");
*aContentWindow = nullptr;
nsCOMPtr<nsPIDOMWindow> window = GetContentWindow();
window.forget(aContentWindow);
return NS_OK;
}
nsresult rv = EnsureFrameLoader();
NS_ENSURE_SUCCESS(rv, rv);
already_AddRefed<nsPIDOMWindow>
nsGenericHTMLFrameElement::GetContentWindow()
{
EnsureFrameLoader();
if (!mFrameLoader) {
return NS_OK;
return nullptr;
}
bool depthTooGreat = false;
mFrameLoader->GetDepthTooGreat(&depthTooGreat);
if (depthTooGreat) {
// Claim to have no contentWindow
return NS_OK;
return nullptr;
}
nsCOMPtr<nsIDocShell> doc_shell;
mFrameLoader->GetDocShell(getter_AddRefs(doc_shell));
nsCOMPtr<nsPIDOMWindow> win(do_GetInterface(doc_shell));
nsCOMPtr<nsPIDOMWindow> win = do_GetInterface(doc_shell);
if (!win) {
return NS_OK;
return nullptr;
}
NS_ASSERTION(win->IsOuterWindow(),
"Uh, this window should always be an outer window!");
return CallQueryInterface(win, aContentWindow);
return win.forget();
}
nsresult
void
nsGenericHTMLFrameElement::EnsureFrameLoader()
{
if (!GetParent() || !IsInDoc() || mFrameLoader || mFrameLoaderCreationDisallowed) {
// If frame loader is there, we just keep it around, cached
return NS_OK;
return;
}
// Strangely enough, this method doesn't actually ensure that the
// frameloader exists. It's more of a best-effort kind of thing.
mFrameLoader = nsFrameLoader::Create(this, mNetworkCreated);
if (!mFrameLoader) {
// Strangely enough, this method doesn't actually ensure that the
// frameloader exists. It's more of a best-effort kind of thing.
return NS_OK;
}
return NS_OK;
}
nsresult
@ -150,14 +154,13 @@ nsGenericHTMLFrameElement::SwapFrameLoaders(nsIFrameLoaderOwner* aOtherOwner)
nsresult
nsGenericHTMLFrameElement::LoadSrc()
{
nsresult rv = EnsureFrameLoader();
NS_ENSURE_SUCCESS(rv, rv);
EnsureFrameLoader();
if (!mFrameLoader) {
return NS_OK;
}
rv = mFrameLoader->LoadFrame();
nsresult rv = mFrameLoader->LoadFrame();
#ifdef DEBUG
if (NS_FAILED(rv)) {
NS_WARNING("failed to load URL");

View File

@ -90,9 +90,11 @@ protected:
// This doesn't really ensure a frame loade in all cases, only when
// it makes sense.
nsresult EnsureFrameLoader();
void EnsureFrameLoader();
nsresult LoadSrc();
nsIDocument* GetContentDocument();
nsresult GetContentDocument(nsIDOMDocument** aContentDocument);
already_AddRefed<nsPIDOMWindow> GetContentWindow();
nsresult GetContentWindow(nsIDOMWindow** aContentWindow);
nsRefPtr<nsFrameLoader> mFrameLoader;

View File

@ -344,6 +344,7 @@ MediaDecoder::MediaDecoder() :
mFrameBufferLength(0),
mPinnedForSeek(false),
mShuttingDown(false),
mPausedForPlaybackRateNull(false),
mAudioChannelType(AUDIO_CHANNEL_NORMAL)
{
MOZ_COUNT_CTOR(MediaDecoder);

View File

@ -1600,7 +1600,11 @@ MediaStream::RemoveListener(MediaStreamListener* aListener)
}
nsRefPtr<MediaStreamListener> mListener;
};
GraphImpl()->AppendMessage(new Message(this, aListener));
// If the stream is destroyed the Listeners have or will be
// removed.
if (!IsDestroyed()) {
GraphImpl()->AppendMessage(new Message(this, aListener));
}
}
void

View File

@ -21,10 +21,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=490705
<pre id="test">
<script class="testbody" type="text/javascript">
if (navigator.platform.startsWith("Win")) {
SimpleTest.expectAssertions(0, 2); // bug 845676
}
/**
* FFT is a class for calculating the Discrete Fourier Transform of a signal
* with the Fast Fourier Transform algorithm.

View File

@ -16,7 +16,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=686942
<script class="testbody" type="text/javascript">
if (navigator.platform.startsWith("Win")) {
SimpleTest.expectAssertions(0, 1);
SimpleTest.expectAssertions(0, 2);
}
var manager = new MediaTestManager;

View File

@ -17,11 +17,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=490705
<pre id="test">
<script class="testbody" type="text/javascript">
if (navigator.platform.startsWith("Win")) {
SimpleTest.expectAssertions(0, 2); // bug 845676
}
var testFile = "bug495794.ogg";
var testFileDuration = 0.30;
var testFileChannelCount = 6;

View File

@ -11,10 +11,6 @@
<pre id="test">
<script class="testbody" type="text/javascript">
if (navigator.platform.startsWith("Win")) {
SimpleTest.expectAssertions(0, 20); // bug 845676
}
var manager = new MediaTestManager;
function startTest(test, token) {

View File

@ -9,11 +9,6 @@
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
if (navigator.platform.startsWith("Win")) {
SimpleTest.expectAssertions(0, 16); // bug 845676
}
var manager = new MediaTestManager;
function startTest(test, token) {

View File

@ -10,10 +10,6 @@
<pre id="test">
<script class="testbody" type="text/javascript">
if (navigator.platform.startsWith("Win")) {
SimpleTest.expectAssertions(0, 20); // bug 845676
}
var manager = new MediaTestManager;
function ended(evt) {

View File

@ -11,10 +11,6 @@
<script>
if (navigator.platform.startsWith("Win")) {
SimpleTest.expectAssertions(0, 16); // bug 845676
}
var manager = new MediaTestManager;
var tokens = {

View File

@ -10,11 +10,6 @@
<pre id="test">
<script>
if (navigator.platform.startsWith("Win")) {
SimpleTest.expectAssertions(0, 16); // bug 845676
}
var manager = new MediaTestManager;
var tokens = {

View File

@ -10,10 +10,6 @@
<pre id="test">
<script class="testbody" type="text/javascript">
if (navigator.platform.startsWith("Win")) {
SimpleTest.expectAssertions(0, 18); // bug 845676
}
var manager = new MediaTestManager;
function startTest(test, token) {

View File

@ -10,10 +10,6 @@
<pre id="test">
<script class="testbody" type="text/javascript">
if (navigator.platform.startsWith("Win")) {
SimpleTest.expectAssertions(0, 84); // bug 845676
}
var manager = new MediaTestManager;
function startTest(test, token) {

View File

@ -10,10 +10,6 @@
<pre id="test">
<script class="testbody" type="text/javascript">
if (navigator.platform.startsWith("Win")) {
SimpleTest.expectAssertions(0, 16); // bug 845676
}
var manager = new MediaTestManager;
function startTest(test, token) {

View File

@ -21,10 +21,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=548523
<pre id="test">
<script type="application/javascript">
if (navigator.platform.startsWith("Win")) {
SimpleTest.expectAssertions(0, 8); // bug 845676
}
/** Test for Bug 548523 **/
var manager = new MediaTestManager;

View File

@ -11,7 +11,7 @@
<script class="testbody" type="text/javascript">
if (navigator.platform.startsWith("Win")) {
SimpleTest.expectAssertions(0, 8);
SimpleTest.expectAssertions(0, 10);
}
var manager = new MediaTestManager;

View File

@ -20,10 +20,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=713381
<pre id="test">
<script type="application/javascript">
if (navigator.platform.startsWith("Win")) {
SimpleTest.expectAssertions(0, 2); // bug 845676
}
/** Test for Bug 713381 **/
const num = 500;

View File

@ -119,9 +119,9 @@ var tests = [
expected: "ting-expected.wav",
numberOfChannels: 2,
duration: 0.6936,
length: 30592,
fuzzTolerance: 6,
fuzzToleranceMobile: 3174
length: 33297,
fuzzTolerance: 12,
fuzzToleranceMobile: 15826
},
// An ogg file which needs to be resampled
{
@ -130,9 +130,9 @@ var tests = [
expected: "small-shot-expected.wav",
numberOfChannels: 2,
duration: 0.2760,
length: 12175,
fuzzTolerance: 64,
fuzzToleranceMobile: 13670
length: 13252,
fuzzTolerance: 72,
fuzzToleranceMobile: 14836
},
// A wave file
//{ url: "24bit-44khz.wav", valid: true, expected: "24bit-44khz-expected.wav" },
@ -147,9 +147,9 @@ var tests = [
expected: "audio-expected.wav",
numberOfChannels: 2,
duration: 1.0811,
length: 47680,
fuzzTolerance: 106,
fuzzToleranceMobile: 3482
length: 51896,
fuzzTolerance: 132,
fuzzToleranceMobile: 56580
},
// Make sure decoding a wave file results in the same buffer
{
@ -158,7 +158,7 @@ var tests = [
expected: "audio-expected.wav",
numberOfChannels: 2,
duration: 1.0811,
length: 47680,
length: 51896,
fuzzTolerance: 0,
fuzzToleranceMobile: 0
}
@ -254,7 +254,7 @@ expectTypeError(function() {
cx.decodeAudioData(new Uint8Array(100), callbackShouldNeverRun, callbackShouldNeverRun);
});
if (cx.sampleRate == 44100) {
if (cx.sampleRate == 48000) {
// Now, let's get real!
runNextTest();
} else {

View File

@ -11,6 +11,7 @@
#include "nsSVGEnum.h"
#include "nsSVGLength2.h"
#include "SVGGraphicsElement.h"
#include "SVGImageContext.h"
#include "nsSVGViewBox.h"
#include "SVGPreserveAspectRatio.h"
#include "SVGAnimatedPreserveAspectRatio.h"
@ -30,6 +31,7 @@ namespace mozilla {
class DOMSVGAnimatedPreserveAspectRatio;
class DOMSVGTransform;
class SVGFragmentIdentifier;
class AutoSVGRenderingState;
namespace dom {
class SVGAngle;
@ -83,8 +85,8 @@ class SVGSVGElement MOZ_FINAL : public SVGSVGElementBase,
{
friend class ::nsSVGOuterSVGFrame;
friend class ::nsSVGInnerSVGFrame;
friend class ::nsSVGImageFrame;
friend class mozilla::SVGFragmentIdentifier;
friend class mozilla::AutoSVGRenderingState;
SVGSVGElement(already_AddRefed<nsINodeInfo> aNodeInfo,
FromParser aFromParser);
@ -267,7 +269,7 @@ private:
SVGViewElement* GetCurrentViewElement() const;
// Methods for <image> elements to override my "PreserveAspectRatio" value.
// These are private so that only our friends (nsSVGImageFrame in
// These are private so that only our friends (AutoSVGRenderingState in
// particular) have access.
void SetImageOverridePreserveAspectRatio(const SVGPreserveAspectRatio& aPAR);
void ClearImageOverridePreserveAspectRatio();
@ -389,6 +391,42 @@ private:
};
} // namespace dom
// Helper class to automatically manage temporary changes to an SVG document's
// state for rendering purposes.
class NS_STACK_CLASS AutoSVGRenderingState
{
public:
AutoSVGRenderingState(const SVGImageContext* aSVGContext,
dom::SVGSVGElement* aRootElem
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mHaveOverrides(!!aSVGContext)
, mRootElem(aRootElem)
{
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
MOZ_ASSERT(mRootElem, "No SVG node to manage?");
if (mHaveOverrides) {
// Override preserveAspectRatio in our helper document.
// XXXdholbert We should technically be overriding the helper doc's clip
// and overflow properties here, too. See bug 272288 comment 36.
mRootElem->SetImageOverridePreserveAspectRatio(
aSVGContext->GetPreserveAspectRatio());
}
}
~AutoSVGRenderingState()
{
if (mHaveOverrides) {
mRootElem->ClearImageOverridePreserveAspectRatio();
}
}
private:
const bool mHaveOverrides;
const nsRefPtr<dom::SVGSVGElement> mRootElem;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
} // namespace mozilla
#endif // SVGSVGElement_h

View File

@ -9,7 +9,7 @@
iframe { width: 90%; height: 50px; }
</style>
<script>
if (navigator.platform.startsWith("Linux")) {
if (!navigator.platform.startsWith("Win")) {
SimpleTest.expectAssertions(0, 1);
}

View File

@ -1092,72 +1092,79 @@ this.DOMApplicationRegistry = {
return;
}
// Clean up the deprecated manifest cache if needed.
if (id in this._manifestCache) {
delete this._manifestCache[id];
}
// We need to get the old manifest to unregister web activities.
this.getManifestFor(app.origin, (function(aOldManifest) {
debug("Old manifest: " + JSON.stringify(aOldManifest));
// Move the application.zip and manifest.webapp files out of TmpD
let tmpDir = FileUtils.getDir("TmpD", ["webapps", id], true, true);
let manFile = tmpDir.clone();
manFile.append("manifest.webapp");
let appFile = tmpDir.clone();
appFile.append("application.zip");
// Move the application.zip and manifest.webapp files out of TmpD
let tmpDir = FileUtils.getDir("TmpD", ["webapps", id], true, true);
let manFile = tmpDir.clone();
manFile.append("manifest.webapp");
let appFile = tmpDir.clone();
appFile.append("application.zip");
let dir = FileUtils.getDir(DIRECTORY_NAME, ["webapps", id], true, true);
appFile.moveTo(dir, "application.zip");
manFile.moveTo(dir, "manifest.webapp");
let dir = FileUtils.getDir(DIRECTORY_NAME, ["webapps", id], true, true);
appFile.moveTo(dir, "application.zip");
manFile.moveTo(dir, "manifest.webapp");
// Move the staged update manifest to a non staged one.
let staged = dir.clone();
staged.append("staged-update.webapp");
// Move the staged update manifest to a non staged one.
let staged = dir.clone();
staged.append("staged-update.webapp");
// If we are applying after a restarted download, we have no
// staged update manifest.
if (staged.exists()) {
staged.moveTo(dir, "update.webapp");
}
try {
tmpDir.remove(true);
} catch(e) { }
// Flush the zip reader cache to make sure we use the new application.zip
// when re-launching the application.
let zipFile = dir.clone();
zipFile.append("application.zip");
Services.obs.notifyObservers(zipFile, "flush-cache-entry", null);
// Get the manifest, and set properties.
this.getManifestFor(app.origin, (function(aData) {
app.downloading = false;
app.downloadAvailable = false;
app.downloadSize = 0;
app.installState = "installed";
app.readyToApplyDownload = false;
// Update the staged properties.
if (app.staged) {
for (let prop in app.staged) {
app[prop] = app.staged[prop];
}
delete app.staged;
// If we are applying after a restarted download, we have no
// staged update manifest.
if (staged.exists()) {
staged.moveTo(dir, "update.webapp");
}
delete app.retryingDownload;
try {
tmpDir.remove(true);
} catch(e) { }
DOMApplicationRegistry._saveApps(function() {
DOMApplicationRegistry.broadcastMessage("Webapps:PackageEvent",
{ type: "applied",
manifestURL: app.manifestURL,
app: app,
manifest: aData });
// Update the permissions for this app.
PermissionsInstaller.installPermissions({ manifest: aData,
origin: app.origin,
manifestURL: app.manifestURL },
true);
});
// Clean up the deprecated manifest cache if needed.
if (id in this._manifestCache) {
delete this._manifestCache[id];
}
// Flush the zip reader cache to make sure we use the new application.zip
// when re-launching the application.
let zipFile = dir.clone();
zipFile.append("application.zip");
Services.obs.notifyObservers(zipFile, "flush-cache-entry", null);
// Get the manifest, and set properties.
this.getManifestFor(app.origin, (function(aData) {
debug("New manifest: " + JSON.stringify(aData));
app.downloading = false;
app.downloadAvailable = false;
app.downloadSize = 0;
app.installState = "installed";
app.readyToApplyDownload = false;
// Update the staged properties.
if (app.staged) {
for (let prop in app.staged) {
app[prop] = app.staged[prop];
}
delete app.staged;
}
delete app.retryingDownload;
this._saveApps((function() {
// Update the handlers and permissions for this app.
this.updateAppHandlers(aOldManifest, aData, app);
PermissionsInstaller.installPermissions(
{ manifest: aData,
origin: app.origin,
manifestURL: app.manifestURL },
true);
this.broadcastMessage("Webapps:PackageEvent",
{ type: "applied",
manifestURL: app.manifestURL,
app: app,
manifest: aData });
}).bind(this));
}).bind(this));
}).bind(this));
},
@ -1278,6 +1285,23 @@ this.DOMApplicationRegistry = {
return [toHexString(hash.charCodeAt(i)) for (i in hash)].join("");
},
// Updates the activities and system message handlers.
// aOldManifest can be null if we don't have any handler to unregister.
updateAppHandlers: function(aOldManifest, aNewManifest, aApp) {
debug("updateAppHandlers: old=" + aOldManifest + " new=" + aNewManifest);
this.notifyAppsRegistryStart();
#ifdef MOZ_SYS_MSG
if (aOldManifest) {
this._unregisterActivities(aOldManifest, aApp);
}
this._registerSystemMessages(aNewManifest, aApp);
this._registerActivities(aNewManifest, aApp, true);
#else
// Nothing else to do but notifying we're ready.
this.notifyAppsRegistryReady();
#endif
},
checkForUpdate: function(aData, aMm) {
debug("checkForUpdate for " + aData.manifestURL);
@ -1341,16 +1365,8 @@ this.DOMApplicationRegistry = {
let manifest;
if (aNewManifest) {
// Update the web apps' registration.
this.notifyAppsRegistryStart();
#ifdef MOZ_SYS_MSG
this._unregisterActivities(aOldManifest, app);
this._registerSystemMessages(aNewManifest, app);
this._registerActivities(aNewManifest, app, true);
#else
// Nothing else to do but notifying we're ready.
this.notifyAppsRegistryReady();
#endif
this.updateAppHandlers(aOldManifest, aNewManifest, app);
// Store the new manifest.
let dir = FileUtils.getDir(DIRECTORY_NAME, ["webapps", id], true, true);
let manFile = dir.clone();
@ -1900,27 +1916,20 @@ this.DOMApplicationRegistry = {
if (!aFromSync)
this._saveApps((function() {
this.broadcastMessage("Webapps:AddApp", { id: id, app: appObject });
this.broadcastMessage("Webapps:Install:Return:OK", aData);
Services.obs.notifyObservers(this, "webapps-sync-install", appNote);
this.broadcastMessage("Webapps:AddApp", { id: id, app: appObject });
}).bind(this));
if (!aData.isPackage) {
this.notifyAppsRegistryStart();
#ifdef MOZ_SYS_MSG
this._registerSystemMessages(app.manifest, app);
this._registerActivities(app.manifest, app, true);
#else
// Nothing else to do but notifying we're ready.
this.notifyAppsRegistryReady();
#endif
this.updateAppHandlers(null, app.manifest, app);
}
if (manifest.package_path) {
// origin for install apps is meaningless here, since it's app:// and this
// can't be used to resolve package paths.
manifest = new ManifestHelper(jsonManifest, app.manifestURL);
this.downloadPackage(manifest, appObject, false, function(aId, aManifest) {
this.downloadPackage(manifest, appObject, false, (function(aId, aManifest) {
// Success! Move the zip out of TmpD.
let app = DOMApplicationRegistry.webapps[id];
let zipFile = FileUtils.getFile("TmpD", ["webapps", aId, "application.zip"], true);
@ -1934,27 +1943,27 @@ this.DOMApplicationRegistry = {
// Save the manifest
let manFile = dir.clone();
manFile.append("manifest.webapp");
DOMApplicationRegistry._writeFile(manFile,
JSON.stringify(aManifest),
function() { });
this._writeFile(manFile, JSON.stringify(aManifest), function() { });
// Set state and fire events.
app.installState = "installed";
app.downloading = false;
app.downloadAvailable = false;
DOMApplicationRegistry._saveApps(function() {
this._saveApps((function() {
this.updateAppHandlers(null, aManifest, appObject);
// Update the permissions for this app.
PermissionsInstaller.installPermissions({ manifest: aManifest,
origin: appObject.origin,
manifestURL: appObject.manifestURL },
true);
debug("About to fire Webapps:PackageEvent 'installed'");
DOMApplicationRegistry.broadcastMessage("Webapps:PackageEvent",
{ type: "installed",
manifestURL: appObject.manifestURL,
app: app,
manifest: aManifest });
});
});
this.broadcastMessage("Webapps:PackageEvent",
{ type: "installed",
manifestURL: appObject.manifestURL,
app: app,
manifest: aManifest });
}).bind(this));
}).bind(this));
}
},

View File

@ -128,7 +128,7 @@ AudioChannelService::UnregisterType(AudioChannelType aType,
// The array may contain multiple occurrence of this appId but
// this should remove only the first one.
AudioChannelInternalType type = GetInternalType(aType, aElementHidden);
MOZ_ASSERT(!mChannelCounters[type].IsEmpty());
MOZ_ASSERT(mChannelCounters[type].Contains(aChildID));
mChannelCounters[type].RemoveElement(aChildID);
// In order to avoid race conditions, it's safer to notify any existing
@ -138,8 +138,8 @@ AudioChannelService::UnregisterType(AudioChannelType aType,
// If in the background, we kept ChildID for allowing it to play next song.
if (aType == AUDIO_CHANNEL_CONTENT &&
mActiveContentChildIDs.Contains(aChildID) &&
(!aElementHidden &&
!mChannelCounters[AUDIO_CHANNEL_INT_CONTENT].Contains(aChildID))) {
!aElementHidden &&
!mChannelCounters[AUDIO_CHANNEL_INT_CONTENT].Contains(aChildID)) {
mActiveContentChildIDs.RemoveElement(aChildID);
}
SendAudioChannelChangedNotification();
@ -159,6 +159,7 @@ AudioChannelService::UpdateChannelType(AudioChannelType aType,
if (newType != oldType) {
mChannelCounters[newType].AppendElement(aChildID);
MOZ_ASSERT(mChannelCounters[oldType].Contains(aChildID));
mChannelCounters[oldType].RemoveElement(aChildID);
}
}
@ -218,6 +219,7 @@ AudioChannelService::GetMutedInternal(AudioChannelType aType, uint64_t aChildID,
if (mChannelCounters[AUDIO_CHANNEL_INT_CONTENT].IsEmpty()) {
mActiveContentChildIDsFrozen = true;
} else if (!mChannelCounters[AUDIO_CHANNEL_INT_CONTENT].Contains(aChildID)) {
MOZ_ASSERT(mActiveContentChildIDs.Contains(aChildID));
mActiveContentChildIDs.RemoveElement(aChildID);
}
}

View File

@ -306,7 +306,7 @@ Navigator::GetUserAgent(nsAString& aUserAgent)
do_GetService("@mozilla.org/dom/site-specific-user-agent;1");
NS_ENSURE_TRUE(siteSpecificUA, NS_OK);
return siteSpecificUA->GetUserAgentForURI(codebaseURI, aUserAgent);
return siteSpecificUA->GetUserAgentForURIAndWindow(codebaseURI, win, aUserAgent);
}
NS_IMETHODIMP

View File

@ -16,7 +16,7 @@ const DEFAULT_UA = Cc["@mozilla.org/network/protocol;1?name=http"]
function SiteSpecificUserAgent() {}
SiteSpecificUserAgent.prototype = {
getUserAgentForURI: function ssua_getUserAgentForURI(aURI) {
getUserAgentForURIAndWindow: function ssua_getUserAgentForURIAndWindow(aURI, aWindow) {
return UserAgentOverrides.getOverrideForURI(aURI) || DEFAULT_UA;
},

View File

@ -157,7 +157,6 @@
#include "nsIXSLTProcessor.h"
#include "nsIXSLTProcessorPrivate.h"
#include "nsIDOMLSProgressEvent.h"
#include "nsXMLHttpRequest.h"
#include "nsIDOMSettingsManager.h"
#include "nsIDOMContactManager.h"
@ -202,7 +201,6 @@
#include "nsIDOMTimeRanges.h"
#include "nsIDOMHTMLVideoElement.h"
#include "nsIDOMHTMLAudioElement.h"
#include "nsIDOMProgressEvent.h"
#include "nsIDOMCSSCharsetRule.h"
#include "nsIDOMCSSImportRule.h"
#include "nsIDOMCSSMediaRule.h"
@ -929,9 +927,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
NS_DEFINE_CLASSINFO_DATA(StorageItem, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(XMLHttpProgressEvent, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(ClientRect, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
@ -2498,12 +2493,6 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_ENTRY(nsIDOMToString)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN_NO_CLASS_IF(XMLHttpProgressEvent, nsIDOMEvent)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMLSProgressEvent)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMProgressEvent)
DOM_CLASSINFO_EVENT_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(XULCommandEvent, nsIDOMXULCommandEvent)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMXULCommandEvent)
DOM_CLASSINFO_UI_EVENT_MAP_ENTRIES

View File

@ -179,9 +179,6 @@ DOMCI_CLASS(StorageObsolete)
DOMCI_CLASS(Storage)
DOMCI_CLASS(StorageItem)
// XMLHttpRequest
DOMCI_CLASS(XMLHttpProgressEvent)
DOMCI_CLASS(ClientRect)
DOMCI_CLASS(XULCommandEvent)

View File

@ -5,12 +5,13 @@
#include "nsISupports.idl"
interface nsIURI;
interface nsIDOMWindow;
/**
* nsISiteSpecificUserAgent provides you with site-specific User Agent strings.
* nsISiteSpecificUserAgent provides you with site/window-specific User Agent strings.
*/
[scriptable, uuid(604a64af-9809-4c2f-a91d-f6ebfa21f6cb)]
[scriptable, uuid(a509469a-ef3d-4ad1-8dba-c92a96b0bc64)]
interface nsISiteSpecificUserAgent : nsISupports
{
/**
@ -18,8 +19,10 @@ interface nsISiteSpecificUserAgent : nsISupports
*
* @param aURI is the URI of the page the UA string is used for.
*
* @param aWindow is the window this UA is being requested for
*
* @returns the User Agent string for the given URI. If no override applies,
* the default User Agent string is used.
*/
AString getUserAgentForURI(in nsIURI aURI);
AString getUserAgentForURIAndWindow(in nsIURI aURI, in nsIDOMWindow aWindow);
};

View File

@ -534,9 +534,9 @@ DOMInterfaces = {
'attributes' ]
},
'NodeFilter': {
'nativeType': 'nsIDOMNodeFilter',
'headerFile': 'nsIDOMNodeFilter.h',
'NodeIterator': {
'wrapperCache': False,
'resultNotAddRefed': [ 'root', 'referenceNode' ],
},
'NodeList': {
@ -848,6 +848,11 @@ DOMInterfaces = {
'implicitJSContext': [ 'encode' ],
}],
'TreeWalker': {
'wrapperCache': False,
'resultNotAddRefed': [ 'root', 'currentNode' ],
},
'URL' : [{
'concrete': False,
},
@ -1212,7 +1217,6 @@ addExternalIface('MozRDFCompositeDataSource', nativeType='nsIRDFCompositeDataSou
addExternalIface('MozRDFResource', nativeType='nsIRDFResource', notflattened=True)
addExternalIface('MozXULTemplateBuilder', nativeType='nsIXULTemplateBuilder')
addExternalIface('NamedNodeMap')
addExternalIface('NodeIterator')
addExternalIface('nsIStreamListener', nativeType='nsIStreamListener', notflattened=True)
addExternalIface('nsISupports', nativeType='nsISupports')
addExternalIface('nsIEditor', nativeType='nsIEditor', notflattened=True)
@ -1230,7 +1234,6 @@ addExternalIface('SVGAnimatedString')
addExternalIface('SVGLength')
addExternalIface('SVGNumber')
addExternalIface('TextMetrics', headerFile='nsIDOMCanvasRenderingContext2D.h')
addExternalIface('TreeWalker')
addExternalIface('Touch', headerFile='nsIDOMTouchEvent.h')
addExternalIface('TouchList', headerFile='nsIDOMTouchEvent.h')
addExternalIface('URI', nativeType='nsIURI', headerFile='nsIURI.h',

View File

@ -5179,24 +5179,16 @@ ${doConversionsToJS}
(templateVars, type) = arg
assert not type.nullable() # flatMemberTypes never has nullable types
val = "mValue.m%(name)s.Value()" % templateVars
if type.isString():
# XPConnect string-to-JS conversion wants to mutate the string. So
# let's give it a string it can mutate
# XXXbz if we try to do a sequence of strings, this will kinda fail.
prepend = "nsString mutableStr(%s);\n" % val
val = "mutableStr"
else:
prepend = ""
if type.isObject():
# We'll have a NonNull<JSObject> while the wrapping code
# wants a JSObject*
val = "%s.get()" % val
elif type.isSpiderMonkeyInterface():
# We have a NonNull<TypedArray> object while the wrapping code
# wants a JSObject*. Cheat with .get() so we don't have to
# figure out the right reference type to cast to.
val = "%s.get()->Obj()" % val
wrapCode = prepend + wrapForType(
if type.isObject():
# We'll have a NonNull<JSObject> while the wrapping code
# wants a JSObject*
val = "%s.get()" % val
elif type.isSpiderMonkeyInterface():
# We have a NonNull<TypedArray> object while the wrapping code
# wants a JSObject*. Cheat with .get() so we don't have to
# figure out the right reference type to cast to.
val = "%s.get()->Obj()" % val
wrapCode = wrapForType(
type, self.descriptorProvider,
{
"jsvalRef": "*vp",

View File

@ -18,6 +18,8 @@ callback interface TestCallbackInterface {
attribute DOMString bar;
void doSomething();
long doSomethingElse(DOMString arg, TestInterface otherArg);
void doSequenceLongArg(sequence<long> arg);
void doSequenceStringArg(sequence<DOMString> arg);
};
callback interface TestSingleOperationCallbackInterface {

View File

@ -131,23 +131,6 @@
"Range interface: calling isPointInRange(Node,unsigned long) on detachedRange with too few arguments must throw TypeError": true,
"Range interface: calling comparePoint(Node,unsigned long) on detachedRange with too few arguments must throw TypeError": true,
"Range interface: calling intersectsNode(Node) on detachedRange with too few arguments must throw TypeError": true,
"NodeIterator interface: existence and properties of interface object": true,
"NodeIterator interface: existence and properties of interface prototype object": true,
"NodeIterator interface: existence and properties of interface prototype object's \"constructor\" property": true,
"NodeIterator interface: attribute root": true,
"NodeIterator interface: attribute referenceNode": true,
"NodeIterator interface: attribute pointerBeforeReferenceNode": true,
"NodeIterator interface: attribute whatToShow": true,
"NodeIterator interface: attribute filter": true,
"Stringification of document.createNodeIterator(document.body, NodeFilter.SHOW_ALL, null)": "debug",
"TreeWalker interface: existence and properties of interface object": true,
"TreeWalker interface: existence and properties of interface prototype object": true,
"TreeWalker interface: existence and properties of interface prototype object's \"constructor\" property": true,
"TreeWalker interface: attribute root": true,
"TreeWalker interface: attribute whatToShow": true,
"TreeWalker interface: attribute filter": true,
"TreeWalker interface: attribute currentNode": true,
"Stringification of document.createTreeWalker(document.body, NodeFilter.SHOW_ALL, null)": "debug",
"NodeFilter interface: existence and properties of interface object": true,
"NodeFilter interface: existence and properties of interface prototype object": true,
"NodeFilter interface: existence and properties of interface prototype object's \"constructor\" property": true,

View File

@ -1,24 +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
MODULE = dom
XPIDL_MODULE = dom_loadsave
XPIDLSRCS = \
nsIDOMLSProgressEvent.idl \
$(NULL)
include $(topsrcdir)/config/rules.mk
XPIDL_FLAGS += \
-I$(topsrcdir)/dom/interfaces/base \
-I$(topsrcdir)/dom/interfaces/events \
$(NULL)

View File

@ -1,5 +0,0 @@
# 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/.

View File

@ -1,16 +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 nsIDOMLSInput;
[scriptable, builtinclass, uuid(5343c259-78c1-4f20-a81f-5ddce4f0188e)]
interface nsIDOMLSProgressEvent : nsIDOMEvent
{
readonly attribute nsIDOMLSInput input;
readonly attribute unsigned long position;
readonly attribute unsigned long totalSize;
};

View File

@ -218,7 +218,10 @@ private:
nsWeakPtr mMemoryMinimizerRunnable;
};
NS_IMPL_ISUPPORTS2(ProcessPriorityManager, nsIObserver, nsIDOMEventListener)
NS_IMPL_ISUPPORTS3(ProcessPriorityManager,
nsIObserver,
nsIDOMEventListener,
nsITimerCallback)
ProcessPriorityManager::ProcessPriorityManager()
: mHoldsCPUWakeLock(false)

View File

@ -619,6 +619,18 @@ bool TabParent::SendRealTouchEvent(nsTouchEvent& event)
}
MaybeForwardEventToRenderFrame(event, &e);
// Adjust the widget coordinates to be relative to our frame.
nsRefPtr<nsFrameLoader> frameLoader = GetFrameLoader();
if (!frameLoader) {
// No frame anymore?
sEventCapturer = nullptr;
return false;
}
nsEventStateManager::MapEventCoordinatesForChildProcess(frameLoader, &event);
return (e.message == NS_TOUCH_MOVE) ?
PBrowserParent::SendRealTouchMoveEvent(e) :
PBrowserParent::SendRealTouchEvent(e);
@ -655,17 +667,6 @@ TabParent::TryCapture(const nsGUIEvent& aEvent)
return false;
}
// Adjust the widget coordinates to be relative to our frame.
nsRefPtr<nsFrameLoader> frameLoader = GetFrameLoader();
if (!frameLoader) {
// No frame anymore?
sEventCapturer = nullptr;
return false;
}
nsEventStateManager::MapEventCoordinatesForChildProcess(frameLoader, &event);
SendRealTouchEvent(event);
return true;
}

View File

@ -60,8 +60,6 @@ OwnerElementWarning=Use of attributes' ownerElement attribute is deprecated.
NodeValueWarning=Use of attributes' nodeValue attribute is deprecated. Use value instead.
TextContentWarning=Use of attributes' textContent attribute is deprecated. Use value instead.
EnablePrivilegeWarning=Use of enablePrivilege is deprecated. Please use code that runs with the system principal (e.g. an extension) instead.
PositionWarning=Use of XMLHttpRequest's progress events' position attribute is deprecated.
TotalSizeWarning=Use of XMLHttpRequest's progress events' totalSize attribute is deprecated.
nsIJSONDecodeDeprecatedWarning=nsIJSON.decode is deprecated. Please use JSON.parse instead.
nsIJSONEncodeDeprecatedWarning=nsIJSON.encode is deprecated. Please use JSON.stringify instead.
nsIDOMWindowInternalWarning=Use of nsIDOMWindowInternal is deprecated. Use nsIDOMWindow instead.

View File

@ -19,7 +19,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=825703
<script class="testbody" type="application/javascript">
runTest(function () {
if (navigator.platform.startsWith("Win")) {
SimpleTest.expectAssertions(0, 80);
SimpleTest.expectAssertions(0, 280);
}
var pc;
var pcs;

View File

@ -19,7 +19,6 @@ interfaces = [
'range',
'xbl',
'xpath',
'load-save',
'xul',
'storage',
'json',

View File

@ -31,8 +31,10 @@ NS_INTERFACE_MAP_BEGIN(Connection)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(MozConnection)
NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetHelper)
NS_IMPL_ADDREF_INHERITED(Connection, nsDOMEventTargetHelper)
NS_IMPL_RELEASE_INHERITED(Connection, nsDOMEventTargetHelper)
// Don't use |Connection| alone, since that confuses nsTraceRefcnt since
// we're not the only class with that name.
NS_IMPL_ADDREF_INHERITED(dom::network::Connection, nsDOMEventTargetHelper)
NS_IMPL_RELEASE_INHERITED(dom::network::Connection, nsDOMEventTargetHelper)
NS_IMPL_EVENT_HANDLER(Connection, change)

View File

@ -12,12 +12,6 @@
<pre id="test">
<script type="application/javascript">
if (navigator.platform.startsWith("Win")) {
SimpleTest.expectAssertions(11, 38);
} else {
SimpleTest.expectAssertions(11);
}
/** Test for Network API **/
function checkInterface(aInterface) {

View File

@ -12,10 +12,6 @@
<pre id="test">
<script type="application/javascript">
if (navigator.platform.startsWith("Win")) {
SimpleTest.expectAssertions(0, 13);
}
/** Test to ensure TCPSocket permission is disabled by default **/
try {

View File

@ -12,10 +12,6 @@
<pre id="test">
<script type="application/javascript">
if (navigator.platform.startsWith("Win")) {
SimpleTest.expectAssertions(0, 15);
}
/** Test to ensure TCPSocket permission being turned on enables
navigator.mozTCPSocket, but mozTCPSocket.open does not work
in content.

View File

@ -12,12 +12,6 @@
<pre id="test">
<script type="application/javascript">
if (navigator.platform.startsWith("Linux")) {
SimpleTest.expectAssertions(0, 1);
} else if (navigator.platform.startsWith("Win")) {
SimpleTest.expectAssertions(0, 11);
}
/** Test to ensure TCPSocket permission being turned on enables
navigator.mozTCPSocket, and mozTCPSocket.open works when
the tcp-socket permission has been granted.

View File

@ -21,12 +21,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id={770731}
"use strict";
if (navigator.platform.startsWith("Win")) {
SimpleTest.expectAssertions(0, 34);
} else {
SimpleTest.expectAssertions(0, 1);
}
var testPrivApp = {
'manifestURL' : 'https://aprivileged.com/manifest.webapp'
};

View File

@ -98,11 +98,15 @@ this.PhoneNumber = (function (dataBase) {
const VALID_ALPHA_PATTERN = new RegExp("[" + VALID_ALPHA + "]", "g");
const LEADING_PLUS_CHARS_PATTERN = new RegExp("^[" + PLUS_CHARS + "]+", "g");
// Bug 845539 - viable phone number in Venezuela.
const VENEZUELA_SHORT_NUMBER = "\\*[" + VALID_DIGITS + "]";
// We append optionally the extension pattern to the end here, as a valid
// phone number may have an extension prefix appended, followed by 1 or more
// digits.
const VALID_PHONE_NUMBER_PATTERN =
new RegExp("^" + MIN_LENGTH_PHONE_NUMBER + "$|"
+ "^" + VENEZUELA_SHORT_NUMBER + "$|"
+ "^" + VALID_PHONE_NUMBER + "(?:" + EXTN_PATTERNS_FOR_PARSING + ")?$", "i");
// Format of the string encoded meta data. If the name contains "^" or "$"

View File

@ -86,6 +86,8 @@ function Format(dial, currentRegion, nationalNumber, region, nationalFormat, int
IsViable(null, false);
IsViable("", false);
IsViable("1", false);
IsViable("*2", true); // Real number used in Venezuela
IsViable("*8", true); // Real number used in Venezuela
IsViable("12", true); // MIN_LENGTH_PHONE_NUMBER
IsViable("123", true); // MIN_LENGTH_PHONE_NUMBER
IsViable("1a2", false);

View File

@ -22,8 +22,6 @@
else {
if (navigator.platform.startsWith("Win")) {
SimpleTest.expectAssertions(0, 350);
} else {
SimpleTest.expectAssertions(0, 1);
}
setTimeout(checkGCRace, 1000);

View File

@ -18,7 +18,7 @@
<div id="t16" tabindex="2" style="overflow: scroll; max-height: 20px;">
This is a scrollable area with some sufficiently long text contained within it.
</div>
<img id="n13" src="happy.png"/>
<img id="n5" src="happy.png"/>
<img id="t23" tabindex="0" src="happy.png"/>
<a id="t17" tabindex="2" accesskey="f">1</a>
<a id="t24" tabindex="0" href="#">2</a>
@ -47,9 +47,9 @@
</fieldset>
<div id="t30" tabindex="0">abc</div>
<input id="o18" accesskey="u" disabled size="3"/>
<label id="ag" accesskey="g" for="n14">L</label>
<input id="n14" tabindex="-1" type="button"/>
<span id="n15" accesskey="t">s</span>
<label id="ag" accesskey="g" for="n6">L</label>
<input id="n6" tabindex="-1" type="button"/>
<span id="n7" accesskey="t">s</span>
<img id="image" src="data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%18%00%00%00%18%02%03%00%00%00%9D%19%D5k%00%00%00%04gAMA%00%00%B1%8F%0B%FCa%05%00%00%00%0CPLTE%FF%FF%FF%FF%FF%FF%F7%DC%13%00%00%00%03%80%01X%00%00%00%01tRNS%08N%3DPT%00%00%00%01bKGD%00%88%05%1DH%00%00%00%09pHYs%00%00%0B%11%00%00%0B%11%01%7Fd_%91%00%00%00%07tIME%07%D2%05%0C%14%0C%0D%D8%3F%1FQ%00%00%00%5CIDATx%9C%7D%8E%CB%09%C0%20%10D%07r%B7%20%2F%E9wV0%15h%EA%D9%12D4%BB%C1x%CC%5C%1E%0C%CC%07%C0%9C0%9Dd7()%C0A%D3%8D%E0%B8%10%1DiCHM%D0%AC%D2d%C3M%F1%B4%E7%FF%10%0BY%AC%25%93%CD%CBF%B5%B2%C0%3Alh%CD%AE%13%DF%A5%F7%E0%03byW%09A%B4%F3%E2%00%00%00%00IEND%AEB%60%82"
usemap="#map1" ismap>

View File

@ -22,8 +22,8 @@ var fm = Components.classes["@mozilla.org/focus-manager;1"].
const kChildDocumentRootIndex = 13;
const kBeforeTabboxIndex = 34;
const kTabbableSteps = 38;
const kFocusSteps = 18;
const kNoFocusSteps = 15;
const kFocusSteps = 26;
const kNoFocusSteps = 7;
const kOverflowElementIndex = 27;
var gTestStarted = false;
@ -530,8 +530,8 @@ function startTest()
{ ctrlKey : true } : { altKey : true };
// test accesskeys
var keys = ["t26", "t19", "t22", "t29", "t15", "t17", "n14",
"t4", "o1", "o9", "n6"];
var keys = ["t26", "t19", "t22", "t29", "t15", "t17", "n6",
"t4", "o1", "o9", "n4"];
for (var k = 0; k < keys.length; k++) {
var key = String.fromCharCode(65 + k);
@ -556,19 +556,19 @@ function startTest()
expectFocusShift(function () synthesizeMouse(getById("ad"), 2, 2, { }, gChildWindow),
null, getById("t29"), true, "mouse on html label with content inside");
expectFocusShift(function () synthesizeMouse(getById("ag"), 2, 2, { }, gChildWindow),
null, getById("n14"), true, "mouse on html label with for attribute");
null, getById("n6"), true, "mouse on html label with for attribute");
gLastFocusMethod = 0;
expectFocusShift(function () synthesizeMouse(getById("aj"), 2, 2, { }),
null, getById("o9"), true, "mouse on xul label with content inside");
expectFocusShift(function () synthesizeMouse(getById("ak"), 2, 2, { }),
null, getById("n6"), true, "mouse on xul label with control attribute");
null, getById("n4"), true, "mouse on xul label with control attribute");
// test accesskeys that shouldn't work
k = "o".charCodeAt(0);
while (k++ < "v".charCodeAt(0)) {
var key = String.fromCharCode(k);
expectFocusShift(function () synthesizeKey(key, accessKeyDetails),
window, getById("n6"), false, "non accesskey " + key);
window, getById("n4"), false, "non accesskey " + key);
}
gLastFocusMethod = -1;
@ -1614,7 +1614,7 @@ SimpleTest.waitForFocus(startTest);
The elements with ids starting with t are focusable and in the taborder.
The elements with ids starting with o are:
odd numbered ids - focusable but not part of the tab order
even numbered ids - not focusable with -moz-user-focus: ignore
even numbered ids - not focusable with -moz-user-focus: ignore or disabled
The elements with ids starting with n are:
odd numbered ids - not focusable with -moz-user-focus: none
even numbered ids - focusable but not part of the tab order
@ -1647,10 +1647,10 @@ SimpleTest.waitForFocus(startTest);
<button style="display: none;" tabindex="2"/> <button style="visibility: collapse;" tabindex="2"/>
</hbox>
<hbox>
<button id="n5" accesskey="s" label="no tabindex" disabled="true"/>
<button id="n7" label="tabindex = -1" tabindex="-1" disabled="true"/>
<button id="n9" label="tabindex = 0" tabindex="0" disabled="true"/>
<button id="n11" label="tabindex = 2" tabindex="2" disabled="true"/>
<button id="o20" accesskey="s" label="no tabindex" disabled="true"/>
<button id="o22" label="tabindex = -1" tabindex="-1" disabled="true"/>
<button id="o24" label="tabindex = 0" tabindex="0" disabled="true"/>
<button id="o26" label="tabindex = 2" tabindex="2" disabled="true"/>
</hbox>
</vbox>
<vbox>
@ -1694,10 +1694,10 @@ SimpleTest.waitForFocus(startTest);
<button id="t38"/>
<!-- The 't' element tests end here so it doesn't matter that these elements are tabbable -->
<label id="aj" value="j" accesskey="j" control="o9"/>
<label id="ak" accesskey="k" control="n6">k</label>
<label id="ak" accesskey="k" control="n4">k</label>
<checkbox id="o5"/><checkbox id="o7"/><hbox><checkbox id="o9"/></hbox>
<checkbox id="o13"/><checkbox id="o15"/><checkbox id="o17"/>
<checkbox id="n2"/><checkbox id="n4"/><checkbox id="n6"/><checkbox id="n8"/><checkbox id="n10"/><checkbox id="n12"/>
<checkbox id="o13"/><checkbox id="o15"/><checkbox id="o17"/><checkbox id="o19"/><checkbox id="o21"/><checkbox id="o23"/><checkbox id="o25"/>
<checkbox id="n2"/><checkbox id="n4"/>
<listbox id="last" width="20" rows="1"/>
<iframe id="ifa" width="40" height="60" style="-moz-user-focus: ignore;" type="content"

View File

@ -17,12 +17,10 @@
interface Attr;
interface Comment;
interface NodeIterator;
interface Range;
interface StyleSheetList;
interface Touch;
interface TouchList;
interface TreeWalker;
interface WindowProxy;
interface nsISupports;

View File

@ -24,9 +24,7 @@ interface HTMLFrameElement : HTMLElement {
attribute DOMString longDesc;
[SetterThrows]
attribute boolean noResize;
[GetterThrows]
readonly attribute Document? contentDocument;
[GetterThrows]
readonly attribute WindowProxy? contentWindow;
[TreatNullAs=EmptyString, SetterThrows] attribute DOMString marginHeight;

View File

@ -11,14 +11,21 @@
*/
interface NodeIterator {
[Constant]
readonly attribute Node root;
[Pure]
readonly attribute Node? referenceNode;
[Pure]
readonly attribute boolean pointerBeforeReferenceNode;
[Constant]
readonly attribute unsigned long whatToShow;
[Constant]
readonly attribute NodeFilter? filter;
[Throws]
Node? nextNode();
[Throws]
Node? previousNode();
void detach();
;}
};

View File

@ -11,16 +11,27 @@
*/
interface TreeWalker {
[Constant]
readonly attribute Node root;
[Constant]
readonly attribute unsigned long whatToShow;
[Constant]
readonly attribute NodeFilter? filter;
[Pure, SetterThrows]
attribute Node currentNode;
[Throws]
Node? parentNode();
[Throws]
Node? firstChild();
[Throws]
Node? lastChild();
[Throws]
Node? previousSibling();
[Throws]
Node? nextSibling();
[Throws]
Node? previousNode();
[Throws]
Node? nextNode();
};

View File

@ -121,6 +121,7 @@ webidl_files = \
MutationObserver.webidl \
Node.webidl \
NodeFilter.webidl \
NodeIterator.webidl \
NodeList.webidl \
PaintRequest.webidl \
PaintRequestList.webidl \
@ -211,6 +212,7 @@ webidl_files = \
Text.webidl \
TextDecoder.webidl \
TextEncoder.webidl \
TreeWalker.webidl \
URL.webidl \
ValidityState.webidl \
WebSocket.webidl \

View File

@ -36,7 +36,7 @@
#include "nsISelectionPrivate.h"
#include "nsISupportsBase.h"
#include "nsLiteralString.h"
#include "nsNodeIterator.h"
#include "mozilla/dom/NodeIterator.h"
#include "nsTextEditRules.h"
#include "nsTextEditUtils.h"
#include "nsUnicharUtils.h"
@ -450,7 +450,7 @@ GetTextNode(nsISelection *selection, nsEditor *editor) {
NS_ENSURE_TRUE(node, nullptr);
// This should be the root node, walk the tree looking for text nodes
mozilla::dom::NodeFilterHolder filter;
nsNodeIterator iter(node, nsIDOMNodeFilter::SHOW_TEXT, filter);
mozilla::dom::NodeIterator iter(node, nsIDOMNodeFilter::SHOW_TEXT, filter);
while (!editor->IsTextNode(selNode)) {
if (NS_FAILED(res = iter.NextNode(getter_AddRefs(selNode))) || !selNode) {
return nullptr;

View File

@ -227,10 +227,10 @@ class GLContextEGL : public GLContext
config,
EGL_NO_CONTEXT,
attribs);
if (!context) {
NS_WARNING("Failed to create EGLContext!");
return nullptr;
}
}
if (!context) {
NS_WARNING("Failed to create EGLContext!");
return nullptr;
}
nsRefPtr<GLContextEGL> glContext = new GLContextEGL(caps,
@ -551,7 +551,7 @@ public:
EGL_NO_CONTEXT);
if (!mSurface) {
#ifdef MOZ_ANDROID_OMTC
mSurface = mozilla::AndroidBridge::Bridge()->ProvideEGLSurface(false);
mSurface = mozilla::AndroidBridge::Bridge()->ProvideEGLSurface();
if (!mSurface) {
return false;
}
@ -2034,20 +2034,25 @@ GLContextProviderEGL::CreateForWindow(nsIWidget *aWidget)
bool doubleBuffered = true;
bool hasNativeContext = aWidget->HasGLContext();
EGLContext eglContext = sEGLLibrary.fGetCurrentContext();
if (aWidget->HasGLContext() && eglContext) {
//int colorDepth = gfxPlatform::GetPlatform()->GetScreenDepth();
if (hasNativeContext && eglContext) {
void* platformContext = eglContext;
SurfaceCaps caps = SurfaceCaps::Any();
#ifdef MOZ_WIDGET_QT
int depth = gfxPlatform::GetPlatform()->GetScreenDepth();
QGLContext* context = const_cast<QGLContext*>(QGLContext::currentContext());
if (context && context->device()) {
depth = context->device()->depth();
}
doubleBuffered = context->format().doubleBuffer();
const QGLFormat& format = context->format();
doubleBuffered = format.doubleBuffer();
platformContext = context;
caps.bpp16 = depth == 16 ? true : false;
caps.alpha = format.rgba();
caps.depth = format.depth();
caps.stencil = format.stencil();
#endif
SurfaceCaps caps = SurfaceCaps::Any();
EGLConfig config = EGL_NO_CONFIG;
EGLSurface surface = sEGLLibrary.fGetCurrentSurface(LOCAL_EGL_DRAW);
nsRefPtr<GLContextEGL> glContext =
@ -2077,7 +2082,7 @@ GLContextProviderEGL::CreateForWindow(nsIWidget *aWidget)
#ifdef MOZ_ANDROID_OMTC
mozilla::AndroidBridge::Bridge()->RegisterCompositor();
EGLSurface surface = mozilla::AndroidBridge::Bridge()->ProvideEGLSurface(true);
EGLSurface surface = mozilla::AndroidBridge::Bridge()->ProvideEGLSurface();
#else
EGLSurface surface = CreateSurfaceForWindow(aWidget, config);
#endif
@ -2216,11 +2221,12 @@ CreateEGLSurfaceForXSurface(gfxASurface* aSurface, EGLConfig* aConfig)
if (!sEGLLibrary.fChooseConfig(EGL_DISPLAY(),
sEGLLibrary.HasKHRLockSurface() ?
pixmap_lock_config : pixmap_config,
configs, numConfigs, &numConfigs))
return nullptr;
if (numConfigs == 0)
configs, numConfigs, &numConfigs)
|| numConfigs == 0)
{
NS_WARNING("No EGL Config for pixmap!");
return nullptr;
}
int i = 0;
for (i = 0; i < numConfigs; ++i) {
@ -2238,6 +2244,7 @@ CreateEGLSurfaceForXSurface(gfxASurface* aSurface, EGLConfig* aConfig)
}
if (!surface) {
NS_WARNING("Failed to CreatePixmapSurface!");
return nullptr;
}
@ -2288,9 +2295,9 @@ GLContextEGL::CreateEGLPixmapOffscreenContext(const gfxIntSize& size)
GLContextEGL* shareContext = GetGlobalContextEGL();
SurfaceCaps dummyCaps = SurfaceCaps::Any();
nsRefPtr<GLContextEGL> glContext =
GLContextEGL::CreateGLContext(dummyCaps,
shareContext, true,
surface, config);
GLContextEGL::CreateGLContext(dummyCaps,
shareContext, true,
config, surface);
if (!glContext) {
NS_WARNING("Failed to create GLContext from XSurface");
sEGLLibrary.fDestroySurface(EGL_DISPLAY(), surface);

View File

@ -27,6 +27,7 @@
#include "gfxCrashReporterUtils.h"
#ifdef MOZ_METRO
#include "DXGI1_2.h"
#include "nsWindowsHelpers.h"
#endif
using namespace std;
@ -216,7 +217,7 @@ LayerManagerD3D10::Initialize(bool force)
dxgiDevice->GetAdapter(getter_AddRefs(dxgiAdapter));
#ifdef MOZ_METRO
if (gfxWindowsPlatform::IsRunningInWindows8Metro()) {
if (IsRunningInWindowsMetro()) {
nsRefPtr<IDXGIFactory2> dxgiFactory;
dxgiAdapter->GetParent(IID_PPV_ARGS(dxgiFactory.StartAssignment()));
@ -654,10 +655,12 @@ LayerManagerD3D10::VerifyBufferSize()
mSwapChain->ResizeBuffers(1, rect.width, rect.height,
DXGI_FORMAT_B8G8R8A8_UNORM,
0);
} else if (gfxWindowsPlatform::IsRunningInWindows8Metro()) {
#ifdef MOZ_METRO
} else if (IsRunningInWindowsMetro()) {
mSwapChain->ResizeBuffers(2, rect.width, rect.height,
DXGI_FORMAT_B8G8R8A8_UNORM,
0);
#endif
} else {
mSwapChain->ResizeBuffers(1, rect.width, rect.height,
DXGI_FORMAT_B8G8R8A8_UNORM,

View File

@ -87,11 +87,17 @@ typedef struct _qcms_profile qcms_profile;
/* these values match the Rendering Intent values from the ICC spec */
typedef enum {
QCMS_INTENT_DEFAULT = 0,
QCMS_INTENT_MIN = 0,
QCMS_INTENT_PERCEPTUAL = 0,
QCMS_INTENT_RELATIVE_COLORIMETRIC = 1,
QCMS_INTENT_SATURATION = 2,
QCMS_INTENT_ABSOLUTE_COLORIMETRIC = 3
QCMS_INTENT_ABSOLUTE_COLORIMETRIC = 3,
QCMS_INTENT_MAX = 3,
/* Chris Murphy (CM consultant) suggests this as a default in the event that we
* cannot reproduce relative + Black Point Compensation. BPC brings an
* unacceptable performance overhead, so we go with perceptual. */
QCMS_INTENT_DEFAULT = QCMS_INTENT_PERCEPTUAL,
} qcms_intent;
//XXX: I don't really like the _DATA_ prefix

View File

@ -33,8 +33,13 @@ var acceleratedWindows = 0;
while (windows.hasMoreElements()) {
windowutils = windows.getNext().QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
if (windowutils.layerManagerType != "Basic") {
acceleratedWindows++;
try {
if (windowutils.layerManagerType != "Basic") {
acceleratedWindows++;
}
} catch (e) {
// The window may not have a layer manager, in which case we get an error.
// Don't count it as an accelerated window.
}
}

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