Merge m-i to m-c

This commit is contained in:
Phil Ringnalda 2013-08-25 08:20:24 -07:00
commit 0267f47531
319 changed files with 4474 additions and 2553 deletions

View File

@ -11,6 +11,7 @@
#include "AccessibleWrap.h"
#include "IUnknownImpl.h"
#include "nsIURI.h"
using namespace mozilla::a11y;

View File

@ -196,7 +196,6 @@
@BINPATH@/components/dom_offline.xpt
@BINPATH@/components/dom_payment.xpt
@BINPATH@/components/dom_json.xpt
@BINPATH@/components/dom_browserelement.xpt
@BINPATH@/components/dom_messages.xpt
@BINPATH@/components/dom_power.xpt
@BINPATH@/components/dom_quota.xpt

View File

@ -1733,16 +1733,21 @@ ContentPermissionPrompt.prototype = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIContentPermissionPrompt]),
_getChromeWindow: function CPP_getChromeWindow(aWindow) {
var chromeWin = aWindow
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShellTreeItem)
.rootTreeItem
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindow)
.QueryInterface(Ci.nsIDOMChromeWindow);
return chromeWin;
_getBrowserForRequest: function (aRequest) {
var browser;
try {
// "element" is only defined in e10s mode, otherwise it throws.
browser = aRequest.element;
} catch (e) {}
if (!browser) {
var requestingWindow = aRequest.window.top;
// find the requesting browser or iframe
browser = requestingWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShell)
.chromeEventHandler;
}
return browser;
},
/**
@ -1767,19 +1772,7 @@ ContentPermissionPrompt.prototype = {
var browserBundle = Services.strings.createBundle("chrome://browser/locale/browser.properties");
var browser;
try {
// "element" is only defined in e10s mode, otherwise it throws.
browser = aRequest.element;
} catch (e) {}
if (!browser) {
var requestingWindow = aRequest.window.top;
// find the requesting browser or iframe
browser = requestingWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShell)
.chromeEventHandler;
}
var browser = this._getBrowserForRequest(aRequest);
var chromeWin = browser.ownerDocument.defaultView;
var requestPrincipal = aRequest.principal;
@ -1896,8 +1889,7 @@ ContentPermissionPrompt.prototype = {
});
}
var requestingWindow = aRequest.window.top;
var chromeWin = this._getChromeWindow(requestingWindow).wrappedJSObject;
var chromeWin = this._getBrowserForRequest(aRequest).ownerDocument.defaultView;
var link = chromeWin.document.getElementById("geolocation-learnmore-link");
link.value = browserBundle.GetStringFromName("geolocation.learnMore");
link.href = Services.urlFormatter.formatURLPref("browser.geolocation.warning.infoURL");

View File

@ -0,0 +1,7 @@
. "$topsrcdir/browser/config/mozconfigs/win64/common-opt"
mk_add_options MOZ_PGO=1
ac_add_options --enable-official-branding
. "$topsrcdir/build/mozconfig.common.override"

View File

@ -0,0 +1,20 @@
# This file is sourced by the nightly, beta, and release mozconfigs.
. "$topsrcdir/browser/config/mozconfigs/common"
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
ac_add_options --enable-update-packaging
ac_add_options --enable-jemalloc
ac_add_options --with-google-api-keyfile=/e/builds/gapi.data
# Needed to enable breakpad in application.ini
export MOZILLA_OFFICIAL=1
export MOZ_TELEMETRY_REPORTING=1
if test -z "${_PYMAKE}"; then
mk_add_options MOZ_MAKE_FLAGS=-j1
fi
# Package js shell.
export MOZ_PACKAGE_JSSHELL=1

View File

@ -0,0 +1,5 @@
# This file is used by all Win64 builds
ac_add_options --target=x86_64-pc-mingw32
ac_add_options --host=x86_64-pc-mingw32

View File

@ -1,11 +1,6 @@
. "$topsrcdir/browser/config/mozconfigs/common"
. "$topsrcdir/browser/config/mozconfigs/win64/common-win64"
. "$topsrcdir/browser/config/mozconfigs/win64/common-opt"
ac_add_options --target=x86_64-pc-mingw32
ac_add_options --host=x86_64-pc-mingw32
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
ac_add_options --enable-update-packaging
ac_add_options --enable-jemalloc
ac_add_options --enable-signmar
ac_add_options --enable-profiling
ac_add_options --enable-metro
@ -13,18 +8,6 @@ ac_add_options --enable-metro
# Nightlies only since this has a cost in performance
ac_add_options --enable-js-diagnostics
# Needed to enable breakpad in application.ini
export MOZILLA_OFFICIAL=1
export MOZ_TELEMETRY_REPORTING=1
if test -z "${_PYMAKE}"; then
mk_add_options MOZ_MAKE_FLAGS=-j1
fi
# Package js shell.
export MOZ_PACKAGE_JSSHELL=1
. $topsrcdir/build/win64/mozconfig.vs2010
. "$topsrcdir/build/mozconfig.common.override"

View File

@ -0,0 +1,13 @@
# This make file should be identical to the beta mozconfig, apart from the
# safeguard below
. "$topsrcdir/browser/config/mozconfigs/win64/common-opt"
mk_add_options MOZ_PGO=1
ac_add_options --enable-official-branding
# safeguard against someone forgetting to re-set EARLY_BETA_OR_EARLIER in
# defines.sh during the beta cycle
export BUILDING_RELEASE=1
. "$topsrcdir/build/mozconfig.common.override"

View File

@ -24,6 +24,7 @@ MOCHITEST_BROWSER_TESTS = \
browser_dbg_cmd_blackbox.js \
browser_dbg_cmd_break.js \
browser_dbg_debuggerstatement.js \
browser_dbg_listaddons.js \
browser_dbg_listtabs-01.js \
browser_dbg_listtabs-02.js \
browser_dbg_tabactor-01.js \
@ -130,6 +131,8 @@ MOCHITEST_BROWSER_PAGES = \
testactors.js \
browser_dbg_tab1.html \
browser_dbg_tab2.html \
browser_dbg_addon1.xpi \
browser_dbg_addon2.xpi \
browser_dbg_debuggerstatement.html \
browser_dbg_stack.html \
browser_dbg_script-switching.html \

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,100 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
// Make sure the listAddons request works as specified.
var gAddon1 = null;
var gAddon1Actor = null;
var gAddon2 = null;
var gAddon2Actor = null;
var gClient = null;
function test()
{
let transport = DebuggerServer.connectPipe();
gClient = new DebuggerClient(transport);
gClient.connect(function (aType, aTraits) {
is(aType, "browser", "Root actor should identify itself as a browser.");
test_first_addon();
})
}
function test_first_addon()
{
let addonListChanged = false;
gClient.addOneTimeListener("addonListChanged", function () {
addonListChanged = true;
});
addAddon(ADDON1_URL, function(aAddon) {
gAddon1 = aAddon;
gClient.listAddons(function(aResponse) {
for each (let addon in aResponse.addons) {
if (addon.url == ADDON1_URL) {
gAddon1Actor = addon.actor;
}
}
ok(!addonListChanged, "Should not yet be notified that list of addons changed.");
ok(gAddon1Actor, "Should find an addon actor for addon1.");
test_second_addon();
});
});
}
function test_second_addon()
{
let addonListChanged = false;
gClient.addOneTimeListener("addonListChanged", function () {
addonListChanged = true;
});
addAddon(ADDON2_URL, function(aAddon) {
gAddon2 = aAddon;
gClient.listAddons(function(aResponse) {
let foundAddon1 = false;
for each (let addon in aResponse.addons) {
if (addon.url == ADDON1_URL) {
is(addon.actor, gAddon1Actor, "Addon1's actor shouldn't have changed.");
foundAddon1 = true;
}
if (addon.url == ADDON2_URL) {
gAddon2Actor = addon.actor;
}
}
ok(addonListChanged, "Should be notified that list of addons changed.");
ok(foundAddon1, "Should find an addon actor for addon1.");
ok(gAddon2Actor, "Should find an actor for addon2.");
test_remove_addon();
});
});
}
function test_remove_addon()
{
let addonListChanged = false;
gClient.addOneTimeListener("addonListChanged", function () {
addonListChanged = true;
});
removeAddon(gAddon1, function() {
gClient.listAddons(function(aResponse) {
let foundAddon1 = false;
for each (let addon in aResponse.addons) {
if (addon.url == ADDON1_URL) {
foundAddon1 = true;
}
}
ok(addonListChanged, "Should be notified that list of addons changed.");
ok(!foundAddon1, "Addon1 should be gone");
finish_test();
});
});
}
function finish_test()
{
removeAddon(gAddon2, function() {
gClient.close(function() {
finish();
});
});
}

View File

@ -19,10 +19,12 @@ Cu.import("resource://gre/modules/devtools/dbg-client.jsm", tempScope);
Cu.import("resource:///modules/source-editor.jsm", tempScope);
Cu.import("resource:///modules/devtools/gDevTools.jsm", tempScope);
Cu.import("resource://gre/modules/devtools/Loader.jsm", tempScope);
Cu.import("resource://gre/modules/AddonManager.jsm", tempScope);
let SourceEditor = tempScope.SourceEditor;
let DebuggerServer = tempScope.DebuggerServer;
let DebuggerTransport = tempScope.DebuggerTransport;
let DebuggerClient = tempScope.DebuggerClient;
let AddonManager = tempScope.AddonManager;
let gDevTools = tempScope.gDevTools;
let devtools = tempScope.devtools;
let TargetFactory = devtools.TargetFactory;
@ -34,6 +36,8 @@ Services.scriptloader.loadSubScript(testDir + "../../../commandline/test/helpers
const EXAMPLE_URL = "http://example.com/browser/browser/devtools/debugger/test/";
const TAB1_URL = EXAMPLE_URL + "browser_dbg_tab1.html";
const TAB2_URL = EXAMPLE_URL + "browser_dbg_tab2.html";
const ADDON1_URL = EXAMPLE_URL + "browser_dbg_addon1.xpi";
const ADDON2_URL = EXAMPLE_URL + "browser_dbg_addon2.xpi";
const STACK_URL = EXAMPLE_URL + "browser_dbg_stack.html";
// Enable remote debugging for the relevant tests.
@ -106,6 +110,32 @@ function removeTab(aTab, aWindow) {
targetBrowser.removeTab(aTab);
}
function addAddon(aURL, aOnInstallEnded) {
AddonManager.getInstallForURL(aURL, function(aInstall) {
aInstall.install();
var listener = {
onInstallEnded: function(aAddon, aAddonInstall) {
aInstall.removeListener(listener);
aOnInstallEnded(aAddonInstall);
}
};
aInstall.addListener(listener);
}, "application/x-xpinstall");
}
function removeAddon(aAddon, aOnUninstalled) {
var listener = {
onUninstalled: function(aUninstalledAddon) {
if (aUninstalledAddon != aAddon)
return;
AddonManager.removeAddonListener(listener);
aOnUninstalled();
}
};
AddonManager.addAddonListener(listener);
aAddon.uninstall();
}
function closeDebuggerAndFinish(aRemoteFlag, aCallback, aWindow) {
let debuggerClosed = false;
let debuggerDisconnected = false;

View File

@ -203,7 +203,6 @@
@BINPATH@/components/dom_indexeddb.xpt
@BINPATH@/components/dom_offline.xpt
@BINPATH@/components/dom_json.xpt
@BINPATH@/components/dom_browserelement.xpt
@BINPATH@/components/dom_power.xpt
@BINPATH@/components/dom_quota.xpt
@BINPATH@/components/dom_range.xpt

View File

@ -19,6 +19,7 @@
#include "nsIContent.h"
#include "nsIScriptSecurityManager.h"
#include "nsIPrincipal.h"
#include "nsIURI.h"
//XXXtw sadly, this makes consumers of nsContentPolicyUtils depend on widget
#include "nsIDocument.h"

View File

@ -96,7 +96,6 @@ struct JSContext;
struct JSPropertyDescriptor;
struct JSRuntime;
struct nsIntMargin;
struct nsNativeKeyEvent; // Don't include nsINativeKeyBindings.h here: it will force strange compilation error!
template<class E> class nsCOMArray;
template<class E> class nsTArray;
@ -1386,14 +1385,11 @@ public:
static const nsDependentString GetLocalizedEllipsis();
/**
* The routine GetNativeEvent is used to fill nsNativeKeyEvent.
* It's also used in DOMEventToNativeKeyEvent.
* See bug 406407 for details.
* The routine GetNativeEvent returns the result of
* aDOMEvent->GetInternalNSEvent().
* XXX Is this necessary?
*/
static nsEvent* GetNativeEvent(nsIDOMEvent* aDOMEvent);
static bool DOMEventToNativeKeyEvent(nsIDOMKeyEvent* aKeyEvent,
nsNativeKeyEvent* aNativeEvent,
bool aGetCharCode);
/**
* Get the candidates for accelkeys for aDOMKeyEvent.

View File

@ -269,12 +269,7 @@ public:
}
return mDocumentBaseURI ? mDocumentBaseURI : mDocumentURI;
}
virtual already_AddRefed<nsIURI> GetBaseURI() const MOZ_OVERRIDE
{
nsCOMPtr<nsIURI> uri = GetDocBaseURI();
return uri.forget();
}
virtual already_AddRefed<nsIURI> GetBaseURI() const MOZ_OVERRIDE;
virtual nsresult SetBaseURI(nsIURI* aURI) = 0;

View File

@ -111,27 +111,20 @@ Link::LinkState() const
return nsEventStates();
}
already_AddRefed<nsIURI>
nsIURI*
Link::GetURI() const
{
nsCOMPtr<nsIURI> uri(mCachedURI);
// If we have this URI cached, use it.
if (uri) {
return uri.forget();
if (mCachedURI) {
return mCachedURI;
}
// Otherwise obtain it.
Link *self = const_cast<Link *>(this);
Element *element = self->mElement;
uri = element->GetHrefURI();
mCachedURI = element->GetHrefURI();
// We want to cache the URI if we have it
if (uri) {
mCachedURI = uri;
}
return uri.forget();
return mCachedURI;
}
void

View File

@ -20,9 +20,9 @@ namespace dom {
class Element;
#define MOZILLA_DOM_LINK_IMPLEMENTATION_IID \
{ 0x7EA57721, 0xE373, 0x458E, \
{0x8F, 0x44, 0xF8, 0x96, 0x56, 0xB4, 0x14, 0xF5 } }
#define MOZILLA_DOM_LINK_IMPLEMENTATION_IID \
{ 0xb25edee6, 0xdd35, 0x4f8b, \
{ 0xab, 0x90, 0x66, 0xd0, 0xbd, 0x3c, 0x22, 0xd5 } }
class Link : public nsISupports
{
@ -45,8 +45,8 @@ public:
/**
* @return the URI this link is for, if available.
*/
already_AddRefed<nsIURI> GetURI() const;
virtual already_AddRefed<nsIURI> GetURIExternal() const {
nsIURI* GetURI() const;
virtual nsIURI* GetURIExternal() const {
return GetURI();
}
@ -111,11 +111,11 @@ protected:
*/
bool HasURI() const
{
if (mCachedURI)
if (HasCachedURI()) {
return true;
}
nsCOMPtr<nsIURI> uri(GetURI());
return !!uri;
return !!GetURI();
}
nsIURI* GetCachedURI() const { return mCachedURI; }

View File

@ -116,7 +116,6 @@
#include "nsILoadGroup.h"
#include "nsIMEStateManager.h"
#include "nsIMIMEService.h"
#include "nsINativeKeyBindings.h"
#include "nsINode.h"
#include "nsINodeInfo.h"
#include "nsIObjectLoadingContent.h"
@ -4551,39 +4550,6 @@ nsContentUtils::GetNativeEvent(nsIDOMEvent* aDOMEvent)
return aDOMEvent ? aDOMEvent->GetInternalNSEvent() : nullptr;
}
//static
bool
nsContentUtils::DOMEventToNativeKeyEvent(nsIDOMKeyEvent* aKeyEvent,
nsNativeKeyEvent* aNativeEvent,
bool aGetCharCode)
{
bool defaultPrevented;
aKeyEvent->GetDefaultPrevented(&defaultPrevented);
if (defaultPrevented)
return false;
bool trusted = false;
aKeyEvent->GetIsTrusted(&trusted);
if (!trusted)
return false;
if (aGetCharCode) {
aKeyEvent->GetCharCode(&aNativeEvent->charCode);
} else {
aNativeEvent->charCode = 0;
}
aKeyEvent->GetKeyCode(&aNativeEvent->keyCode);
aKeyEvent->GetAltKey(&aNativeEvent->altKey);
aKeyEvent->GetCtrlKey(&aNativeEvent->ctrlKey);
aKeyEvent->GetShiftKey(&aNativeEvent->shiftKey);
aKeyEvent->GetMetaKey(&aNativeEvent->metaKey);
aNativeEvent->mGeckoEvent =
static_cast<nsKeyEvent*>(GetNativeEvent(aKeyEvent));
return true;
}
static bool
HasASCIIDigit(const nsTArray<nsShortcutCandidate>& aCandidates)
{

View File

@ -3259,6 +3259,13 @@ nsIDocument::ReleaseCapture() const
}
}
already_AddRefed<nsIURI>
nsIDocument::GetBaseURI() const
{
nsCOMPtr<nsIURI> uri = GetDocBaseURI();
return uri.forget();
}
nsresult
nsDocument::SetBaseURI(nsIURI* aURI)
{

View File

@ -16,6 +16,7 @@
#include "imgIRequest.h"
#include "nsEventStates.h"
#include "nsEventDispatcher.h"
#include "nsGUIEvent.h"
class nsGenConImageContent MOZ_FINAL : public nsXMLElement,
public nsImageLoadingContent

View File

@ -5,7 +5,10 @@ content.document.title = "Hello, Kitty";
(function start() {
sync_test();
async_test();
sendAsyncMessage("cpows:done", {});
// The sync-ness of this call is important, because otherwise
// we tear down the child's document while we are
// still in the async test in the parent.
sendSyncMessage("cpows:done", {});
}
)();

View File

@ -17,6 +17,11 @@
return opener.wrappedJSObject.ok(condition, message);
}
// Make sure that an error in this file actually causes the test to fail.
window.onerror = function (msg, url, line) {
ok(false, "Error while executing: \n" + msg + "\n" + url + ":" + line);
};
function testCpowMessage(message) {
ok(message.json.check == "ok", "correct json");

View File

@ -21,7 +21,10 @@
}
addLoadEvent(function() {
window.open("cpows_parent.xul", "", "chrome");
// We don't want to set browser.tabs.remote to true, but still have CPOWs enabled.
SpecialPowers.pushPrefEnv({"set": [["dom.ipc.cpows.force-enabled", true]]}, function() {
window.open("cpows_parent.xul", "", "chrome");
});
});
]]></script>
</window>

View File

@ -7,6 +7,7 @@
#define _CANVASUTILS_H_
#include "mozilla/CheckedInt.h"
#include "jsapi.h"
class nsIPrincipal;

View File

@ -2596,7 +2596,7 @@ nsEventStateManager::ComputeScrollTarget(nsIFrame* aTargetFrame,
return frameToScroll;
}
nsPresContext::ScrollbarStyles ss = frameToScroll->GetScrollbarStyles();
ScrollbarStyles ss = frameToScroll->GetScrollbarStyles();
bool hiddenForV = (NS_STYLE_OVERFLOW_HIDDEN == ss.mVertical);
bool hiddenForH = (NS_STYLE_OVERFLOW_HIDDEN == ss.mHorizontal);
if ((hiddenForV && hiddenForH) ||
@ -2705,8 +2705,7 @@ nsEventStateManager::DoScrollText(nsIScrollableFrame* aScrollableFrame,
ComputeScrollAmountForDefaultAction(aEvent, scrollAmountInDevPixels);
// Don't scroll around the axis whose overflow style is hidden.
nsPresContext::ScrollbarStyles overflowStyle =
aScrollableFrame->GetScrollbarStyles();
ScrollbarStyles overflowStyle = aScrollableFrame->GetScrollbarStyles();
if (overflowStyle.mHorizontal == NS_STYLE_OVERFLOW_HIDDEN) {
actualDevPixelScrollAmount.x = 0;
}

View File

@ -15,6 +15,7 @@
#include "nsIDocument.h"
#include "nsIPresShell.h"
#include "nsPresContext.h"
#include "nsIURI.h"
NS_IMPL_NS_NEW_HTML_ELEMENT(Anchor)

View File

@ -7,6 +7,7 @@
#include "mozilla/dom/HTMLFieldSetElementBinding.h"
#include "nsContentList.h"
#include "nsEventDispatcher.h"
#include "nsGUIEvent.h"
NS_IMPL_NS_NEW_HTML_ELEMENT(FieldSet)

View File

@ -21,6 +21,7 @@
#include "nsRefPtrHashtable.h"
#include "nsDataHashtable.h"
#include "nsAsyncDOMEvent.h"
#include "jsfriendapi.h" // For js::ExpandoAndGeneration
class nsIMutableArray;
class nsIURI;

View File

@ -1162,6 +1162,9 @@ HTMLInputElement::TabIndexDefault()
uint32_t
HTMLInputElement::Height()
{
if (mType != NS_FORM_INPUT_IMAGE) {
return 0;
}
return GetWidthHeightForImage(mCurrentRequest).height;
}
@ -1213,6 +1216,9 @@ HTMLInputElement::SetIndeterminate(bool aValue)
uint32_t
HTMLInputElement::Width()
{
if (mType != NS_FORM_INPUT_IMAGE) {
return 0;
}
return GetWidthHeightForImage(mCurrentRequest).width;
}

View File

@ -10,6 +10,8 @@
#include "mozilla/dom/HTMLLabelElementBinding.h"
#include "nsEventDispatcher.h"
#include "nsFocusManager.h"
#include "nsGUIEvent.h"
#include "nsIDOMMouseEvent.h"
// construction, destruction

View File

@ -329,7 +329,8 @@ HTMLLinkElement::GetStyleSheetURL(bool* aIsInline)
if (href.IsEmpty()) {
return nullptr;
}
return Link::GetURI();
nsCOMPtr<nsIURI> uri = Link::GetURI();
return uri.forget();
}
void

View File

@ -10,7 +10,9 @@
#include "nsAttrValueInlines.h"
#include "nsContentUtils.h"
#include "nsEventDispatcher.h"
#include "nsGUIEvent.h"
#include "nsXULContextMenuBuilder.h"
#include "nsIURI.h"
NS_IMPL_NS_NEW_HTML_ELEMENT(Menu)

View File

@ -9,6 +9,7 @@
#include "nsAttrValueInlines.h"
#include "nsContentUtils.h"
#include "nsEventDispatcher.h"
#include "nsGUIEvent.h"
NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(MenuItem)

View File

@ -13,6 +13,7 @@
#include "nsString.h"
#include "nsWrapperCache.h"
#include "nsGenericHTMLElement.h"
#include "jsfriendapi.h" // For js::ExpandoAndGeneration
namespace mozilla {
class ErrorResult;

View File

@ -809,29 +809,41 @@ DoCommandCallback(const char *aCommand, void *aData)
NS_IMETHODIMP
nsTextInputListener::HandleEvent(nsIDOMEvent* aEvent)
{
nsCOMPtr<nsIDOMKeyEvent> keyEvent(do_QueryInterface(aEvent));
NS_ENSURE_TRUE(keyEvent, NS_ERROR_INVALID_ARG);
bool defaultPrevented = false;
nsresult rv = aEvent->GetDefaultPrevented(&defaultPrevented);
NS_ENSURE_SUCCESS(rv, rv);
if (defaultPrevented) {
return NS_OK;
}
nsAutoString eventType;
aEvent->GetType(eventType);
bool isTrusted = false;
rv = aEvent->GetIsTrusted(&isTrusted);
NS_ENSURE_SUCCESS(rv, rv);
if (!isTrusted) {
return NS_OK;
}
nsKeyEvent* keyEvent =
static_cast<nsKeyEvent*>(aEvent->GetInternalNSEvent());
if (keyEvent->eventStructType != NS_KEY_EVENT) {
return NS_ERROR_UNEXPECTED;
}
nsNativeKeyEvent nativeEvent;
nsINativeKeyBindings *bindings = GetKeyBindings();
if (bindings &&
nsContentUtils::DOMEventToNativeKeyEvent(keyEvent, &nativeEvent, false)) {
if (bindings) {
bool handled = false;
if (eventType.EqualsLiteral("keydown")) {
handled = bindings->KeyDown(nativeEvent, DoCommandCallback, mFrame);
}
else if (eventType.EqualsLiteral("keyup")) {
handled = bindings->KeyUp(nativeEvent, DoCommandCallback, mFrame);
}
else if (eventType.EqualsLiteral("keypress")) {
handled = bindings->KeyPress(nativeEvent, DoCommandCallback, mFrame);
}
else {
NS_ABORT();
switch (keyEvent->message) {
case NS_KEY_DOWN:
handled = bindings->KeyDown(*keyEvent, DoCommandCallback, mFrame);
break;
case NS_KEY_UP:
handled = bindings->KeyUp(*keyEvent, DoCommandCallback, mFrame);
break;
case NS_KEY_PRESS:
handled = bindings->KeyPress(*keyEvent, DoCommandCallback, mFrame);
break;
default:
MOZ_CRASH("Unknown key message");
}
if (handled) {
aEvent->PreventDefault();

View File

@ -8,7 +8,7 @@
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none">
<div id="content">
</div>
<pre id="test">
<script type="application/javascript">
@ -17,6 +17,38 @@
// TODO: maybe make those reflections be tested against all input types.
function testWidthHeight(attr) {
var element = document.createElement('input');
is(element[attr], 0, attr + ' always returns 0 if not type=image');
element.setAttribute(attr, '42');
is(element[attr], 0, attr + ' always returns 0 if not type=image');
is(element.getAttribute(attr), '42');
element[attr] = 0;
is(element.getAttribute(attr), '0', 'setting ' + attr + ' changes the content attribute');
element[attr] = 12;
is(element.getAttribute(attr), '12', 'setting ' + attr + ' changes the content attribute');
element.removeAttribute(attr);
ise(element.getAttribute(attr), null);
element = document.createElement('input');
element.type = 'image';
document.getElementById('content').appendChild(element);
isnot(element[attr], 0, attr + ' represents the dimension of the element if type=image');
element.setAttribute(attr, '42');
isnot(element[attr], 0, attr + ' represents the dimension of the element if type=image');
isnot(element[attr], 42, attr + ' represents the dimension of the element if type=image');
is(element.getAttribute(attr), '42');
element[attr] = 0;
is(element.getAttribute(attr), '0', 'setting ' + attr + ' changes the content attribute');
element[attr] = 12;
is(element.getAttribute(attr), '12', 'setting ' + attr + ' changes the content attribute');
element.removeAttribute(attr);
ise(element.getAttribute(attr), null);
}
// .accept
reflectString({
element: document.createElement("input"),
@ -101,11 +133,7 @@ reflectString({
});
// .height
reflectUnsignedInt({
element: document.createElement("input"),
attribute: "height",
nonZero: false
});
testWidthHeight('height');
// .indeterminate doesn't reflect a content attribute.
@ -234,11 +262,7 @@ todo("selectedOption" in document.createElement("input"),
"selectedOption isn't implemented yet");
// .width
reflectUnsignedInt({
element: document.createElement("input"),
attribute: "width",
nonZero: false
});
testWidthHeight('width');
// .willValidate doesn't reflect a content attribute.
// .validity doesn't reflect a content attribute.

View File

@ -39,6 +39,8 @@ class AudioStreamTrack;
class VideoStreamTrack;
}
class MediaStreamDirectListener;
/**
* DOM wrapper for MediaStreams.
*/
@ -74,6 +76,14 @@ public:
MediaStream* GetStream() const { return mStream; }
/**
* Overridden in DOMLocalMediaStreams to allow getUserMedia to pass
* data directly to RTCPeerConnection without going through graph queuing.
* Returns a bool to let us know if direct data will be delivered.
*/
virtual bool AddDirectListener(MediaStreamDirectListener *aListener) { return false; }
virtual void RemoveDirectListener(MediaStreamDirectListener *aListener) {}
bool IsFinished();
/**
* Returns a principal indicating who may access this stream. The stream contents

View File

@ -190,6 +190,7 @@ destroying the MediaDecoder object.
#include "gfxRect.h"
#include "MediaResource.h"
#include "mozilla/ReentrantMonitor.h"
#include "mozilla/TimeStamp.h"
#include "MediaStreamGraph.h"
#include "MediaDecoderOwner.h"
#include "AudioChannelCommon.h"

View File

@ -18,6 +18,7 @@
#include "nsIInterfaceRequestor.h"
#include "MediaCache.h"
#include "mozilla/Attributes.h"
#include "mozilla/TimeStamp.h"
// For HTTP seeking, if number of bytes needing to be
// seeked forward is less than this value then a read is

View File

@ -1976,7 +1976,7 @@ SourceMediaStream::AddTrack(TrackID aID, TrackRate aRate, TrackTicks aStart,
}
bool
SourceMediaStream::AppendToTrack(TrackID aID, MediaSegment* aSegment)
SourceMediaStream::AppendToTrack(TrackID aID, MediaSegment* aSegment, MediaSegment *aRawSegment)
{
MutexAutoLock lock(mMutex);
// ::EndAllTrackAndFinished() can end these before the sources notice
@ -1984,7 +1984,15 @@ SourceMediaStream::AppendToTrack(TrackID aID, MediaSegment* aSegment)
if (!mFinished) {
TrackData *track = FindDataForTrack(aID);
if (track) {
track->mData->AppendFrom(aSegment);
// Data goes into mData, and on the next iteration of the MSG moves
// into the track's segment after NotifyQueuedTrackChanges(). This adds
// 0-10ms of delay before data gets to direct listeners.
// Indirect listeners (via subsequent TrackUnion nodes) are synced to
// playout time, and so can be delayed by buffering.
// Must notify first, since AppendFrom() will empty out aSegment
NotifyDirectConsumers(track, aRawSegment ? aRawSegment : aSegment);
track->mData->AppendFrom(aSegment); // note: aSegment is now dead
appended = true;
} else {
aSegment->Clear();
@ -1996,6 +2004,35 @@ SourceMediaStream::AppendToTrack(TrackID aID, MediaSegment* aSegment)
return appended;
}
void
SourceMediaStream::NotifyDirectConsumers(TrackData *aTrack,
MediaSegment *aSegment)
{
// Call with mMutex locked
MOZ_ASSERT(aTrack);
for (uint32_t j = 0; j < mDirectListeners.Length(); ++j) {
MediaStreamDirectListener* l = mDirectListeners[j];
TrackTicks offset = 0; // FIX! need a separate TrackTicks.... or the end of the internal buffer
l->NotifyRealtimeData(static_cast<MediaStreamGraph*>(GraphImpl()), aTrack->mID, aTrack->mRate,
offset, aTrack->mCommands, *aSegment);
}
}
void
SourceMediaStream::AddDirectListener(MediaStreamDirectListener* aListener)
{
MutexAutoLock lock(mMutex);
mDirectListeners.AppendElement(aListener);
}
void
SourceMediaStream::RemoveDirectListener(MediaStreamDirectListener* aListener)
{
MutexAutoLock lock(mMutex);
mDirectListeners.RemoveElement(aListener);
}
bool
SourceMediaStream::HaveEnoughBuffered(TrackID aID)
{
@ -2073,6 +2110,21 @@ SourceMediaStream::EndAllTrackAndFinish()
// we will call NotifyFinished() to let GetUserMedia know
}
TrackTicks
SourceMediaStream::GetBufferedTicks(TrackID aID)
{
StreamBuffer::Track* track = mBuffer.FindTrack(aID);
if (track) {
MediaSegment* segment = track->GetSegment();
if (segment) {
return segment->GetDuration() -
track->TimeToTicksRoundDown(
GraphTimeToStreamTime(GraphImpl()->mStateComputedTime));
}
}
return 0;
}
void
MediaInputPort::Init()
{

View File

@ -169,6 +169,30 @@ public:
const MediaSegment& aQueuedMedia) {}
};
/**
* This is a base class for media graph thread listener direct callbacks
* from within AppendToTrack(). Note that your regular listener will
* still get NotifyQueuedTrackChanges() callbacks from the MSG thread, so
* you must be careful to ignore them if AddDirectListener was successful.
*/
class MediaStreamDirectListener : public MediaStreamListener
{
public:
virtual ~MediaStreamDirectListener() {}
/*
* This will be called on any MediaStreamDirectListener added to a
* a SourceMediaStream when AppendToTrack() is called. The MediaSegment
* will be the RawSegment (unresampled) if available in AppendToTrack().
* Note that NotifyQueuedTrackChanges() calls will also still occur.
*/
virtual void NotifyRealtimeData(MediaStreamGraph* aGraph, TrackID aID,
TrackRate aTrackRate,
TrackTicks aTrackOffset,
uint32_t aTrackEvents,
const MediaSegment& aMedia) {}
};
/**
* This is a base class for main-thread listener callbacks.
* This callback is invoked on the main thread when the main-thread-visible
@ -599,6 +623,10 @@ public:
* it is still possible for a NotifyPull to occur.
*/
void SetPullEnabled(bool aEnabled);
void AddDirectListener(MediaStreamDirectListener* aListener);
void RemoveDirectListener(MediaStreamDirectListener* aListener);
/**
* Add a new track to the stream starting at the given base time (which
* must be greater than or equal to the last time passed to
@ -613,7 +641,7 @@ public:
* Returns false if the data was not appended because no such track exists
* or the stream was already finished.
*/
bool AppendToTrack(TrackID aID, MediaSegment* aSegment);
bool AppendToTrack(TrackID aID, MediaSegment* aSegment, MediaSegment *aRawSegment = nullptr);
/**
* Returns true if the buffer currently has enough data.
* Returns false if there isn't enough data or if no such track exists.
@ -658,6 +686,17 @@ public:
*/
void EndAllTrackAndFinish();
/**
* Note: Only call from Media Graph thread (eg NotifyPull)
*
* Returns amount of time (data) that is currently buffered in the track,
* assuming playout via PlayAudio or via a TrackUnion - note that
* NotifyQueuedTrackChanges() on a SourceMediaStream will occur without
* any "extra" buffering, but NotifyQueued TrackChanges() on a TrackUnion
* will be buffered.
*/
TrackTicks GetBufferedTicks(TrackID aID);
// XXX need a Reset API
friend class MediaStreamGraphImpl;
@ -704,6 +743,15 @@ protected:
return nullptr;
}
/**
* Notify direct consumers of new data to one of the stream tracks.
* The data doesn't have to be resampled (though it may be). This is called
* from AppendToTrack on the thread providing the data, and will call
* the Listeners on this thread.
*/
void NotifyDirectConsumers(TrackData *aTrack,
MediaSegment *aSegment);
// Media stream graph thread only
MediaStreamListener::Consumption mLastConsumptionState;
@ -713,6 +761,7 @@ protected:
// protected by mMutex
StreamTime mUpdateKnownTracksTime;
nsTArray<TrackData> mUpdateTracks;
nsTArray<nsRefPtr<MediaStreamDirectListener> > mDirectListeners;
bool mPullEnabled;
bool mUpdateFinished;
bool mDestroyed;

View File

@ -4,7 +4,6 @@
* 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 "mozilla/Preferences.h"
#include "mozilla/TimeStamp.h"
#include "mozilla/dom/TimeRanges.h"
#include "MediaResource.h"
#include "mozilla/dom/HTMLMediaElement.h"

View File

@ -11,6 +11,7 @@
#include "nsContentUtils.h"
#include "nsGkAtoms.h"
#include "nsSVGString.h"
#include "nsIURI.h"
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(A)

View File

@ -9,6 +9,7 @@
#include "nsSMILAnimationController.h"
#include "nsSMILAnimationFunction.h"
#include "nsContentUtils.h"
#include "nsIURI.h"
#include "prtime.h"
namespace mozilla {

View File

@ -11,6 +11,7 @@
#include "mozilla/dom/SVGPathElement.h"
#include "nsContentUtils.h"
#include "mozilla/dom/SVGMPathElementBinding.h"
#include "nsIURI.h"
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(MPath)

View File

@ -13,6 +13,7 @@
#include "nsIPresShell.h"
#include "mozilla/dom/Element.h"
#include "nsContentUtils.h"
#include "nsIURI.h"
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(Use)

View File

@ -17,6 +17,8 @@
#include "nsIDOMNode.h"
#include "nsXBLPrototypeBinding.h"
#include "nsXBLProtoImplProperty.h"
#include "nsIURI.h"
#include "xpcpublic.h"
using namespace mozilla;

View File

@ -15,6 +15,7 @@ class nsSupportsHashtable;
class nsXBLPrototypeResources;
class nsXBLPrototypeBinding;
struct nsXBLResource;
class nsIObjectOutputStream;
// *********************************************************************/
// The XBLResourceLoader class

View File

@ -9,6 +9,7 @@
#include "nsContentUtils.h"
#include "nsCxPusher.h"
#include "jsdbgapi.h"
#include "jsfriendapi.h"
using namespace mozilla;

View File

@ -345,7 +345,6 @@ nsXBLWindowKeyHandler::WalkHandlers(nsIDOMKeyEvent* aKeyEvent, nsIAtom* aEventTy
WalkHandlersInternal(aKeyEvent, aEventType, mHandler);
if (isEditor && GetEditorKeyBindings()) {
nsNativeKeyEvent nativeEvent;
// get the DOM window we're attached to
nsCOMPtr<nsIControllers> controllers;
nsCOMPtr<nsPIWindowRoot> root = do_QueryInterface(mTarget);
@ -353,20 +352,30 @@ nsXBLWindowKeyHandler::WalkHandlers(nsIDOMKeyEvent* aKeyEvent, nsIAtom* aEventTy
root->GetControllers(getter_AddRefs(controllers));
}
nsKeyEvent* keyEvent =
static_cast<nsKeyEvent*>(aKeyEvent->GetInternalNSEvent());
MOZ_ASSERT(keyEvent->eventStructType == NS_KEY_EVENT,
"DOM key event's internal event must be nsKeyEvent");
bool handled = false;
if (aEventType == nsGkAtoms::keypress) {
if (nsContentUtils::DOMEventToNativeKeyEvent(aKeyEvent, &nativeEvent, true))
handled = sNativeEditorBindings->KeyPress(nativeEvent,
DoCommandCallback, controllers);
} else if (aEventType == nsGkAtoms::keyup) {
if (nsContentUtils::DOMEventToNativeKeyEvent(aKeyEvent, &nativeEvent, false))
handled = sNativeEditorBindings->KeyUp(nativeEvent,
DoCommandCallback, controllers);
} else {
NS_ASSERTION(aEventType == nsGkAtoms::keydown, "unknown key event type");
if (nsContentUtils::DOMEventToNativeKeyEvent(aKeyEvent, &nativeEvent, false))
handled = sNativeEditorBindings->KeyDown(nativeEvent,
DoCommandCallback, controllers);
switch (keyEvent->message) {
case NS_KEY_PRESS:
handled = sNativeEditorBindings->KeyPress(*keyEvent,
DoCommandCallback,
controllers);
break;
case NS_KEY_UP:
handled = sNativeEditorBindings->KeyUp(*keyEvent,
DoCommandCallback,
controllers);
break;
case NS_KEY_DOWN:
handled = sNativeEditorBindings->KeyDown(*keyEvent,
DoCommandCallback,
controllers);
break;
default:
MOZ_CRASH("Unknown key message");
}
if (handled)

View File

@ -19,6 +19,7 @@
#include "nsAttrName.h"
#include "rdf.h"
#include "nsArrayUtils.h"
#include "nsIURI.h"
#include "nsContentTestNode.h"
#include "nsRDFConInstanceTestNode.h"

View File

@ -185,8 +185,6 @@
#endif
#include "nsIDOMCameraManager.h"
#include "nsIOpenWindowEventDetail.h"
#include "nsIAsyncScrollEventDetail.h"
#include "nsIDOMGlobalObjectConstructor.h"
#include "nsIDOMLockedFile.h"
#include "nsDebug.h"
@ -561,11 +559,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
NS_DEFINE_CLASSINFO_DATA(CameraCapabilities, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(OpenWindowEventDetail, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(AsyncScrollEventDetail, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(LockedFile, nsEventTargetSH,
EVENTTARGET_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(CSSFontFeatureValuesRule, nsDOMGenericSH,
@ -1447,14 +1440,6 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_ENTRY(nsICameraCapabilities)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(OpenWindowEventDetail, nsIOpenWindowEventDetail)
DOM_CLASSINFO_MAP_ENTRY(nsIOpenWindowEventDetail)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(AsyncScrollEventDetail, nsIAsyncScrollEventDetail)
DOM_CLASSINFO_MAP_ENTRY(nsIAsyncScrollEventDetail)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(LockedFile, nsIDOMLockedFile)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMLockedFile)
DOM_CLASSINFO_MAP_END
@ -4269,7 +4254,7 @@ nsHTMLDocumentSH::GetDocumentAllNodeList(JSContext *cx,
// We already have a node list in our reserved slot, use it.
JS::Rooted<JSObject*> obj(cx, JSVAL_TO_OBJECT(collection));
nsIHTMLCollection* htmlCollection;
rv = mozilla::dom::UnwrapObject<nsIHTMLCollection>(cx, obj, htmlCollection);
rv = UNWRAP_OBJECT(HTMLCollection, cx, obj, htmlCollection);
if (NS_SUCCEEDED(rv)) {
NS_ADDREF(*nodeList = static_cast<nsContentList*>(htmlCollection));
}

View File

@ -143,9 +143,6 @@ DOMCI_CLASS(BluetoothDevice)
DOMCI_CLASS(CameraControl)
DOMCI_CLASS(CameraCapabilities)
DOMCI_CLASS(OpenWindowEventDetail)
DOMCI_CLASS(AsyncScrollEventDetail)
DOMCI_CLASS(LockedFile)
DOMCI_CLASS(CSSFontFeatureValuesRule)

View File

@ -8,8 +8,8 @@
#include "nsContentUtils.h"
#include "nsIScriptSecurityManager.h"
#include "prtime.h"
#include "TimeStamp.h"
#include "nsIURI.h"
#include "mozilla/TimeStamp.h"
nsDOMNavigationTiming::nsDOMNavigationTiming()
{

View File

@ -98,7 +98,7 @@ public:
}
private:
nsDOMNavigationTiming(const nsDOMNavigationTiming &){};
nsDOMNavigationTiming(const nsDOMNavigationTiming &) MOZ_DELETE;
~nsDOMNavigationTiming();
void Clear();

View File

@ -2731,7 +2731,7 @@ NS_DOMWriteStructuredClone(JSContext* cx,
void *closure)
{
ImageData* imageData;
nsresult rv = UnwrapObject<ImageData>(cx, obj, imageData);
nsresult rv = UNWRAP_OBJECT(ImageData, cx, obj, imageData);
if (NS_FAILED(rv)) {
// Don't know what this is. Bail.
xpc::Throw(cx, NS_ERROR_DOM_DATA_CLONE_ERR);

View File

@ -4,7 +4,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsPerformance.h"
#include "TimeStamp.h"
#include "nsCOMPtr.h"
#include "nsITimedChannel.h"
#include "nsDOMNavigationTiming.h"
@ -13,6 +12,7 @@
#include "mozilla/dom/PerformanceBinding.h"
#include "mozilla/dom/PerformanceTimingBinding.h"
#include "mozilla/dom/PerformanceNavigationBinding.h"
#include "mozilla/TimeStamp.h"
using namespace mozilla;

View File

@ -1679,7 +1679,7 @@ ReparentWrapper(JSContext* aCx, JS::HandleObject aObjArg)
}
nsObjectLoadingContent* htmlobject;
nsresult rv = UnwrapObject<HTMLObjectElement>(aCx, aObj, htmlobject);
nsresult rv = UNWRAP_OBJECT(HTMLObjectElement, aCx, aObj, htmlobject);
if (NS_FAILED(rv)) {
rv = UnwrapObject<prototypes::id::HTMLEmbedElement,
HTMLSharedObjectElement>(aCx, aObj, htmlobject);

View File

@ -181,6 +181,10 @@ IsDOMObject(JSObject* obj)
return IsDOMClass(clasp) || IsDOMProxy(obj, clasp);
}
#define UNWRAP_OBJECT(Interface, cx, obj, value) \
UnwrapObject<prototypes::id::Interface, \
mozilla::dom::Interface##Binding::NativeType>(cx, obj, value)
// Some callers don't want to set an exception when unwrapping fails
// (for example, overload resolution uses unwrapping to tell what sort
// of thing it's looking at).
@ -257,15 +261,6 @@ IsConvertibleToCallbackInterface(JSContext* cx, JS::Handle<JSObject*> obj)
return IsNotDateOrRegExp(cx, obj);
}
// U must be something that a T* can be assigned to (e.g. T* or an nsRefPtr<T>).
template <class T, typename U>
inline nsresult
UnwrapObject(JSContext* cx, JSObject* obj, U& value)
{
return UnwrapObject<static_cast<prototypes::ID>(
PrototypeIDMap<T>::PrototypeID), T>(cx, obj, value);
}
// The items in the protoAndIfaceArray are indexed by the prototypes::id::ID and
// constructors::id::ID enums, in that order. The end of the prototype objects
// should be the start of the interface objects.

View File

@ -80,7 +80,7 @@ class CGNativePropertyHooks(CGThing):
def declare(self):
if self.descriptor.workers:
return ""
return "extern const NativePropertyHooks sNativePropertyHooks;\n"
return "extern const NativePropertyHooks* sNativePropertyHooks;\n"
def define(self):
if self.descriptor.workers:
return ""
@ -112,7 +112,7 @@ class CGNativePropertyHooks(CGThing):
else:
prototypeID += "_ID_Count"
parent = self.descriptor.interface.parent
parentHooks = ("&" + toBindingNamespace(parent.identifier.name) + "::sNativePropertyHooks"
parentHooks = (toBindingNamespace(parent.identifier.name) + "::sNativePropertyHooks"
if parent else 'nullptr')
return CGWrapper(CGIndenter(CGList([CGGeneric(resolveOwnProperty),
@ -125,11 +125,13 @@ class CGNativePropertyHooks(CGThing):
CGGeneric(constructorID),
CGGeneric(parentHooks)],
",\n")),
pre="const NativePropertyHooks sNativePropertyHooks = {\n",
post="\n};\n").define()
pre="static const NativePropertyHooks sNativePropertyHooksStruct = {\n",
post=("\n"
"};\n"
"const NativePropertyHooks* sNativePropertyHooks = &sNativePropertyHooksStruct;\n")).define()
def NativePropertyHooks(descriptor):
return "&sWorkerNativePropertyHooks" if descriptor.workers else "&sNativePropertyHooks"
return "&sWorkerNativePropertyHooks" if descriptor.workers else "sNativePropertyHooks"
def DOMClass(descriptor):
protoList = ['prototypes::id::' + proto for proto in descriptor.prototypeChain]
@ -166,7 +168,7 @@ class CGDOMJSClass(CGThing):
# Our current reserved slot situation is unsafe for globals. Fix bug 760095!
assert "Window" not in descriptor.interface.identifier.name
def declare(self):
return "extern DOMJSClass Class;\n"
return ""
def define(self):
traceHook = TRACE_HOOK_NAME if self.descriptor.customTrace else 'nullptr'
callHook = LEGACYCALLER_HOOK_NAME if self.descriptor.operations["LegacyCaller"] else 'nullptr'
@ -179,7 +181,7 @@ class CGDOMJSClass(CGThing):
newResolveHook = "JS_ResolveStub"
enumerateHook = "JS_EnumerateStub"
return """
DOMJSClass Class = {
static DOMJSClass Class = {
{ "%s",
%s,
%s, /* addProperty */
@ -565,9 +567,19 @@ class CGHeaders(CGWrapper):
interfaceDeps = [d.interface for d in descriptors]
ancestors = []
for iface in interfaceDeps:
while iface.parent:
if iface.parent:
# We're going to need our parent's prototype, to use as the
# prototype of our prototype object.
ancestors.append(iface.parent)
iface = iface.parent
# And if we have an interface object, we'll need the nearest
# ancestor with an interface object too, so we can use its
# interface object as the proto of our interface object.
if iface.hasInterfaceObject():
parent = iface.parent
while parent and not parent.hasInterfaceObject():
parent = parent.parent
if parent:
ancestors.append(parent)
interfaceDeps.extend(ancestors)
bindingIncludes = set(self.getDeclarationFilename(d) for d in interfaceDeps)
@ -639,7 +651,6 @@ class CGHeaders(CGWrapper):
declareIncludes.add(typeDesc.headerFile)
else:
implementationIncludes.add(typeDesc.headerFile)
bindingHeaders.add(self.getDeclarationFilename(typeDesc.interface))
elif unrolled.isDictionary():
bindingHeaders.add(self.getDeclarationFilename(unrolled.inner))
elif unrolled.isCallback():
@ -962,6 +973,14 @@ class CGAbstractClassHook(CGAbstractStaticMethod):
# Override me
assert(False)
class CGGetJSClassMethod(CGAbstractMethod):
def __init__(self, descriptor):
CGAbstractMethod.__init__(self, descriptor, 'GetJSClass', 'JSClass*',
[])
def definition_body(self):
return " return Class.ToJSClass();"
class CGAddPropertyHook(CGAbstractClassHook):
"""
A hook for addProperty, used to preserve our wrapper from GC.
@ -1871,7 +1890,7 @@ class CGGetPerInterfaceObject(CGAbstractMethod):
args = [Argument('JSContext*', 'aCx'),
Argument('JS::Handle<JSObject*>', 'aGlobal')] + extraArgs
CGAbstractMethod.__init__(self, descriptor, name,
'JS::Handle<JSObject*>', args, inline=True)
'JS::Handle<JSObject*>', args)
self.id = idPrefix + "id::" + self.descriptor.name
def definition_body(self):
return ("""
@ -2030,16 +2049,6 @@ class CGConstructorEnabledViaFunc(CGAbstractMethod):
assert isinstance(func, list) and len(func) == 1
return " return %s(cx, obj);" % func[0]
class CGIsMethod(CGAbstractMethod):
def __init__(self, descriptor):
args = [Argument('JSObject*', 'obj')]
CGAbstractMethod.__init__(self, descriptor, 'Is', 'bool', args)
def definition_body(self):
# Non-proxy implementation would check
# js::GetObjectJSClass(obj) == &Class.mBase
return """ return IsProxy(obj);"""
def CreateBindingJSObject(descriptor, properties, parent):
# When we have unforgeable properties, we're going to define them
# on our object, so we have to root it when we create it, so it
@ -6868,21 +6877,7 @@ class CGPrototypeTraitsClass(CGClass):
templateSpecialization = ['prototypes::id::' + descriptor.name]
enums = [ClassEnum('', ['Depth'],
[descriptor.interface.inheritanceDepth()])]
typedefs = [ClassTypedef('NativeType', descriptor.nativeType)]
CGClass.__init__(self, 'PrototypeTraits', indent=indent,
templateArgs=templateArgs,
templateSpecialization=templateSpecialization,
enums=enums, typedefs=typedefs, isStruct=True)
def deps(self):
return set()
class CGPrototypeIDMapClass(CGClass):
def __init__(self, descriptor, indent=''):
templateArgs = [Argument('class', 'ConcreteClass')]
templateSpecialization = [descriptor.nativeType]
enums = [ClassEnum('', ['PrototypeID'],
['prototypes::id::' + descriptor.name])]
CGClass.__init__(self, 'PrototypeIDMap', indent=indent,
templateArgs=templateArgs,
templateSpecialization=templateSpecialization,
enums=enums, isStruct=True)
@ -7124,10 +7119,10 @@ class CGDOMJSProxyHandlerDOMClass(CGThing):
CGThing.__init__(self)
self.descriptor = descriptor
def declare(self):
return "extern const DOMClass Class;\n"
return ""
def define(self):
return """
const DOMClass Class = """ + DOMClass(self.descriptor) + """;
static const DOMClass Class = """ + DOMClass(self.descriptor) + """;
"""
@ -7720,6 +7715,33 @@ class CGDOMJSProxyHandler(CGClass):
constructors=constructors,
methods=methods)
class CGDOMJSProxyHandlerDeclarer(CGThing):
"""
A class for declaring a DOMProxyHandler.
"""
def __init__(self, handlerThing):
self.handlerThing = handlerThing
def declare(self):
# Our class declaration should happen when we're defining
return ""
def define(self):
return self.handlerThing.declare()
class CGDOMJSProxyHandlerDefiner(CGThing):
"""
A class for defining a DOMProxyHandler.
"""
def __init__(self, handlerThing):
self.handlerThing = handlerThing
def declare(self):
return ""
def define(self):
return self.handlerThing.define()
def stripTrailingWhitespace(text):
tail = '\n' if text.endswith('\n') else ''
lines = text.splitlines()
@ -7741,6 +7763,8 @@ class CGDescriptor(CGThing):
self._deps = descriptor.interface.getDeps()
cgThings = []
cgThings.append(CGGeneric(declare="typedef %s NativeType;\n" %
descriptor.nativeType))
# These are set to true if at least one non-static
# method/getter/setter or jsonifier exist on the interface.
(hasMethod, hasGetter, hasLenientGetter, hasSetter, hasJsonifier,
@ -7849,12 +7873,6 @@ class CGDescriptor(CGThing):
if descriptor.interface.hasInterfacePrototypeObject():
cgThings.append(CGPrototypeJSClass(descriptor, properties))
cgThings.append(CGCreateInterfaceObjectsMethod(descriptor, properties))
if descriptor.interface.hasInterfacePrototypeObject():
cgThings.append(CGGetProtoObjectMethod(descriptor))
if descriptor.interface.hasInterfaceObject():
cgThings.append(CGGetConstructorObjectMethod(descriptor))
if descriptor.interface.hasInterfaceObject():
cgThings.append(CGDefineDOMInterfaceMethod(descriptor))
@ -7891,13 +7909,15 @@ class CGDescriptor(CGThing):
if not descriptor.wrapperCache:
raise TypeError("We need a wrappercache to support expandos for proxy-based "
"bindings (" + descriptor.name + ")")
handlerThing = CGDOMJSProxyHandler(descriptor)
cgThings.append(CGDOMJSProxyHandlerDeclarer(handlerThing))
cgThings.append(CGProxyIsProxy(descriptor))
cgThings.append(CGProxyUnwrap(descriptor))
cgThings.append(CGDOMJSProxyHandlerDOMClass(descriptor))
cgThings.append(CGDOMJSProxyHandler(descriptor))
cgThings.append(CGIsMethod(descriptor))
cgThings.append(CGDOMJSProxyHandlerDefiner(handlerThing))
else:
cgThings.append(CGDOMJSClass(descriptor))
cgThings.append(CGGetJSClassMethod(descriptor))
if descriptor.wrapperCache:
cgThings.append(CGWrapWithCacheMethod(descriptor, properties))
@ -7906,6 +7926,17 @@ class CGDescriptor(CGThing):
cgThings.append(CGWrapNonWrapperCacheMethod(descriptor,
properties))
# CGCreateInterfaceObjectsMethod needs to come after our
# CGDOMJSClass, if any.
cgThings.append(CGCreateInterfaceObjectsMethod(descriptor, properties))
# CGGetProtoObjectMethod and CGGetConstructorObjectMethod need
# to come after CGCreateInterfaceObjectsMethod.
if descriptor.interface.hasInterfacePrototypeObject():
cgThings.append(CGGetProtoObjectMethod(descriptor))
if descriptor.interface.hasInterfaceObject():
cgThings.append(CGGetConstructorObjectMethod(descriptor))
cgThings = CGList((CGIndenter(t, declareOnly=True) for t in cgThings), "\n")
cgThings = CGWrapper(cgThings, pre='\n', post='\n')
self.cgRoot = CGWrapper(CGNamespace(toBindingNamespace(descriptor.name),
@ -8168,7 +8199,6 @@ if (""",
initializerCtor = ClassConstructor([],
bodyInHeader=True,
visibility="public",
body=(
"// Safe to pass a null context if we pass a null value\n"
@ -8554,10 +8584,13 @@ class CGForwardDeclarations(CGWrapper):
# Don't need to do anything for void, primitive, string, any or object.
# There may be some other cases we are missing.
# Needed for at least PrototypeTraits, PrototypeIDMap, and Wrap.
# Needed for at least Wrap.
for d in descriptors:
builder.add(d.nativeType)
# We just about always need NativePropertyHooks
builder.addInMozillaDom("NativePropertyHooks")
for callback in mainCallbacks:
forwardDeclareForType(callback)
for t in getTypesFromCallback(callback):
@ -8596,7 +8629,7 @@ class CGBindingRoot(CGThing):
return any(m.getExtendedAttribute("Pref") for m in iface.members + [iface]);
requiresPreferences = any(descriptorRequiresPreferences(d) for d in descriptors)
hasOwnedDescriptors = any(d.nativeOwnership == 'owned' for d in descriptors)
requiresContentUtils = any(d.interface.hasInterfaceObject() for d in descriptors)
hasProxies = any(d.concrete and d.proxy for d in descriptors)
def descriptorHasChromeOnly(desc):
return (any(isChromeOnly(a) for a in desc.interface.members) or
desc.interface.getExtendedAttribute("ChromeOnly") is not None or
@ -8640,25 +8673,6 @@ class CGBindingRoot(CGThing):
callForEachType(descriptors + callbackDescriptors, dictionaries,
mainCallbacks, checkForXPConnectImpls)
descriptorsWithPrototype = filter(lambda d: d.interface.hasInterfacePrototypeObject(),
descriptors)
traitsClasses = [CGPrototypeTraitsClass(d) for d in descriptorsWithPrototype]
# We must have a 1:1 mapping here, skip for prototypes which
# share an implementation with other prototypes.
traitsClasses.extend([CGPrototypeIDMapClass(d) for d in descriptorsWithPrototype
if d.unsharedImplementation])
# Wrap all of that in our namespaces.
if len(traitsClasses) > 0:
traitsClasses = CGNamespace.build(['mozilla', 'dom'],
CGWrapper(CGList(traitsClasses),
declarePre='\n'),
declareOnly=True)
traitsClasses = CGWrapper(traitsClasses, declarePost='\n')
else:
traitsClasses = None
# Do codegen for all the enums
cgthings = [ CGEnum(e) for e in config.getEnums(webIDLFile) ]
@ -8709,7 +8723,7 @@ class CGBindingRoot(CGThing):
callbackDescriptors + jsImplemented),
CGWrapper(CGGeneric("using namespace mozilla::dom;"),
defineOnly=True),
traitsClasses, curr],
curr],
"\n")
# Add header includes.
@ -8719,19 +8733,21 @@ class CGBindingRoot(CGThing):
callbackDescriptors,
['mozilla/dom/BindingDeclarations.h',
'mozilla/ErrorResult.h',
'mozilla/dom/DOMJSClass.h',
'mozilla/dom/DOMJSProxyHandler.h'],
'jspubtd.h',
'js/RootingAPI.h',
],
['mozilla/dom/BindingUtils.h',
'mozilla/dom/Nullable.h',
'PrimitiveConversions.h',
'WrapperFactory.h',
'mozilla/dom/DOMJSClass.h',
] + (['WorkerPrivate.h',
'nsThreadUtils.h'] if hasWorkerStuff else [])
+ (['mozilla/Preferences.h'] if requiresPreferences else [])
+ (['mozilla/dom/NonRefcountedDOMObject.h'] if hasOwnedDescriptors else [])
+ (['nsContentUtils.h'] if requiresContentUtils else [])
+ (['nsCxPusher.h'] if dictionaries else [])
+ (['AccessCheck.h'] if hasChromeOnly else [])
+ (['mozilla/dom/DOMJSProxyHandler.h'] if hasProxies else [])
+ (['xpcprivate.h'] if isEventTarget else [])
+ (['nsPIDOMWindow.h'] if len(jsImplemented) != 0 else [])
+ (['nsDOMQS.h'] if needsDOMQS["value"] else [])
@ -10228,7 +10244,8 @@ class GlobalGenRoots():
def PrototypeList(config):
# Prototype ID enum.
protos = [d.name for d in config.getDescriptors(hasInterfacePrototypeObject=True)]
descriptorsWithPrototype = config.getDescriptors(hasInterfacePrototypeObject=True)
protos = [d.name for d in descriptorsWithPrototype]
idEnum = CGNamespacedEnum('id', 'ID', ['_ID_Start'] + protos,
[0, '_ID_Start'])
idEnum = CGList([idEnum])
@ -10271,16 +10288,14 @@ class GlobalGenRoots():
curr.append(idEnum)
traitsDecl = CGGeneric(declare="""
traitsDecls = [CGGeneric(declare="""
template <prototypes::ID PrototypeID>
struct PrototypeTraits;
template <class ConcreteClass>
struct PrototypeIDMap;
""")
""")]
traitsDecls.extend(CGPrototypeTraitsClass(d) for d in descriptorsWithPrototype)
traitsDecl = CGNamespace.build(['mozilla', 'dom'],
CGWrapper(traitsDecl, post='\n'))
CGList(traitsDecls, "\n"))
curr.append(traitsDecl)

View File

@ -53,13 +53,6 @@ class Configuration:
entry.append({})
self.descriptors.extend([Descriptor(self, iface, x) for x in entry])
# Mark the descriptors for which the nativeType corresponds to exactly
# one interface.
for descriptor in self.descriptors:
descriptor.unsharedImplementation = all(
d.nativeType != descriptor.nativeType or d == descriptor
for d in self.descriptors)
# Keep the descriptor list sorted for determinism.
self.descriptors.sort(lambda x,y: cmp(x.name, y.name))

View File

@ -11,23 +11,10 @@
#include "mozilla/dom/PrototypeList.h" // auto-generated
#include "mozilla/dom/JSSlots.h"
class nsCycleCollectionParticipant;
// We use slot 0 for holding the raw object. This is safe for both
// globals and non-globals.
#define DOM_OBJECT_SLOT 0
// We use slot 1 for holding the expando object. This is not safe for globals
// until bug 760095 is fixed, so that bug blocks converting Window to new
// bindings.
#define DOM_XRAY_EXPANDO_SLOT 1
// We use slot 2 for holding either a JS::ObjectValue which points to the cached
// SOW or JS::UndefinedValue if this class doesn't need SOWs. This is not safe
// for globals until bug 760095 is fixed, so that bug blocks converting Window
// to new bindings.
#define DOM_OBJECT_SLOT_SOW 2
// All DOM globals must have a slot at DOM_PROTOTYPE_SLOT.
#define DOM_PROTOTYPE_SLOT JSCLASS_GLOBAL_SLOT_COUNT
@ -38,24 +25,6 @@ class nsCycleCollectionParticipant;
#define JSCLASS_DOM_GLOBAL JSCLASS_USERBIT1
#define JSCLASS_IS_DOMIFACEANDPROTOJSCLASS JSCLASS_USERBIT2
// NOTE: This is baked into the Ion JIT as 0 in codegen for LGetDOMProperty and
// LSetDOMProperty. Those constants need to be changed accordingly if this value
// changes.
#define DOM_PROTO_INSTANCE_CLASS_SLOT 0
// Interface objects store a number of reserved slots equal to
// DOM_INTERFACE_SLOTS_BASE + number of named constructors.
#define DOM_INTERFACE_SLOTS_BASE (DOM_XRAY_EXPANDO_SLOT + 1)
// Interface prototype objects store a number of reserved slots equal to
// DOM_INTERFACE_PROTO_SLOTS_BASE or DOM_INTERFACE_PROTO_SLOTS_BASE + 1 if a
// slot for the unforgeable holder is needed.
#define DOM_INTERFACE_PROTO_SLOTS_BASE (DOM_XRAY_EXPANDO_SLOT + 1)
static_assert(DOM_PROTO_INSTANCE_CLASS_SLOT != DOM_XRAY_EXPANDO_SLOT,
"Interface prototype object use both of these, so they must "
"not be the same slot.");
namespace mozilla {
namespace dom {

View File

@ -6,7 +6,7 @@
#include "mozilla/Util.h"
#include "DOMJSProxyHandler.h"
#include "mozilla/dom/DOMJSProxyHandler.h"
#include "xpcpublic.h"
#include "xpcprivate.h"
#include "XPCQuickStubs.h"

View File

@ -9,7 +9,7 @@
#include "mozilla/Attributes.h"
#include "mozilla/Likely.h"
#include "xpcpublic.h"
#include "jsproxy.h"
#include "nsStringGlue.h"
#define DOM_PROXY_OBJECT_SLOT js::PROXY_PRIVATE_SLOT
@ -17,6 +17,8 @@
namespace mozilla {
namespace dom {
class DOMClass;
enum {
JSPROXYSLOT_EXPANDO = 0,
JSPROXYSLOT_XRAY_EXPANDO
@ -24,6 +26,21 @@ enum {
template<typename T> struct Prefable;
extern int HandlerFamily;
inline void* ProxyFamily() { return &HandlerFamily; }
inline bool IsDOMProxy(JSObject *obj, const js::Class* clasp)
{
MOZ_ASSERT(js::GetObjectClass(obj) == clasp);
return (js::IsObjectProxyClass(clasp) || js::IsFunctionProxyClass(clasp)) &&
js::GetProxyHandler(obj)->family() == ProxyFamily();
}
inline bool IsDOMProxy(JSObject *obj)
{
return IsDOMProxy(obj, js::GetObjectClass(obj));
}
class BaseDOMProxyHandler : public js::BaseProxyHandler
{
public:

46
dom/bindings/JSSlots.h Normal file
View File

@ -0,0 +1,46 @@
/* -*- Mode: C++; 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/. */
/**
* This file defines various reserved slot indices used by JavaScript
* reflections of DOM objects.
*/
#ifndef mozilla_dom_DOMSlots_h
#define mozilla_dom_DOMSlots_h
// We use slot 0 for holding the raw object. This is safe for both
// globals and non-globals.
#define DOM_OBJECT_SLOT 0
// We use slot 1 for holding the expando object. This is not safe for globals
// until bug 760095 is fixed, so that bug blocks converting Window to new
// bindings.
#define DOM_XRAY_EXPANDO_SLOT 1
// We use slot 2 for holding either a JS::ObjectValue which points to the cached
// SOW or JS::UndefinedValue if this class doesn't need SOWs. This is not safe
// for globals until bug 760095 is fixed, so that bug blocks converting Window
// to new bindings.
#define DOM_OBJECT_SLOT_SOW 2
// NOTE: This is baked into the Ion JIT as 0 in codegen for LGetDOMProperty and
// LSetDOMProperty. Those constants need to be changed accordingly if this value
// changes.
#define DOM_PROTO_INSTANCE_CLASS_SLOT 0
// Interface objects store a number of reserved slots equal to
// DOM_INTERFACE_SLOTS_BASE + number of named constructors.
#define DOM_INTERFACE_SLOTS_BASE (DOM_XRAY_EXPANDO_SLOT + 1)
// Interface prototype objects store a number of reserved slots equal to
// DOM_INTERFACE_PROTO_SLOTS_BASE or DOM_INTERFACE_PROTO_SLOTS_BASE + 1 if a
// slot for the unforgeable holder is needed.
#define DOM_INTERFACE_PROTO_SLOTS_BASE (DOM_XRAY_EXPANDO_SLOT + 1)
static_assert(DOM_PROTO_INSTANCE_CLASS_SLOT != DOM_XRAY_EXPANDO_SLOT,
"Interface prototype object use both of these, so they must "
"not be the same slot.");
#endif /* mozilla_dom_DOMSlots_h */

View File

@ -10,6 +10,7 @@
#include "jsfriendapi.h"
#include "jsapi.h"
#include "mozilla/dom/BindingDeclarations.h"
#include "nsWrapperCache.h"
namespace mozilla {
namespace dom {

View File

@ -22,6 +22,7 @@ EXPORTS.mozilla.dom += [
'Date.h',
'Errors.msg',
'GeneratedAtomList.h',
'JSSlots.h',
'NonRefcountedDOMObject.h',
'Nullable.h',
'PrimitiveConversions.h',

View File

@ -14,16 +14,16 @@
#include "BrowserElementParent.h"
#include "mozilla/dom/HTMLIFrameElement.h"
#include "nsOpenWindowEventDetail.h"
#include "nsEventDispatcher.h"
#include "nsIDOMCustomEvent.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsVariant.h"
#include "nsAsyncScrollEventDetail.h"
#include "mozilla/dom/BrowserElementDictionariesBinding.h"
#include "nsCxPusher.h"
#include "GeneratedEventClasses.h"
using mozilla::dom::Element;
using mozilla::dom::HTMLIFrameElement;
using mozilla::dom::TabParent;
using namespace mozilla;
using namespace mozilla::dom;
namespace {
@ -72,7 +72,7 @@ CreateIframe(Element* aOpenerFrameElement, const nsAString& aName, bool aRemote)
bool
DispatchCustomDOMEvent(Element* aFrameElement, const nsAString& aEventName,
nsISupports *aDetailValue)
JSContext* cx, JS::Handle<JS::Value> aDetailValue)
{
NS_ENSURE_TRUE(aFrameElement, false);
nsIPresShell *shell = aFrameElement->OwnerDoc()->GetShell();
@ -87,20 +87,24 @@ DispatchCustomDOMEvent(Element* aFrameElement, const nsAString& aEventName,
getter_AddRefs(domEvent));
NS_ENSURE_TRUE(domEvent, false);
nsCOMPtr<nsIWritableVariant> detailVariant = new nsVariant();
nsresult rv = detailVariant->SetAsISupports(aDetailValue);
NS_ENSURE_SUCCESS(rv, false);
nsCOMPtr<nsIDOMCustomEvent> customEvent = do_QueryInterface(domEvent);
NS_ENSURE_TRUE(customEvent, false);
customEvent->InitCustomEvent(aEventName,
/* bubbles = */ true,
/* cancelable = */ false,
detailVariant);
ErrorResult res;
CustomEvent* event = static_cast<CustomEvent*>(customEvent.get());
event->InitCustomEvent(cx,
aEventName,
/* bubbles = */ true,
/* cancelable = */ false,
aDetailValue,
res);
if (res.Failed()) {
return false;
}
customEvent->SetTrusted(true);
// Dispatch the event.
nsEventStatus status = nsEventStatus_eIgnore;
rv = nsEventDispatcher::DispatchDOMEvent(aFrameElement, nullptr,
domEvent, presContext, &status);
nsresult rv = nsEventDispatcher::DispatchDOMEvent(aFrameElement, nullptr,
domEvent, presContext, &status);
return NS_SUCCEEDED(rv);
}
@ -119,18 +123,36 @@ DispatchOpenWindowEvent(Element* aOpenerFrameElement,
const nsAString& aFeatures)
{
// Dispatch a CustomEvent at aOpenerFrameElement with a detail object
// (nsIOpenWindowEventDetail) containing aPopupFrameElement, aURL, aName, and
// (OpenWindowEventDetail) containing aPopupFrameElement, aURL, aName, and
// aFeatures.
// Create the event's detail object.
nsRefPtr<nsOpenWindowEventDetail> detail =
new nsOpenWindowEventDetail(aURL, aName, aFeatures,
aPopupFrameElement->AsDOMNode());
OpenWindowEventDetailInitializer detail;
detail.mUrl = aURL;
detail.mName = aName;
detail.mFeatures = aFeatures;
detail.mFrameElement = aPopupFrameElement;
AutoJSContext cx;
JS::Rooted<JS::Value> val(cx);
nsIGlobalObject* sgo = aPopupFrameElement->OwnerDoc()->GetScopeObject();
if (!sgo) {
return false;
}
JS::Rooted<JSObject*> global(cx, sgo->GetGlobalJSObject());
JSAutoCompartment ac(cx, global);
if (!detail.ToObject(cx, global, &val)) {
MOZ_CRASH("Failed to convert dictionary to JS::Value due to OOM.");
return false;
}
bool dispatchSucceeded =
DispatchCustomDOMEvent(aOpenerFrameElement,
NS_LITERAL_STRING("mozbrowseropenwindow"),
detail);
cx,
val);
// If the iframe is not in some document's DOM at this point, the embedder
// has "blocked" the popup.
@ -263,13 +285,27 @@ NS_IMETHODIMP DispatchAsyncScrollEventRunnable::Run()
{
nsCOMPtr<Element> frameElement = mTabParent->GetOwnerElement();
// Create the event's detail object.
nsRefPtr<nsAsyncScrollEventDetail> detail =
new nsAsyncScrollEventDetail(mContentRect.x, mContentRect.y,
mContentRect.width, mContentRect.height,
mContentSize.width, mContentSize.height);
AsyncScrollEventDetailInitializer detail;
detail.mLeft = mContentRect.x;
detail.mTop = mContentRect.y;
detail.mWidth = mContentRect.width;
detail.mHeight = mContentRect.height;
detail.mScrollWidth = mContentRect.width;
detail.mScrollHeight = mContentRect.height;
AutoSafeJSContext cx;
JS::Rooted<JS::Value> val(cx);
// We can get away with a null global here because
// AsyncScrollEventDetail only contains numeric values.
if (!detail.ToObject(cx, JS::NullPtr(), &val)) {
MOZ_CRASH("Failed to convert dictionary to JS::Value due to OOM.");
return NS_ERROR_FAILURE;
}
DispatchCustomDOMEvent(frameElement,
NS_LITERAL_STRING("mozbrowserasyncscroll"),
detail);
cx,
val);
return NS_OK;
}

View File

@ -46,7 +46,7 @@ public:
*
* 1) We fire a mozbrowseropenwindow CustomEvent on the opener
* iframe element. This event's detail is an instance of
* nsIOpenWindowEventDetail.
* OpenWindowEventDetail.
*
* 2) The embedder (the document which contains the opener iframe) can accept
* the window.open request by inserting event.detail.frameElement (an iframe

View File

@ -6,28 +6,16 @@
TEST_DIRS += ['mochitest']
XPIDL_SOURCES += [
'nsIAsyncScrollEventDetail.idl',
'nsIOpenWindowEventDetail.idl',
]
XPIDL_MODULE = 'dom_browserelement'
MODULE = 'dom'
EXPORTS += [
'nsAsyncScrollEventDetail.h',
'nsOpenWindowEventDetail.h',
]
EXPORTS.mozilla += [
'BrowserElementParent.h',
]
CPP_SOURCES += [
'BrowserElementParent.cpp',
'nsAsyncScrollEventDetail.cpp',
'nsOpenWindowEventDetail.cpp',
]
EXTRA_COMPONENTS += [

View File

@ -1,62 +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/. */
#include "nsAsyncScrollEventDetail.h"
#include "nsDOMClassInfoID.h"
#include "nsIDOMClassInfo.h"
#include "nsIClassInfo.h"
#include "nsDOMClassInfo.h"
NS_IMPL_ADDREF(nsAsyncScrollEventDetail)
NS_IMPL_RELEASE(nsAsyncScrollEventDetail)
NS_INTERFACE_MAP_BEGIN(nsAsyncScrollEventDetail)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_ENTRY(nsIAsyncScrollEventDetail)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(AsyncScrollEventDetail)
NS_INTERFACE_MAP_END
DOMCI_DATA(AsyncScrollEventDetail, nsAsyncScrollEventDetail)
/* readonly attribute float top; */
NS_IMETHODIMP nsAsyncScrollEventDetail::GetTop(float *aTop)
{
*aTop = mTop;
return NS_OK;
}
/* readonly attribute float left; */
NS_IMETHODIMP nsAsyncScrollEventDetail::GetLeft(float *aLeft)
{
*aLeft = mLeft;
return NS_OK;
}
/* readonly attribute float width; */
NS_IMETHODIMP nsAsyncScrollEventDetail::GetWidth(float *aWidth)
{
*aWidth = mWidth;
return NS_OK;
}
/* readonly attribute float height; */
NS_IMETHODIMP nsAsyncScrollEventDetail::GetHeight(float *aHeight)
{
*aHeight = mHeight;
return NS_OK;
}
/* readonly attribute float scrollWidth; */
NS_IMETHODIMP nsAsyncScrollEventDetail::GetScrollWidth(float *aScrollWidth)
{
*aScrollWidth = mScrollWidth;
return NS_OK;
}
/* readonly attribute float scrollHeight; */
NS_IMETHODIMP nsAsyncScrollEventDetail::GetScrollHeight(float *aScrollHeight)
{
*aScrollHeight = mScrollHeight;
return NS_OK;
}

View File

@ -1,36 +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/. */
#include "nsIAsyncScrollEventDetail.h"
/**
* When we send a mozbrowserasyncscroll event (an instance of CustomEvent), we
* use an instance of this class as the event's detail.
*/
class nsAsyncScrollEventDetail : public nsIAsyncScrollEventDetail
{
public:
nsAsyncScrollEventDetail(const float left, const float top,
const float width, const float height,
const float contentWidth, const float contentHeigh)
: mTop(top)
, mLeft(left)
, mWidth(width)
, mHeight(height)
, mScrollWidth(contentWidth)
, mScrollHeight(contentHeigh)
{}
NS_DECL_ISUPPORTS
NS_DECL_NSIASYNCSCROLLEVENTDETAIL
private:
virtual ~nsAsyncScrollEventDetail() {}
const float mTop;
const float mLeft;
const float mWidth;
const float mHeight;
const float mScrollWidth;
const float mScrollHeight;
};

View File

@ -1,20 +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/. */
#include "nsISupports.idl"
interface nsIDOMNode;
/**
* When we send a mozbrowseropenwindow event (an instance of CustomEvent), we
* use an instance of this interface as the event's detail.
*/
[scriptable, uuid(94377af6-956a-4adf-908b-363f7023ae1a)]
interface nsIOpenWindowEventDetail : nsISupports
{
readonly attribute AString url;
readonly attribute AString name;
readonly attribute AString features;
readonly attribute nsIDOMNode frameElement;
};

View File

@ -1,49 +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/. */
#include "nsOpenWindowEventDetail.h"
#include "nsDOMClassInfoID.h"
#include "nsIDOMClassInfo.h"
#include "nsIClassInfo.h"
#include "nsDOMClassInfo.h"
NS_IMPL_CYCLE_COLLECTION_1(nsOpenWindowEventDetail, mFrameElement)
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsOpenWindowEventDetail)
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsOpenWindowEventDetail)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsOpenWindowEventDetail)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_ENTRY(nsIOpenWindowEventDetail)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(OpenWindowEventDetail)
NS_INTERFACE_MAP_END
DOMCI_DATA(OpenWindowEventDetail, nsOpenWindowEventDetail)
NS_IMETHODIMP
nsOpenWindowEventDetail::GetUrl(nsAString& aOut)
{
aOut.Assign(mURL);
return NS_OK;
}
NS_IMETHODIMP
nsOpenWindowEventDetail::GetName(nsAString& aOut)
{
aOut.Assign(mName);
return NS_OK;
}
NS_IMETHODIMP
nsOpenWindowEventDetail::GetFeatures(nsAString& aOut)
{
aOut.Assign(mFeatures);
return NS_OK;
}
NS_IMETHODIMP
nsOpenWindowEventDetail::GetFrameElement(nsIDOMNode** aOut)
{
nsCOMPtr<nsIDOMNode> out = mFrameElement;
out.forget(aOut);
return NS_OK;
}

View File

@ -1,39 +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/. */
#include "nsIOpenWindowEventDetail.h"
#include "nsIDOMNode.h"
#include "nsCycleCollectionParticipant.h"
#include "nsCOMPtr.h"
#include "nsString.h"
/**
* When we send a mozbrowseropenwindow event (an instance of CustomEvent), we
* use an instance of this class as the event's detail.
*/
class nsOpenWindowEventDetail : public nsIOpenWindowEventDetail
{
public:
nsOpenWindowEventDetail(const nsAString& aURL,
const nsAString& aName,
const nsAString& aFeatures,
nsIDOMNode* aFrameElement)
: mURL(aURL)
, mName(aName)
, mFeatures(aFeatures)
, mFrameElement(aFrameElement)
{}
virtual ~nsOpenWindowEventDetail() {}
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS(nsOpenWindowEventDetail)
NS_DECL_NSIOPENWINDOWEVENTDETAIL
private:
const nsString mURL;
const nsString mName;
const nsString mFeatures;
nsCOMPtr<nsIDOMNode> mFrameElement;
};

View File

@ -1494,7 +1494,7 @@ IDBObjectStore::StructuredCloneWriteCallback(JSContext* aCx,
FileManager* fileManager = transaction->Database()->Manager();
file::FileHandle* fileHandle = nullptr;
if (NS_SUCCEEDED(UnwrapObject<file::FileHandle>(aCx, aObj, fileHandle))) {
if (NS_SUCCEEDED(UNWRAP_OBJECT(FileHandle, aCx, aObj, fileHandle))) {
nsRefPtr<FileInfo> fileInfo = fileHandle->GetFileInfo();
// Throw when trying to store non IDB file handles or IDB file handles

View File

@ -391,7 +391,7 @@ IndexedDBDatabaseParent::HandleRequestEvent(nsIDOMEvent* aEvent,
MOZ_ASSERT(!JSVAL_IS_PRIMITIVE(result));
IDBDatabase *database;
rv = UnwrapObject<IDBDatabase>(cx, &result.toObject(), database);
rv = UNWRAP_OBJECT(IDBDatabase, cx, &result.toObject(), database);
if (NS_FAILED(rv)) {
NS_WARNING("Didn't get the object we expected!");
return rv;

View File

@ -24,6 +24,7 @@
#include "nsDOMFile.h"
#include "nsProxyRelease.h"
#include "nsThreadUtils.h"
#include "jsapi.h"
#include "ContentChild.h"
#include "ContentParent.h"

View File

@ -2339,8 +2339,8 @@ TabChild::InitRenderingState()
// This state can't really change during the lifetime of the child.
sCpowsEnabled = Preferences::GetBool("browser.tabs.remote", false);
if (Preferences::GetBool("dom.ipc.cpows.force-disabled", false))
sCpowsEnabled = false;
if (Preferences::GetBool("dom.ipc.cpows.force-enabled", false))
sCpowsEnabled = true;
return true;
}

View File

@ -295,6 +295,23 @@ public:
}
}
// Allow getUserMedia to pass input data directly to PeerConnection/MediaPipeline
virtual bool AddDirectListener(MediaStreamDirectListener *aListener) MOZ_OVERRIDE
{
if (mSourceStream) {
mSourceStream->AddDirectListener(aListener);
return true; // application should ignore NotifyQueuedTrackData
}
return false;
}
virtual void RemoveDirectListener(MediaStreamDirectListener *aListener) MOZ_OVERRIDE
{
if (mSourceStream) {
mSourceStream->RemoveDirectListener(aListener);
}
}
// The actual MediaStream is a TrackUnionStream. But these resources need to be
// explicitly destroyed too.
nsRefPtr<SourceMediaStream> mSourceStream;

View File

@ -17,12 +17,10 @@
#include "nsICharsetConverterManager.h"
#include "nsPluginLogging.h"
#include "nsNPAPIPlugin.h"
#include "mozilla/TimeStamp.h"
#include "mozilla/Preferences.h"
#include <cctype>
using namespace mozilla;
using mozilla::TimeStamp;
// These legacy flags are used in the plugin registry. The states are now
// stored in prefs, but we still need to be able to import them.

View File

@ -104,7 +104,7 @@ PromiseResolver::ResolveInternal(JSContext* aCx,
if (aValue.WasPassed() && aValue.Value().isObject()) {
JS::Rooted<JSObject*> valueObj(aCx, &aValue.Value().toObject());
Promise* nextPromise;
nsresult rv = UnwrapObject<Promise>(aCx, valueObj, nextPromise);
nsresult rv = UNWRAP_OBJECT(Promise, aCx, valueObj, nextPromise);
if (NS_SUCCEEDED(rv)) {
nsRefPtr<PromiseCallback> resolveCb = new ResolvePromiseCallback(this);

View File

@ -73,7 +73,6 @@ var interfaceNamesInGlobalScope =
"AnalyserNode",
"AnimationEvent",
"ArchiveRequest",
"AsyncScrollEventDetail",
"Attr",
"Audio",
"AudioBuffer",
@ -335,7 +334,6 @@ var interfaceNamesInGlobalScope =
"OfflineAudioCompletionEvent",
"OfflineAudioContext",
"OfflineResourceList",
"OpenWindowEventDetail",
"Option",
"OscillatorNode",
"PageTransitionEvent",

View File

@ -0,0 +1,24 @@
/* -*- 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/.
*
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
* liability, trademark and document use rules apply.
*/
dictionary AsyncScrollEventDetail {
float top = 0;
float left = 0;
float width = 0;
float height = 0;
float scrollWidth = 0;
float scrollHeight = 0;
};
dictionary OpenWindowEventDetail {
DOMString url = "";
DOMString name = "";
DOMString features = "";
Node? frameElement = null;
};

View File

@ -22,6 +22,8 @@ interface DummyInterface {
void CameraPictureOptions(optional CameraPictureOptions arg);
void MmsParameters(optional MmsParameters arg);
void MmsAttachment(optional MmsAttachment arg);
void AsyncScrollEventDetail(optional AsyncScrollEventDetail arg);
void OpenWindowEventDetail(optional OpenWindowEventDetail arg);
};
interface DummyInterfaceWorkers {

View File

@ -14,94 +14,109 @@ interface WebGLQuery {
interface WebGL2RenderingContext : WebGLRenderingContext {
/* draw buffers */
const GLenum COLOR_ATTACHMENT1 = 0x8CE1;
const GLenum COLOR_ATTACHMENT2 = 0x8CE2;
const GLenum COLOR_ATTACHMENT3 = 0x8CE3;
const GLenum COLOR_ATTACHMENT4 = 0x8CE4;
const GLenum COLOR_ATTACHMENT5 = 0x8CE5;
const GLenum COLOR_ATTACHMENT6 = 0x8CE6;
const GLenum COLOR_ATTACHMENT7 = 0x8CE7;
const GLenum COLOR_ATTACHMENT8 = 0x8CE8;
const GLenum COLOR_ATTACHMENT9 = 0x8CE9;
const GLenum COLOR_ATTACHMENT10 = 0x8CEA;
const GLenum COLOR_ATTACHMENT11 = 0x8CEB;
const GLenum COLOR_ATTACHMENT12 = 0x8CEC;
const GLenum COLOR_ATTACHMENT13 = 0x8CED;
const GLenum COLOR_ATTACHMENT14 = 0x8CEE;
const GLenum COLOR_ATTACHMENT15 = 0x8CEF;
const GLenum COLOR_ATTACHMENT1 = 0x8CE1;
const GLenum COLOR_ATTACHMENT2 = 0x8CE2;
const GLenum COLOR_ATTACHMENT3 = 0x8CE3;
const GLenum COLOR_ATTACHMENT4 = 0x8CE4;
const GLenum COLOR_ATTACHMENT5 = 0x8CE5;
const GLenum COLOR_ATTACHMENT6 = 0x8CE6;
const GLenum COLOR_ATTACHMENT7 = 0x8CE7;
const GLenum COLOR_ATTACHMENT8 = 0x8CE8;
const GLenum COLOR_ATTACHMENT9 = 0x8CE9;
const GLenum COLOR_ATTACHMENT10 = 0x8CEA;
const GLenum COLOR_ATTACHMENT11 = 0x8CEB;
const GLenum COLOR_ATTACHMENT12 = 0x8CEC;
const GLenum COLOR_ATTACHMENT13 = 0x8CED;
const GLenum COLOR_ATTACHMENT14 = 0x8CEE;
const GLenum COLOR_ATTACHMENT15 = 0x8CEF;
const GLenum DRAW_BUFFER0 = 0x8825;
const GLenum DRAW_BUFFER1 = 0x8826;
const GLenum DRAW_BUFFER2 = 0x8827;
const GLenum DRAW_BUFFER3 = 0x8828;
const GLenum DRAW_BUFFER4 = 0x8829;
const GLenum DRAW_BUFFER5 = 0x882A;
const GLenum DRAW_BUFFER6 = 0x882B;
const GLenum DRAW_BUFFER7 = 0x882C;
const GLenum DRAW_BUFFER8 = 0x882D;
const GLenum DRAW_BUFFER9 = 0x882E;
const GLenum DRAW_BUFFER10 = 0x882F;
const GLenum DRAW_BUFFER11 = 0x8830;
const GLenum DRAW_BUFFER12 = 0x8831;
const GLenum DRAW_BUFFER13 = 0x8832;
const GLenum DRAW_BUFFER14 = 0x8833;
const GLenum DRAW_BUFFER15 = 0x8834;
const GLenum DRAW_BUFFER0 = 0x8825;
const GLenum DRAW_BUFFER1 = 0x8826;
const GLenum DRAW_BUFFER2 = 0x8827;
const GLenum DRAW_BUFFER3 = 0x8828;
const GLenum DRAW_BUFFER4 = 0x8829;
const GLenum DRAW_BUFFER5 = 0x882A;
const GLenum DRAW_BUFFER6 = 0x882B;
const GLenum DRAW_BUFFER7 = 0x882C;
const GLenum DRAW_BUFFER8 = 0x882D;
const GLenum DRAW_BUFFER9 = 0x882E;
const GLenum DRAW_BUFFER10 = 0x882F;
const GLenum DRAW_BUFFER11 = 0x8830;
const GLenum DRAW_BUFFER12 = 0x8831;
const GLenum DRAW_BUFFER13 = 0x8832;
const GLenum DRAW_BUFFER14 = 0x8833;
const GLenum DRAW_BUFFER15 = 0x8834;
const GLenum MAX_COLOR_ATTACHMENTS = 0x8CDF;
const GLenum MAX_DRAW_BUFFERS = 0x8824;
const GLenum MAX_COLOR_ATTACHMENTS = 0x8CDF;
const GLenum MAX_DRAW_BUFFERS = 0x8824;
/* vertex array objects */
const GLenum VERTEX_ARRAY_BINDING = 0x85B5;
void drawBuffers(sequence<GLenum> buffers);
/* blend equations */
const GLenum MIN = 0x8007;
const GLenum MAX = 0x8008;
/* query objects */
const GLenum ANY_SAMPLES_PASSED = 0x8C2F;
const GLenum ANY_SAMPLES_PASSED_CONSERVATIVE = 0x8D6A;
const GLenum CURRENT_QUERY = 0x8865;
const GLenum QUERY_RESULT = 0x8866;
const GLenum QUERY_RESULT_AVAILABLE = 0x8867;
/* draw instanced */
void drawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei primcount);
void drawElementsInstanced(GLenum mode, GLsizei count, GLenum type, GLintptr offset, GLsizei primcount);
/* instanced array */
const GLenum VERTEX_ATTRIB_ARRAY_DIVISOR = 0x88FE;
const GLenum VERTEX_ATTRIB_ARRAY_DIVISOR = 0x88FE;
void vertexAttribDivisor(GLuint index, GLuint divisor);
/* blend equations */
const GLenum MIN = 0x8007;
const GLenum MAX = 0x8008;
/* transform feedback */
const GLenum RASTERIZER_DISCARD = 0x8C89;
const GLenum TRANSFORM_FEEDBACK_BUFFER = 0x8C8E;
const GLenum TRANSFORM_FEEDBACK_BUFFER_BINDING = 0x8C8F;
const GLenum TRANSFORM_FEEDBACK_BUFFER_START = 0x8C84;
const GLenum TRANSFORM_FEEDBACK_BUFFER_SIZE = 0x8C85;
const GLenum MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS = 0x8C8B;
const GLenum RASTERIZER_DISCARD = 0x8C89;
const GLenum TRANSFORM_FEEDBACK_BUFFER = 0x8C8E;
const GLenum TRANSFORM_FEEDBACK_BUFFER_BINDING = 0x8C8F;
const GLenum TRANSFORM_FEEDBACK_BUFFER_START = 0x8C84;
const GLenum TRANSFORM_FEEDBACK_BUFFER_SIZE = 0x8C85;
const GLenum MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS = 0x8C8B;
/* query objects */
const GLenum CURRENT_QUERY = 0x8865;
const GLenum QUERY_RESULT = 0x8866;
const GLenum QUERY_RESULT_AVAILABLE = 0x8867;
void beginQuery(GLenum target, WebGLQuery? queryObject);
WebGLQuery? createQuery();
void deleteQuery(WebGLQuery? queryObject);
void endQuery(GLenum target);
WebGLQuery? getQuery(GLenum target, GLenum pname);
any getQueryObject(WebGLQuery? queryObject, GLenum pname);
[WebGLHandlesContextLoss] GLboolean isQuery(WebGLQuery? queryObject);
/* occlusion queries */
const GLenum ANY_SAMPLES_PASSED = 0x8C2F;
const GLenum ANY_SAMPLES_PASSED_CONSERVATIVE = 0x8D6A;
/* transform feedback queries */
const GLenum TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN = 0x8C88;
const GLenum TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN = 0x8C88;
/* buffer objects */
void bindBufferBase(GLenum target, GLuint index, WebGLBuffer? buffer);
void bindBufferRange(GLenum target, GLuint index, WebGLBuffer? buffer,
GLintptr offset, GLsizeiptr size);
/* state requests */
any getParameterIndexed(GLenum pname, GLuint index);
void beginQuery(GLenum target, WebGLQuery? queryObject);
/* vertex array objects */
const GLenum VERTEX_ARRAY_BINDING = 0x85B5;
void bindVertexArray(WebGLVertexArray? arrayObject);
WebGLQuery? createQuery();
WebGLVertexArray? createVertexArray();
void drawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei primcount);
void drawBuffers(sequence<GLenum> buffers);
void drawElementsInstanced(GLenum mode, GLsizei count, GLenum type, GLintptr offset, GLsizei primcount);
void deleteQuery(WebGLQuery? queryObject);
void deleteVertexArray(WebGLVertexArray? arrayObject);
void endQuery(GLenum target);
WebGLQuery? getQuery(GLenum target, GLenum pname);
any getQueryObject(WebGLQuery? queryObject, GLenum pname);
[WebGLHandlesContextLoss] GLboolean isQuery(WebGLQuery? queryObject);
[WebGLHandlesContextLoss] GLboolean isVertexArray(WebGLVertexArray? arrayObject);
};

View File

@ -33,6 +33,7 @@ webidl_files = \
BeforeUnloadEvent.webidl \
BiquadFilterNode.webidl \
Blob.webidl \
BrowserElementDictionaries.webidl \
CameraManager.webidl \
CanvasRenderingContext2D.webidl \
CaretPosition.webidl \

View File

@ -6,7 +6,6 @@
#include "DOMBindingBase.h"
#include "jsfriendapi.h"
#include "mozilla/dom/DOMJSClass.h"
#include "nsContentUtils.h"
#include "nsWrapperCacheInlines.h"

View File

@ -7,10 +7,12 @@
#define mozilla_dom_workers_dombindinginlines_h__
#include "mozilla/dom/FileReaderSyncBinding.h"
#include "mozilla/dom/JSSlots.h"
#include "mozilla/dom/XMLHttpRequestBinding.h"
#include "mozilla/dom/XMLHttpRequestUploadBinding.h"
#include "mozilla/dom/WorkerLocationBinding.h"
#include "mozilla/dom/WorkerNavigatorBinding.h"
#include "jsfriendapi.h"
BEGIN_WORKERS_NAMESPACE
@ -36,7 +38,7 @@ struct WrapPrototypeTraits
GetJSClass() \
{ \
using namespace mozilla::dom; \
return _class##Binding_workers::Class.ToJSClass(); \
return _class##Binding_workers::GetJSClass(); \
} \
\
static inline JSObject* \

View File

@ -8,8 +8,6 @@
#include "Workers.h"
#include "mozilla/dom/DOMJSClass.h"
BEGIN_WORKERS_NAMESPACE
namespace worker {

View File

@ -257,7 +257,7 @@ struct WorkerStructuredCloneCallbacks
// See if this is an ImageData object.
{
ImageData* imageData = nullptr;
if (NS_SUCCEEDED(UnwrapObject<ImageData>(aCx, aObj, imageData))) {
if (NS_SUCCEEDED(UNWRAP_OBJECT(ImageData, aCx, aObj, imageData))) {
// Prepare the ImageData internals.
uint32_t width = imageData->Width();
uint32_t height = imageData->Height();

View File

@ -64,7 +64,11 @@ SimpleTest.waitForFocus(function() {
text.focus();
SimpleTest.executeSoon(function() {
synthesizeKey("a", { accelKey: true }, frameWindow);
if (navigator.platform.indexOf("Linux") == 0) {
synthesizeKey("a", { altKey: true }, frameWindow);
} else {
synthesizeKey("a", { accelKey: true }, frameWindow);
}
// Windows and Mac don't have primary selection, we should copy the text to
// the global clipboard.
if (!SpecialPowers.supportsSelectionClipboard()) {

View File

@ -428,11 +428,12 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
#endif
InitExtensions();
InitFeatures();
// Disable extensions with partial or incorrect support.
if (WorkAroundDriverBugs()) {
if (Renderer() == RendererAdrenoTM320) {
MarkExtensionUnsupported(OES_standard_derivatives);
MarkUnsupported(GLFeature::standard_derivatives);
}
}
@ -441,6 +442,8 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
"ARB_pixel_buffer_object supported without glMapBuffer/UnmapBuffer being available!");
if (SupportsRobustness()) {
mHasRobustness = false;
if (IsExtensionSupported(ARB_robustness)) {
SymLoadStruct robustnessSymbols[] = {
{ (PRFuncPtr*) &mSymbols.fGetGraphicsResetStatus, { "GetGraphicsResetStatusARB", nullptr } },
@ -450,7 +453,6 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
if (!LoadSymbols(&robustnessSymbols[0], trygl, prefix)) {
NS_ERROR("GL supports ARB_robustness without supplying GetGraphicsResetStatusARB.");
MarkExtensionUnsupported(ARB_robustness);
mSymbols.fGetGraphicsResetStatus = nullptr;
} else {
mHasRobustness = true;
@ -466,12 +468,15 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
if (!LoadSymbols(&robustnessSymbols[0], trygl, prefix)) {
NS_ERROR("GL supports EXT_robustness without supplying GetGraphicsResetStatusEXT.");
MarkExtensionUnsupported(EXT_robustness);
mSymbols.fGetGraphicsResetStatus = nullptr;
} else {
mHasRobustness = true;
}
}
if (!mHasRobustness) {
MarkUnsupported(GLFeature::robustness);
}
}
// Check for aux symbols based on extensions
@ -653,7 +658,7 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
if (!LoadSymbols(instancedArraySymbols, trygl, prefix)) {
NS_ERROR("GL supports array instanced without supplying it function.");
mInitialized &= MarkUnsupported(GLFeature::instanced_arrays);
MarkUnsupported(GLFeature::instanced_arrays);
mSymbols.fVertexAttribDivisor = nullptr;
}
}
@ -762,9 +767,9 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
if (!LoadSymbols(queryObjectsSymbols, trygl, prefix)) {
NS_ERROR("GL supports query objects without supplying its functions.");
mInitialized &= MarkUnsupported(GLFeature::query_objects);
mInitialized &= MarkUnsupported(GLFeature::get_query_object_iv);
mInitialized &= MarkUnsupported(GLFeature::occlusion_query);
MarkUnsupported(GLFeature::query_objects);
MarkUnsupported(GLFeature::get_query_object_iv);
MarkUnsupported(GLFeature::occlusion_query);
MarkUnsupported(GLFeature::occlusion_query_boolean);
MarkUnsupported(GLFeature::occlusion_query2);
mSymbols.fBeginQuery = nullptr;
@ -786,7 +791,7 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
if (!LoadSymbols(queryObjectsSymbols, trygl, prefix)) {
NS_ERROR("GL supports query objects iv getter without supplying its function.");
mInitialized &= MarkUnsupported(GLFeature::get_query_object_iv);
MarkUnsupported(GLFeature::get_query_object_iv);
mSymbols.fGetQueryObjectiv = nullptr;
}
}

View File

@ -505,20 +505,25 @@ protected:
* by the context version/profile
*/
public:
bool IsSupported(GLFeature::Enum feature) const;
bool IsSupported(GLFeature::Enum feature) const {
return mAvailableFeatures[feature];
}
static const char* GetFeatureName(GLFeature::Enum feature);
private:
ExtensionBitset<GLFeature::EnumMax> mAvailableFeatures;
/**
* Mark all extensions of this feature as unsupported.
*
* Returns false if marking this extension group as unsupported contradicts
* the OpenGL version and profile. Returns true otherwise.
* Init features regarding OpenGL extension and context version and profile
*/
bool MarkUnsupported(GLFeature::Enum feature);
void InitFeatures();
/**
* Mark the feature and associated extensions as unsupported
*/
void MarkUnsupported(GLFeature::Enum feature);
// -----------------------------------------------------------------------------
// Robustness handling

View File

@ -332,43 +332,42 @@ GLContext::GetFeatureName(GLFeature::Enum feature)
return GetFeatureInfo(feature).mName;
}
bool
GLContext::IsSupported(GLFeature::Enum feature) const
void
GLContext::InitFeatures()
{
if (IsFeatureIsPartOfProfileVersion(feature, mProfile, mVersion)) {
return true;
}
const FeatureInfo& featureInfo = GetFeatureInfo(feature);
for (size_t i = 0; true; i++)
for (size_t i = 0; i < GLFeature::EnumMax; i++)
{
MOZ_ASSERT(i < kMAX_EXTENSION_GROUP_SIZE, "kMAX_EXTENSION_GROUP_SIZE too small");
GLFeature::Enum feature = GLFeature::Enum(i);
if (featureInfo.mExtensions[i] == GLContext::Extensions_End) {
break;
if (IsFeatureIsPartOfProfileVersion(feature, mProfile, mVersion)) {
mAvailableFeatures[feature] = true;
continue;
}
if (IsExtensionSupported(featureInfo.mExtensions[i])) {
return true;
mAvailableFeatures[feature] = false;
const FeatureInfo& featureInfo = GetFeatureInfo(feature);
for (size_t j = 0; true; j++)
{
MOZ_ASSERT(j < kMAX_EXTENSION_GROUP_SIZE, "kMAX_EXTENSION_GROUP_SIZE too small");
if (featureInfo.mExtensions[j] == GLContext::Extensions_End) {
break;
}
if (IsExtensionSupported(featureInfo.mExtensions[j])) {
mAvailableFeatures[feature] = true;
break;
}
}
}
return false;
}
bool
void
GLContext::MarkUnsupported(GLFeature::Enum feature)
{
MOZ_ASSERT(IsSupported(feature), "extension group is already unsupported!");
if (IsFeatureIsPartOfProfileVersion(feature, mProfile, mVersion)) {
NS_WARNING(nsPrintfCString("%s marked as unsupported, but it's supposed to be supported by %s %s",
GetFeatureName(feature),
ProfileString(),
VersionString()).get());
return false;
}
mAvailableFeatures[feature] = false;
const FeatureInfo& featureInfo = GetFeatureInfo(feature);
@ -383,11 +382,9 @@ GLContext::MarkUnsupported(GLFeature::Enum feature)
MarkExtensionUnsupported(featureInfo.mExtensions[i]);
}
MOZ_ASSERT(!IsSupported(feature), "GLContext::MarkExtensionGroupUnsupported has failed!");
MOZ_ASSERT(!IsSupported(feature), "GLContext::MarkUnsupported has failed!");
NS_WARNING(nsPrintfCString("%s marked as unsupported", GetFeatureName(feature)).get());
return true;
}
} /* namespace gl */

View File

@ -14,7 +14,6 @@ include protocol PLayer;
include protocol PRenderFrame;
include "mozilla/WidgetUtils.h";
include "mozilla/TimeStamp.h";
include "mozilla/dom/ScreenOrientation.h";
include "nsCSSProperty.h";
include "gfxipc/ShadowLayerUtils.h";

View File

@ -17,7 +17,6 @@
#include "mozilla/Assertions.h" // for MOZ_ASSERT, etc
#include "mozilla/Attributes.h" // for MOZ_OVERRIDE, MOZ_FINAL
#include "mozilla/RefPtr.h" // for TemporaryRef, RefPtr
#include "mozilla/TimeStamp.h" // for TimeStamp
#include "mozilla/gfx/BaseSize.h" // for BaseSize
#include "mozilla/gfx/Point.h" // for IntSize, Point
#include "mozilla/gfx/Rect.h" // for Rect, IntRect
@ -42,6 +41,8 @@ class nsIWidget;
struct gfxMatrix;
namespace mozilla {
class TimeStamp;
namespace gfx {
class Matrix4x4;
}

View File

@ -217,7 +217,7 @@ public:
}
void BroadcastInformation(const InfoType& aInfo) {
// It is possible for mObservers to be NULL here on some platforms,
// It is possible for mObservers to be nullptr here on some platforms,
// because a call to BroadcastInformation gets queued up asynchronously
// while RemoveObserver is running (and before the notifications are
// disabled). The queued call can then get run after mObservers has
@ -746,12 +746,12 @@ SwitchState GetCurrentSwitchState(SwitchDevice aDevice)
typedef mozilla::ObserverList<SwitchEvent> SwitchObserverList;
static SwitchObserverList *sSwitchObserverLists = NULL;
static SwitchObserverList *sSwitchObserverLists = nullptr;
static SwitchObserverList&
GetSwitchObserverList(SwitchDevice aDevice) {
MOZ_ASSERT(0 <= aDevice && aDevice < NUM_SWITCH_DEVICE);
if (sSwitchObserverLists == NULL) {
if (sSwitchObserverLists == nullptr) {
sSwitchObserverLists = new SwitchObserverList[NUM_SWITCH_DEVICE];
}
return sSwitchObserverLists[aDevice];
@ -766,7 +766,7 @@ ReleaseObserversIfNeeded() {
//The length of every list is 0, no observer in the list.
delete [] sSwitchObserverLists;
sSwitchObserverLists = NULL;
sSwitchObserverLists = nullptr;
}
void

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