зеркало из https://github.com/mozilla/gecko-dev.git
Merge mozilla-central to fx-team
This commit is contained in:
Коммит
9c84360118
|
@ -54,7 +54,6 @@ tasks:
|
|||
# Bug 1269443: cache scopes, etc. must be listed explicitly
|
||||
- "docker-worker:cache:level-{{level}}-*"
|
||||
- "docker-worker:cache:tooltool-cache"
|
||||
- "secrets:get:project/taskcluster/gecko/hgfingerprint"
|
||||
# mozilla-taskcluster will append the appropriate assume:repo:<repo>
|
||||
# scope here.
|
||||
|
||||
|
|
|
@ -659,9 +659,7 @@ TextAttrsMgr::FontWeightTextAttr::
|
|||
// font->GetStyle()->weight will give the absolute weight requested of the
|
||||
// font face. The gfxPangoFontGroup code uses the gfxFontEntry constructor
|
||||
// which doesn't initialize the weight field.
|
||||
#if defined(MOZ_WIDGET_QT)
|
||||
useFontEntryWeight = false;
|
||||
#elif defined(MOZ_WIDGET_GTK)
|
||||
#if defined(MOZ_WIDGET_GTK)
|
||||
useFontEntryWeight = gfxPlatformGtk::UseFcFontList();
|
||||
#endif
|
||||
|
||||
|
|
|
@ -11,6 +11,10 @@
|
|||
#include "ARIAMap.h"
|
||||
#include "nsCoreUtils.h"
|
||||
|
||||
#ifdef A11Y_LOG
|
||||
#include "Logging.h"
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
|
@ -76,6 +80,30 @@ Accessible::ScrollTo(uint32_t aHow) const
|
|||
nsCoreUtils::ScrollTo(mDoc->PresShell(), mContent, aHow);
|
||||
}
|
||||
|
||||
inline bool
|
||||
Accessible::InsertAfter(Accessible* aNewChild, Accessible* aRefChild)
|
||||
{
|
||||
MOZ_ASSERT(aNewChild, "No new child to insert");
|
||||
|
||||
if (aRefChild && aRefChild->Parent() != this) {
|
||||
#ifdef A11Y_LOG
|
||||
logging::TreeInfo("broken accessible tree", 0,
|
||||
"parent", this, "prev sibling parent",
|
||||
aRefChild->Parent(), "child", aNewChild, nullptr);
|
||||
if (logging::IsEnabled(logging::eVerbose)) {
|
||||
logging::Tree("TREE", "Document tree", mDoc);
|
||||
logging::DOMTree("TREE", "DOM document tree", mDoc);
|
||||
}
|
||||
#endif
|
||||
MOZ_ASSERT_UNREACHABLE("Broken accessible tree");
|
||||
mDoc->UnbindFromDocument(aNewChild);
|
||||
return false;
|
||||
}
|
||||
|
||||
return InsertChildAt(aRefChild ? aRefChild->IndexInParent() + 1 : 0,
|
||||
aNewChild);
|
||||
}
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include "nsTextEquivUtils.h"
|
||||
#include "DocAccessibleChild.h"
|
||||
#include "EventTree.h"
|
||||
#include "Logging.h"
|
||||
#include "Relation.h"
|
||||
#include "Role.h"
|
||||
#include "RootAccessible.h"
|
||||
|
|
|
@ -393,12 +393,12 @@ public:
|
|||
{ return InsertChildAt(mChildren.Length(), aChild); }
|
||||
virtual bool InsertChildAt(uint32_t aIndex, Accessible* aChild);
|
||||
|
||||
bool InsertAfter(Accessible* aNewChild, Accessible* aRefChild)
|
||||
{
|
||||
MOZ_ASSERT(aNewChild, "No new child to insert");
|
||||
return InsertChildAt(aRefChild ? aRefChild->IndexInParent() + 1 : 0,
|
||||
aNewChild);
|
||||
}
|
||||
/**
|
||||
* Inserts a child after given sibling. If the child cannot be inserted,
|
||||
* then the child is unbound from the document, and false is returned. Make
|
||||
* sure to null out any references on the child object as it may be destroyed.
|
||||
*/
|
||||
bool InsertAfter(Accessible* aNewChild, Accessible* aRefChild);
|
||||
|
||||
virtual bool RemoveChild(Accessible* aChild);
|
||||
|
||||
|
|
|
@ -1681,6 +1681,12 @@ public:
|
|||
*/
|
||||
bool Next();
|
||||
|
||||
void Rejected()
|
||||
{
|
||||
mChild = nullptr;
|
||||
mChildBefore = nullptr;
|
||||
}
|
||||
|
||||
private:
|
||||
Accessible* mChild;
|
||||
Accessible* mChildBefore;
|
||||
|
@ -1815,6 +1821,7 @@ DocAccessible::ProcessContentInserted(Accessible* aContainer,
|
|||
}
|
||||
|
||||
MOZ_ASSERT_UNREACHABLE("accessible was rejected");
|
||||
iter.Rejected();
|
||||
} while (iter.Next());
|
||||
|
||||
mt.Done();
|
||||
|
@ -1852,7 +1859,9 @@ DocAccessible::ProcessContentInserted(Accessible* aContainer, nsIContent* aNode)
|
|||
|
||||
if (child) {
|
||||
TreeMutation mt(aContainer);
|
||||
aContainer->InsertAfter(child, walker.Prev());
|
||||
if (!aContainer->InsertAfter(child, walker.Prev())) {
|
||||
return;
|
||||
}
|
||||
mt.AfterInsertion(child);
|
||||
mt.Done();
|
||||
|
||||
|
|
|
@ -98,10 +98,10 @@ xpcAccessibleSelectable::Intl()
|
|||
return static_cast<xpcAccessibleGeneric*>(this)->mIntl.AsAccessible();
|
||||
}
|
||||
|
||||
inline Accessible*
|
||||
inline AccessibleOrProxy
|
||||
xpcAccessibleValue::Intl()
|
||||
{
|
||||
return static_cast<xpcAccessibleGeneric*>(this)->mIntl.AsAccessible();
|
||||
return static_cast<xpcAccessibleGeneric*>(this)->mIntl;
|
||||
}
|
||||
|
||||
} // namespace a11y
|
||||
|
|
|
@ -16,10 +16,19 @@ xpcAccessibleValue::GetMaximumValue(double* aValue)
|
|||
NS_ENSURE_ARG_POINTER(aValue);
|
||||
*aValue = 0;
|
||||
|
||||
if (Intl()->IsDefunct())
|
||||
if (Intl().IsNull())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
double value = Intl()->MaxValue();
|
||||
if (Intl().IsAccessible() && Intl().AsAccessible()->IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
double value;
|
||||
if (Intl().IsAccessible()) {
|
||||
value = Intl().AsAccessible()->MaxValue();
|
||||
} else {
|
||||
value = Intl().AsProxy()->MaxValue();
|
||||
}
|
||||
|
||||
if (!IsNaN(value))
|
||||
*aValue = value;
|
||||
|
||||
|
@ -32,10 +41,19 @@ xpcAccessibleValue::GetMinimumValue(double* aValue)
|
|||
NS_ENSURE_ARG_POINTER(aValue);
|
||||
*aValue = 0;
|
||||
|
||||
if (Intl()->IsDefunct())
|
||||
if (Intl().IsNull())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
double value = Intl()->MinValue();
|
||||
if (Intl().IsAccessible() && Intl().AsAccessible()->IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
double value;
|
||||
if (Intl().IsAccessible()) {
|
||||
value = Intl().AsAccessible()->MinValue();
|
||||
} else {
|
||||
value = Intl().AsProxy()->MinValue();
|
||||
}
|
||||
|
||||
if (!IsNaN(value))
|
||||
*aValue = value;
|
||||
|
||||
|
@ -48,10 +66,19 @@ xpcAccessibleValue::GetCurrentValue(double* aValue)
|
|||
NS_ENSURE_ARG_POINTER(aValue);
|
||||
*aValue = 0;
|
||||
|
||||
if (Intl()->IsDefunct())
|
||||
if (Intl().IsNull())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
double value = Intl()->CurValue();
|
||||
if (Intl().IsAccessible() && Intl().AsAccessible()->IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
double value;
|
||||
if (Intl().IsAccessible()) {
|
||||
value = Intl().AsAccessible()->CurValue();
|
||||
} else {
|
||||
value = Intl().AsProxy()->MinValue();
|
||||
}
|
||||
|
||||
if (!IsNaN(value))
|
||||
*aValue = value;
|
||||
|
||||
|
@ -61,10 +88,18 @@ xpcAccessibleValue::GetCurrentValue(double* aValue)
|
|||
NS_IMETHODIMP
|
||||
xpcAccessibleValue::SetCurrentValue(double aValue)
|
||||
{
|
||||
if (Intl()->IsDefunct())
|
||||
if (Intl().IsNull())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
Intl()->SetCurValue(aValue);
|
||||
if (Intl().IsAccessible() && Intl().AsAccessible()->IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (Intl().IsAccessible()) {
|
||||
Intl().AsAccessible()->SetCurValue(aValue);
|
||||
} else {
|
||||
Intl().AsProxy()->SetCurValue(aValue);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -74,10 +109,19 @@ xpcAccessibleValue::GetMinimumIncrement(double* aValue)
|
|||
NS_ENSURE_ARG_POINTER(aValue);
|
||||
*aValue = 0;
|
||||
|
||||
if (Intl()->IsDefunct())
|
||||
if (Intl().IsNull())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
double value = Intl()->Step();
|
||||
if (Intl().IsAccessible() && Intl().AsAccessible()->IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
double value = Intl().AsAccessible()->Step();
|
||||
if (Intl().IsAccessible()) {
|
||||
value = Intl().AsAccessible()->Step();
|
||||
} else {
|
||||
value = Intl().AsProxy()->Step();
|
||||
}
|
||||
|
||||
if (!IsNaN(value))
|
||||
*aValue = value;
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ protected:
|
|||
virtual ~xpcAccessibleValue() {}
|
||||
|
||||
private:
|
||||
Accessible* Intl();
|
||||
AccessibleOrProxy Intl();
|
||||
|
||||
xpcAccessibleValue(const xpcAccessibleValue&) = delete;
|
||||
xpcAccessibleValue& operator =(const xpcAccessibleValue&) = delete;
|
||||
|
@ -40,5 +40,4 @@ private:
|
|||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
||||
|
|
|
@ -136,7 +136,7 @@ ident:
|
|||
merge-%:
|
||||
ifdef LOCALE_MERGEDIR
|
||||
$(RM) -rf $(LOCALE_MERGEDIR)
|
||||
MACOSX_DEPLOYMENT_TARGET= compare-locales -m $(LOCALE_MERGEDIR) $(srcdir)/l10n.ini $(L10NBASEDIR) $*
|
||||
$(topsrcdir)/mach compare-locales --merge-dir $(LOCALE_MERGEDIR) $*
|
||||
endif
|
||||
@echo
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
accesskey="&emailPageCmd.accesskey;"
|
||||
command="Browser:SendLink"/>
|
||||
<menuseparator/>
|
||||
#if !defined(MOZ_WIDGET_GTK) && !defined(MOZ_WIDGET_QT)
|
||||
#if !defined(MOZ_WIDGET_GTK)
|
||||
<menuitem id="menu_printSetup"
|
||||
label="&printSetupCmd.label;"
|
||||
accesskey="&printSetupCmd.accesskey;"
|
||||
|
|
|
@ -273,7 +273,7 @@ toolbar[customizing] > .overflow-button {
|
|||
}
|
||||
%endif
|
||||
|
||||
%if !defined(MOZ_WIDGET_GTK) && !defined(MOZ_WIDGET_QT)
|
||||
%if !defined(MOZ_WIDGET_GTK)
|
||||
#TabsToolbar > .private-browsing-indicator {
|
||||
-moz-box-ordinal-group: 1000;
|
||||
}
|
||||
|
|
|
@ -225,16 +225,14 @@
|
|||
orient="vertical"
|
||||
role="alert">
|
||||
<vbox>
|
||||
<hbox pack="end">
|
||||
<toolbarbutton id="UITourTooltipClose" class="close-icon"
|
||||
tooltiptext="&uiTour.infoPanel.close;"/>
|
||||
</hbox>
|
||||
<hbox id="UITourTooltipBody">
|
||||
<vbox id="UITourTooltipIconContainer">
|
||||
<image id="UITourTooltipIcon"/>
|
||||
</vbox>
|
||||
<image id="UITourTooltipIcon"/>
|
||||
<vbox flex="1">
|
||||
<label id="UITourTooltipTitle" flex="1"/>
|
||||
<hbox id="UITourTooltipTitleContainer">
|
||||
<label id="UITourTooltipTitle" flex="1"/>
|
||||
<toolbarbutton id="UITourTooltipClose" class="close-icon"
|
||||
tooltiptext="&uiTour.infoPanel.close;"/>
|
||||
</hbox>
|
||||
<description id="UITourTooltipDescription" flex="1"/>
|
||||
</vbox>
|
||||
</hbox>
|
||||
|
@ -563,7 +561,7 @@
|
|||
#ifdef MENUBAR_CAN_AUTOHIDE
|
||||
toolbarname="&menubarCmd.label;"
|
||||
accesskey="&menubarCmd.accesskey;"
|
||||
#if defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_QT)
|
||||
#if defined(MOZ_WIDGET_GTK)
|
||||
autohide="true"
|
||||
#endif
|
||||
#endif
|
||||
|
@ -592,7 +590,7 @@
|
|||
context="toolbar-context-menu"
|
||||
collapsed="true">
|
||||
|
||||
#if defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_QT)
|
||||
#if defined(MOZ_WIDGET_GTK)
|
||||
<hbox id="private-browsing-indicator"
|
||||
skipintoolbarset="true"/>
|
||||
#endif
|
||||
|
@ -642,7 +640,7 @@
|
|||
</menupopup>
|
||||
</toolbarbutton>
|
||||
|
||||
#if !defined(MOZ_WIDGET_GTK) && !defined(MOZ_WIDGET_QT)
|
||||
#if !defined(MOZ_WIDGET_GTK)
|
||||
<hbox class="private-browsing-indicator" skipintoolbarset="true"/>
|
||||
#endif
|
||||
#ifdef CAN_DRAW_IN_TITLEBAR
|
||||
|
|
|
@ -371,7 +371,16 @@ var AboutReaderListener = {
|
|||
addEventListener("MozAfterPaint", this._pendingReadabilityCheck);
|
||||
},
|
||||
|
||||
onPaintWhenWaitedFor: function(forceNonArticle) {
|
||||
onPaintWhenWaitedFor: function(forceNonArticle, event) {
|
||||
// In non-e10s, we'll get called for paints other than ours, and so it's
|
||||
// possible that this page hasn't been laid out yet, in which case we
|
||||
// should wait until we get an event that does relate to our layout. We
|
||||
// determine whether any of our content got painted by checking if there
|
||||
// are any painted rects.
|
||||
if (!event.clientRects.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.cancelPotentialPendingReadabilityCheck();
|
||||
// Only send updates when there are articles; there's no point updating with
|
||||
// |false| all the time.
|
||||
|
|
|
@ -143,7 +143,6 @@
|
|||
<radio id="networkProxySOCKSVersion4" value="4" label="&socks4.label;" accesskey="&socks4.accesskey;" />
|
||||
<radio id="networkProxySOCKSVersion5" value="5" label="&socks5.label;" accesskey="&socks5.accesskey;" />
|
||||
</radiogroup>
|
||||
<checkbox id="networkProxySOCKSRemoteDNS" preference="network.proxy.socks_remote_dns" label="&socksRemoteDNS.label;" accesskey="&socksRemoteDNS.accesskey;" />
|
||||
</box>
|
||||
</row>
|
||||
<label value="&noproxy.label;" accesskey="&noproxy.accesskey;" control="networkProxyNone"/>
|
||||
|
@ -168,6 +167,7 @@
|
|||
accesskey="&autologinproxy.accesskey;"
|
||||
preference="signon.autologin.proxy"
|
||||
tooltiptext="&autologinproxy.tooltip;"/>
|
||||
<checkbox id="networkProxySOCKSRemoteDNS" preference="network.proxy.socks_remote_dns" label="&socksRemoteDNS.label2;" accesskey="&socksRemoteDNS.accesskey;" />
|
||||
<separator/>
|
||||
</prefpane>
|
||||
</prefwindow>
|
||||
|
|
|
@ -1557,7 +1557,6 @@ this.UITour = {
|
|||
let tooltipTitle = document.getElementById("UITourTooltipTitle");
|
||||
let tooltipDesc = document.getElementById("UITourTooltipDescription");
|
||||
let tooltipIcon = document.getElementById("UITourTooltipIcon");
|
||||
let tooltipIconContainer = document.getElementById("UITourTooltipIconContainer");
|
||||
let tooltipButtons = document.getElementById("UITourTooltipButtons");
|
||||
|
||||
if (tooltip.state == "showing" || tooltip.state == "open") {
|
||||
|
@ -1567,7 +1566,7 @@ this.UITour = {
|
|||
tooltipTitle.textContent = aTitle || "";
|
||||
tooltipDesc.textContent = aDescription || "";
|
||||
tooltipIcon.src = aIconURL || "";
|
||||
tooltipIconContainer.hidden = !aIconURL;
|
||||
tooltipIcon.hidden = !aIconURL;
|
||||
|
||||
while (tooltipButtons.firstChild)
|
||||
tooltipButtons.firstChild.remove();
|
||||
|
|
|
@ -16,9 +16,9 @@
|
|||
"unpack": true
|
||||
},
|
||||
{
|
||||
"version": "gecko rust 1.9.0 (commit e4e8b666850a763fdf1c3c2c142856ab51e32779)",
|
||||
"size": 96854912,
|
||||
"digest": "d613d5528e83bb73917372948c05a766912a9dd0ec4e8a5fab69161a515c1545d52e9ed3394716df96a9dcdf1c086b6f970413e97c2df78a11e5f9151573921a",
|
||||
"version": "gecko rustc 1.10.0 (cfcb716cf 2016-07-03)",
|
||||
"size": 102276708,
|
||||
"digest": "8cc9ea8347fc7e6e6fdb15a8fd1faae977f1235a426b879b3f9128ec91d8f2b6268297ce80bf4eceb47738bd40bfeda13f143dc3fe85f1434b13adfbc095ab90",
|
||||
"algorithm": "sha512",
|
||||
"filename": "rustc.tar.xz",
|
||||
"unpack": true
|
||||
|
|
|
@ -16,9 +16,9 @@
|
|||
"unpack": true
|
||||
},
|
||||
{
|
||||
"version": "gecko rust 1.9.0 (commit e4e8b666850a763fdf1c3c2c142856ab51e32779)",
|
||||
"size": 96854912,
|
||||
"digest": "d613d5528e83bb73917372948c05a766912a9dd0ec4e8a5fab69161a515c1545d52e9ed3394716df96a9dcdf1c086b6f970413e97c2df78a11e5f9151573921a",
|
||||
"version": "gecko rustc 1.10.0 (cfcb716cf 2016-07-03)",
|
||||
"size": 102276708,
|
||||
"digest": "8cc9ea8347fc7e6e6fdb15a8fd1faae977f1235a426b879b3f9128ec91d8f2b6268297ce80bf4eceb47738bd40bfeda13f143dc3fe85f1434b13adfbc095ab90",
|
||||
"algorithm": "sha512",
|
||||
"filename": "rustc.tar.xz",
|
||||
"unpack": true
|
||||
|
|
|
@ -188,7 +188,7 @@ ident:
|
|||
merge-%:
|
||||
ifdef LOCALE_MERGEDIR
|
||||
$(RM) -rf $(LOCALE_MERGEDIR)
|
||||
MACOSX_DEPLOYMENT_TARGET= compare-locales -m $(LOCALE_MERGEDIR) $(srcdir)/l10n.ini $(L10NBASEDIR) $*
|
||||
$(topsrcdir)/mach compare-locales --merge-dir $(LOCALE_MERGEDIR) $*
|
||||
endif
|
||||
@echo
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
<!ENTITY socks4.accesskey "K">
|
||||
<!ENTITY socks5.label "SOCKS v5">
|
||||
<!ENTITY socks5.accesskey "v">
|
||||
<!ENTITY socksRemoteDNS.label "Remote DNS">
|
||||
<!ENTITY socksRemoteDNS.label2 "Proxy DNS when using SOCKS v5">
|
||||
<!ENTITY socksRemoteDNS.accesskey "d">
|
||||
<!ENTITY port.label "Port:">
|
||||
<!ENTITY HTTPport.accesskey "P">
|
||||
|
|
|
@ -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/.
|
||||
|
||||
import sys
|
||||
import re
|
||||
import codecs
|
||||
try:
|
||||
from Mozilla.Parser import getParser
|
||||
except ImportError:
|
||||
sys.exit('''extract-bookmarks needs compare-locales
|
||||
|
||||
Find that on http://pypi.python.org/pypi/compare-locales.
|
||||
This script has been tested with version 0.6, and might work with future
|
||||
versions.''')
|
||||
|
||||
ll=re.compile('\.(title|a|dd|h[0-9])$')
|
||||
|
||||
p = getParser(sys.argv[1])
|
||||
p.readFile(sys.argv[1])
|
||||
|
||||
template = '''#filter emptyLines
|
||||
|
||||
# LOCALIZATION NOTE: The 'en-US' strings in the URLs will be replaced with
|
||||
# your locale code, and link to your translated pages as soon as they're
|
||||
# live.
|
||||
|
||||
#define bookmarks_title %s
|
||||
#define bookmarks_heading %s
|
||||
|
||||
#define bookmarks_toolbarfolder %s
|
||||
#define bookmarks_toolbarfolder_description %s
|
||||
|
||||
# LOCALIZATION NOTE (getting_started):
|
||||
# link title for https://www.mozilla.org/en-US/firefox/central/
|
||||
#define getting_started %s
|
||||
|
||||
# LOCALIZATION NOTE (firefox_heading):
|
||||
# Firefox links folder name
|
||||
#define firefox_heading %s
|
||||
|
||||
# LOCALIZATION NOTE (firefox_help):
|
||||
# link title for https://www.mozilla.org/en-US/firefox/help/
|
||||
#define firefox_help %s
|
||||
|
||||
# LOCALIZATION NOTE (firefox_customize):
|
||||
# link title for https://www.mozilla.org/en-US/firefox/customize/
|
||||
#define firefox_customize %s
|
||||
|
||||
# LOCALIZATION NOTE (firefox_community):
|
||||
# link title for https://www.mozilla.org/en-US/contribute/
|
||||
#define firefox_community %s
|
||||
|
||||
# LOCALIZATION NOTE (firefox_about):
|
||||
# link title for https://www.mozilla.org/en-US/about/
|
||||
#define firefox_about %s
|
||||
|
||||
#unfilter emptyLines'''
|
||||
|
||||
strings = tuple(e.val for e in p if ll.search(e.key))
|
||||
|
||||
print codecs.utf_8_encode(template % strings)[0]
|
|
@ -8,7 +8,7 @@ toolkit = CONFIG['MOZ_WIDGET_TOOLKIT']
|
|||
|
||||
if toolkit == 'cocoa':
|
||||
DIRS += ['osx']
|
||||
elif toolkit in ('gtk2', 'gtk3', 'qt'):
|
||||
elif toolkit in ('gtk2', 'gtk3'):
|
||||
DIRS += ['linux']
|
||||
else:
|
||||
DIRS += ['windows']
|
||||
|
|
|
@ -26,17 +26,18 @@
|
|||
}
|
||||
|
||||
#UITourTooltipBody {
|
||||
margin-inline-end: 14px;
|
||||
margin-inline-start: 14px;
|
||||
margin-top: -16px;
|
||||
margin-bottom: 8px;
|
||||
-moz-box-align: start;
|
||||
}
|
||||
|
||||
#UITourTooltipTitleContainer {
|
||||
-moz-box-align: start;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
#UITourTooltipIcon {
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
margin-inline-start: 14px;
|
||||
margin-inline-end: 14px;
|
||||
margin-inline-end: 10px;
|
||||
}
|
||||
|
||||
#UITourTooltipTitle,
|
||||
|
@ -47,11 +48,7 @@
|
|||
#UITourTooltipTitle {
|
||||
font-size: 1.45rem;
|
||||
font-weight: bold;
|
||||
margin-inline-start: 0;
|
||||
/* Avoid the title overlapping the close button */
|
||||
margin-inline-end: 14px;
|
||||
margin-top: 0;
|
||||
margin-bottom: 9px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#UITourTooltipDescription {
|
||||
|
@ -81,7 +78,7 @@
|
|||
background-color: hsla(210,4%,10%,.07);
|
||||
border-top: 1px solid hsla(210,4%,10%,.14);
|
||||
margin: 10px -16px -16px;
|
||||
padding: 2em 15px;
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
#UITourTooltipButtons > label,
|
||||
|
@ -94,6 +91,11 @@
|
|||
margin-inline-start: 0;
|
||||
}
|
||||
|
||||
#UITourTooltipButtons > label:last-child,
|
||||
#UITourTooltipButtons > button:last-child {
|
||||
margin-inline-end: 0;
|
||||
}
|
||||
|
||||
#UITourTooltipButtons > button[image] > .button-box > .button-icon {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
|
|
|
@ -91,7 +91,7 @@
|
|||
.geo-icon {
|
||||
%ifdef XP_MACOSX
|
||||
list-style-image: url(chrome://browser/skin/permissions.svg#geo-osx);
|
||||
%elif defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_QT)
|
||||
%elif defined(MOZ_WIDGET_GTK)
|
||||
list-style-image: url(chrome://browser/skin/permissions.svg#geo-linux);
|
||||
%else
|
||||
list-style-image: url(chrome://browser/skin/permissions.svg#geo-windows);
|
||||
|
@ -101,7 +101,7 @@
|
|||
.geo-icon.blocked {
|
||||
%ifdef XP_MACOSX
|
||||
list-style-image: url(chrome://browser/skin/permissions.svg#geo-osx-blocked);
|
||||
%elif defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_QT)
|
||||
%elif defined(MOZ_WIDGET_GTK)
|
||||
list-style-image: url(chrome://browser/skin/permissions.svg#geo-linux-blocked);
|
||||
%else
|
||||
list-style-image: url(chrome://browser/skin/permissions.svg#geo-windows-blocked);
|
||||
|
@ -111,7 +111,7 @@
|
|||
.popup-notification-icon[popupid="geolocation"] {
|
||||
%ifdef XP_MACOSX
|
||||
list-style-image: url(chrome://browser/skin/permissions.svg#geo-osx);
|
||||
%elif defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_QT)
|
||||
%elif defined(MOZ_WIDGET_GTK)
|
||||
list-style-image: url(chrome://browser/skin/permissions.svg#geo-linux-detailed);
|
||||
%else
|
||||
list-style-image: url(chrome://browser/skin/permissions.svg#geo-windows-detailed);
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
%filter substitution
|
||||
%ifdef XP_MACOSX
|
||||
%include ../osx/shared.inc
|
||||
%elif defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_QT)
|
||||
%elif defined(MOZ_WIDGET_GTK)
|
||||
%include ../linux/linuxShared.inc
|
||||
%else
|
||||
%include ../windows/windowsShared.inc
|
||||
|
|
До Ширина: | Высота: | Размер: 1.3 KiB После Ширина: | Высота: | Размер: 1.3 KiB |
|
@ -7,6 +7,8 @@
|
|||
# Avoid duplication if the file happens to be included twice.
|
||||
if test -z "$bucket" -a -z "$NO_CACHE"; then
|
||||
|
||||
# buildbot (or builders that use buildprops.json):
|
||||
if [ -f $topsrcdir/../buildprops.json ]; then
|
||||
read branch platform master <<EOF
|
||||
$(python2.7 -c 'import json; p = json.loads(open("'"$topsrcdir"'/../buildprops.json").read())["properties"]; print p["branch"], p["platform"], p["master"]' 2> /dev/null)
|
||||
EOF
|
||||
|
@ -40,6 +42,53 @@ if test -z "$SCCACHE_DISABLE" -a -z "$no_sccache" -a -z "$MOZ_PGO_IS_SET" -a -z
|
|||
esac
|
||||
fi
|
||||
|
||||
# builds without buildprops (eg: taskcluster or non-buildbot) and without ccache env config and without sccache disabled:
|
||||
elif test -z "$CCACHE_DIR" -a -z "$SCCACHE_DISABLE" -a -z "$no_sccache" -a -z "$MOZ_PGO_IS_SET" -a -z "$MOZ_PGO"; then
|
||||
|
||||
# prevent rerun if az is set, or wget is not available
|
||||
if test -z "$availability_zone" -a -x "$(command -v wget)"; then
|
||||
# timeout after 1 second, and don't retry (failure indicates instance is not in ec2 or network issue)
|
||||
# availability_zone is of the form <region><letter> where region is e.g. us-west-2, and az is us-west-2a
|
||||
availability_zone=$(wget -T 1 -t 1 -q -O - http://169.254.169.254/latest/meta-data/placement/availability-zone || true)
|
||||
if test -z "$availability_zone" -o "$availability_zone" = "not-ec2"; then
|
||||
availability_zone=not-ec2
|
||||
else
|
||||
# region is az with last letter trimmed
|
||||
region=${availability_zone%?}
|
||||
# set S3 bucket according to tree (level)
|
||||
case "${GECKO_HEAD_REPOSITORY}" in
|
||||
*hg.mozilla.org/try*)
|
||||
bucket=taskcluster-level-1-sccache-${region}
|
||||
;;
|
||||
*hg.mozilla.org/integration/mozilla-inbound*|*hg.mozilla.org/integration/fx-team*)
|
||||
bucket=taskcluster-level-3-sccache-${region}
|
||||
;;
|
||||
esac
|
||||
|
||||
# set a dummy master
|
||||
case "${region}" in
|
||||
us-east-1)
|
||||
master=dummy.use1.mozilla.com
|
||||
;;
|
||||
us-west-1)
|
||||
master=dummy.usw1.mozilla.com
|
||||
;;
|
||||
us-west-2)
|
||||
master=dummy.usw2.mozilla.com
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# set platform based on the SYSTEMROOT env var
|
||||
case "${SYSTEMROOT}" in
|
||||
*Windows)
|
||||
platform=windows
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if test -z "$bucket"; then
|
||||
case "$platform" in
|
||||
win*) : ;;
|
||||
|
@ -53,7 +102,7 @@ else
|
|||
fi
|
||||
mk_add_options "export SCCACHE_BUCKET=$bucket"
|
||||
case "$master" in
|
||||
*use1.mozilla.com*|*usw2.mozilla.com*)
|
||||
*us[ew][12].mozilla.com*)
|
||||
mk_add_options "export SCCACHE_NAMESERVER=169.254.169.253"
|
||||
;;
|
||||
esac
|
||||
|
|
Двоичные данные
devtools/client/debugger/test/mochitest/addon3.xpi
Двоичные данные
devtools/client/debugger/test/mochitest/addon3.xpi
Двоичный файл не отображается.
|
@ -429,8 +429,6 @@ var testcases = [ {
|
|||
protocolChange: true,
|
||||
}, {
|
||||
input: "?'.com",
|
||||
fixedURI: "http:///?%27.com",
|
||||
alternateURI: "http://www..com/?%27.com",
|
||||
keywordLookup: true,
|
||||
protocolChange: true,
|
||||
}, {
|
||||
|
@ -439,14 +437,10 @@ var testcases = [ {
|
|||
protocolChange: true
|
||||
}, {
|
||||
input: "?mozilla",
|
||||
fixedURI: "http:///?mozilla",
|
||||
alternateURI: "http://www..com/?mozilla",
|
||||
keywordLookup: true,
|
||||
protocolChange: true,
|
||||
}, {
|
||||
input: "??mozilla",
|
||||
fixedURI: "http:///??mozilla",
|
||||
alternateURI: "http://www..com/??mozilla",
|
||||
keywordLookup: true,
|
||||
protocolChange: true,
|
||||
}, {
|
||||
|
|
|
@ -521,10 +521,7 @@ KeyframeUtils::ApplySpacing(nsTArray<Keyframe>& aKeyframes,
|
|||
|
||||
// Fill computed offsets in (keyframe A, keyframe B).
|
||||
if (aSpacingMode == SpacingMode::distribute) {
|
||||
// Bug 1276573: Use the new constructor accepting two RangedPtr<T>
|
||||
// arguments, so we can make the code simpler.
|
||||
DistributeRange(Range<Keyframe>(keyframeA.get(),
|
||||
keyframeB - keyframeA + 1));
|
||||
DistributeRange(Range<Keyframe>(keyframeA, keyframeB + 1));
|
||||
} else {
|
||||
// a) Find Paced A (first paceable keyframe) and
|
||||
// Paced B (last paceable keyframe) in [keyframe A, keyframe B].
|
||||
|
@ -546,18 +543,14 @@ KeyframeUtils::ApplySpacing(nsTArray<Keyframe>& aKeyframes,
|
|||
}
|
||||
// b) Apply distributing offsets in (keyframe A, Paced A] and
|
||||
// [Paced B, keyframe B).
|
||||
DistributeRange(Range<Keyframe>(keyframeA.get(),
|
||||
keyframeB - keyframeA + 1),
|
||||
Range<Keyframe>((keyframeA + 1).get(),
|
||||
pacedA - keyframeA));
|
||||
DistributeRange(Range<Keyframe>(keyframeA.get(),
|
||||
keyframeB - keyframeA + 1),
|
||||
Range<Keyframe>(pacedB.get(),
|
||||
keyframeB - pacedB));
|
||||
DistributeRange(Range<Keyframe>(keyframeA, keyframeB + 1),
|
||||
Range<Keyframe>(keyframeA + 1, pacedA + 1));
|
||||
DistributeRange(Range<Keyframe>(keyframeA, keyframeB + 1),
|
||||
Range<Keyframe>(pacedB, keyframeB));
|
||||
// c) Apply paced offsets to each paceable keyframe in (Paced A, Paced B).
|
||||
// We pass the range [Paced A, Paced B] since PaceRange needs the end
|
||||
// points of the range in order to calculate the correct offset.
|
||||
PaceRange(Range<Keyframe>(pacedA.get(), pacedB - pacedA + 1),
|
||||
PaceRange(Range<Keyframe>(pacedA, pacedB + 1),
|
||||
Range<double>(&cumulativeDistances[pacedA - begin],
|
||||
pacedB - pacedA + 1));
|
||||
// d) Fill in any computed offsets in (Paced A, Paced B) that are still
|
||||
|
@ -574,7 +567,7 @@ KeyframeUtils::ApplySpacing(nsTArray<Keyframe>& aKeyframes,
|
|||
end->mComputedOffset == Keyframe::kComputedOffsetNotSet) {
|
||||
++end;
|
||||
}
|
||||
DistributeRange(Range<Keyframe>(start.get(), end - start + 1));
|
||||
DistributeRange(Range<Keyframe>(start, end + 1));
|
||||
frame = end;
|
||||
}
|
||||
}
|
||||
|
@ -1487,9 +1480,8 @@ DistributeRange(const Range<Keyframe>& aSpacingRange)
|
|||
{
|
||||
// We don't need to apply distribute spacing to keyframe A and keyframe B.
|
||||
DistributeRange(aSpacingRange,
|
||||
Range<Keyframe>((aSpacingRange.start() + 1).get(),
|
||||
aSpacingRange.end() - aSpacingRange.start()
|
||||
- 2));
|
||||
Range<Keyframe>(aSpacingRange.start() + 1,
|
||||
aSpacingRange.end() - 1));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -776,7 +776,11 @@ BlobImplBase::GetSendInfo(nsIInputStream** aBody, uint64_t* aContentLength,
|
|||
nsAutoString contentType;
|
||||
GetType(contentType);
|
||||
|
||||
CopyUTF16toUTF8(contentType, aContentType);
|
||||
if (contentType.IsEmpty()) {
|
||||
aContentType.SetIsVoid(true);
|
||||
} else {
|
||||
CopyUTF16toUTF8(contentType, aContentType);
|
||||
}
|
||||
|
||||
aCharset.Truncate();
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "mozilla/dom/StructuredCloneTags.h"
|
||||
#include "mozilla/dom/SubtleCryptoBinding.h"
|
||||
#include "mozilla/dom/ToJSValue.h"
|
||||
#include "mozilla/dom/URLSearchParams.h"
|
||||
#include "mozilla/dom/WebCryptoCommon.h"
|
||||
#include "mozilla/gfx/2D.h"
|
||||
#include "mozilla/ipc/BackgroundChild.h"
|
||||
|
@ -395,7 +396,7 @@ StructuredCloneHolder::ReadFullySerializableObjects(JSContext* aCx,
|
|||
return ReadStructuredCloneImageData(aCx, aReader);
|
||||
}
|
||||
|
||||
if (aTag == SCTAG_DOM_WEBCRYPTO_KEY) {
|
||||
if (aTag == SCTAG_DOM_WEBCRYPTO_KEY || aTag == SCTAG_DOM_URLSEARCHPARAMS) {
|
||||
nsIGlobalObject *global = xpc::NativeGlobal(JS::CurrentGlobalOrNull(aCx));
|
||||
if (!global) {
|
||||
return nullptr;
|
||||
|
@ -404,11 +405,20 @@ StructuredCloneHolder::ReadFullySerializableObjects(JSContext* aCx,
|
|||
// Prevent the return value from being trashed by a GC during ~nsRefPtr.
|
||||
JS::Rooted<JSObject*> result(aCx);
|
||||
{
|
||||
RefPtr<CryptoKey> key = new CryptoKey(global);
|
||||
if (!key->ReadStructuredClone(aReader)) {
|
||||
result = nullptr;
|
||||
} else {
|
||||
result = key->WrapObject(aCx, nullptr);
|
||||
if (aTag == SCTAG_DOM_WEBCRYPTO_KEY) {
|
||||
RefPtr<CryptoKey> key = new CryptoKey(global);
|
||||
if (!key->ReadStructuredClone(aReader)) {
|
||||
result = nullptr;
|
||||
} else {
|
||||
result = key->WrapObject(aCx, nullptr);
|
||||
}
|
||||
} else if (aTag == SCTAG_DOM_URLSEARCHPARAMS) {
|
||||
RefPtr<URLSearchParams> usp = new URLSearchParams(global);
|
||||
if (!usp->ReadStructuredClone(aReader)) {
|
||||
result = nullptr;
|
||||
} else {
|
||||
result = usp->WrapObject(aCx, nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
@ -504,6 +514,15 @@ StructuredCloneHolder::WriteFullySerializableObjects(JSContext* aCx,
|
|||
}
|
||||
}
|
||||
|
||||
// Handle URLSearchParams cloning
|
||||
{
|
||||
URLSearchParams* usp = nullptr;
|
||||
if (NS_SUCCEEDED(UNWRAP_OBJECT(URLSearchParams, aObj, usp))) {
|
||||
return JS_WriteUint32Pair(aWriter, SCTAG_DOM_URLSEARCHPARAMS, 0) &&
|
||||
usp->WriteStructuredClone(aWriter);
|
||||
}
|
||||
}
|
||||
|
||||
// Handle Key cloning
|
||||
{
|
||||
CryptoKey* key = nullptr;
|
||||
|
|
|
@ -54,6 +54,9 @@ enum StructuredCloneTags {
|
|||
|
||||
SCTAG_DOM_DIRECTORY,
|
||||
|
||||
// This tag is used by both main thread and workers.
|
||||
SCTAG_DOM_URLSEARCHPARAMS,
|
||||
|
||||
SCTAG_DOM_MAX
|
||||
};
|
||||
|
||||
|
|
|
@ -223,7 +223,6 @@
|
|||
#include "nsDOMCaretPosition.h"
|
||||
#include "nsIDOMHTMLTextAreaElement.h"
|
||||
#include "nsViewportInfo.h"
|
||||
#include "nsIContentPermissionPrompt.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
#include "nsITextControlElement.h"
|
||||
#include "nsIDOMNSEditableElement.h"
|
||||
|
@ -241,7 +240,6 @@
|
|||
#include "nsIDocumentActivity.h"
|
||||
#include "nsIStructuredCloneContainer.h"
|
||||
#include "nsIMutableArray.h"
|
||||
#include "nsContentPermissionHelper.h"
|
||||
#include "mozilla/dom/DOMStringList.h"
|
||||
#include "nsWindowMemoryReporter.h"
|
||||
#include "nsLocation.h"
|
||||
|
@ -11878,27 +11876,11 @@ FullscreenRequest::FullscreenRequest(Element* aElement)
|
|||
, mDocument(static_cast<nsDocument*>(aElement->OwnerDoc()))
|
||||
{
|
||||
MOZ_COUNT_CTOR(FullscreenRequest);
|
||||
mDocument->mPendingFullscreenRequests++;
|
||||
if (MOZ_UNLIKELY(!mDocument->mPendingFullscreenRequests)) {
|
||||
NS_WARNING("Pending fullscreen request counter overflow");
|
||||
}
|
||||
}
|
||||
|
||||
static void RedispatchPendingPointerLockRequest(nsIDocument* aDocument);
|
||||
|
||||
FullscreenRequest::~FullscreenRequest()
|
||||
{
|
||||
MOZ_COUNT_DTOR(FullscreenRequest);
|
||||
if (MOZ_UNLIKELY(!mDocument->mPendingFullscreenRequests)) {
|
||||
NS_WARNING("Pending fullscreen request counter underflow");
|
||||
return;
|
||||
}
|
||||
mDocument->mPendingFullscreenRequests--;
|
||||
if (!mDocument->mPendingFullscreenRequests) {
|
||||
// There may be pointer lock request be blocked because of pending
|
||||
// fullscreen requests. Re-dispatch it to ensure it gets handled.
|
||||
RedispatchPendingPointerLockRequest(mDocument);
|
||||
}
|
||||
}
|
||||
|
||||
// Any fullscreen request waiting for the widget to finish being full-
|
||||
|
@ -12301,7 +12283,7 @@ DispatchPointerLockChange(nsIDocument* aTarget)
|
|||
}
|
||||
|
||||
static void
|
||||
DispatchPointerLockError(nsIDocument* aTarget)
|
||||
DispatchPointerLockError(nsIDocument* aTarget, const char* aMessage)
|
||||
{
|
||||
if (!aTarget) {
|
||||
return;
|
||||
|
@ -12313,178 +12295,117 @@ DispatchPointerLockError(nsIDocument* aTarget)
|
|||
true,
|
||||
false);
|
||||
asyncDispatcher->PostDOMEvent();
|
||||
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
|
||||
NS_LITERAL_CSTRING("DOM"), aTarget,
|
||||
nsContentUtils::eDOM_PROPERTIES,
|
||||
aMessage);
|
||||
}
|
||||
|
||||
static const uint8_t kPointerLockRequestLimit = 2;
|
||||
|
||||
class nsPointerLockPermissionRequest;
|
||||
mozilla::StaticRefPtr<nsPointerLockPermissionRequest> gPendingPointerLockRequest;
|
||||
|
||||
class nsPointerLockPermissionRequest : public Runnable,
|
||||
public nsIContentPermissionRequest
|
||||
class PointerLockRequest final : public Runnable
|
||||
{
|
||||
public:
|
||||
nsPointerLockPermissionRequest(Element* aElement, bool aUserInputOrChromeCaller)
|
||||
: mElement(do_GetWeakReference(aElement)),
|
||||
mDocument(do_GetWeakReference(aElement->OwnerDoc())),
|
||||
mUserInputOrChromeCaller(aUserInputOrChromeCaller)
|
||||
{
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryReferent(mDocument);
|
||||
if (doc && doc->GetInnerWindow()) {
|
||||
mRequester = new nsContentPermissionRequester(doc->GetInnerWindow());
|
||||
}
|
||||
}
|
||||
PointerLockRequest(Element* aElement, bool aUserInputOrChromeCaller)
|
||||
: mElement(do_GetWeakReference(aElement))
|
||||
, mDocument(do_GetWeakReference(aElement->OwnerDoc()))
|
||||
, mUserInputOrChromeCaller(aUserInputOrChromeCaller)
|
||||
{}
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSICONTENTPERMISSIONREQUEST
|
||||
|
||||
NS_IMETHOD Run() override
|
||||
{
|
||||
nsCOMPtr<Element> e = do_QueryReferent(mElement);
|
||||
nsCOMPtr<nsIDocument> d = do_QueryReferent(mDocument);
|
||||
if (!e || !d || gPendingPointerLockRequest != this ||
|
||||
e->GetUncomposedDoc() != d) {
|
||||
Handled();
|
||||
DispatchPointerLockError(d);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsDocument* doc = static_cast<nsDocument*>(d.get());
|
||||
if (doc->mPendingFullscreenRequests > 0) {
|
||||
// We're still entering fullscreen.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (doc->GetFullscreenElement() || doc->mAllowRelocking) {
|
||||
Allow(JS::UndefinedHandleValue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// In non-fullscreen mode user input (or chrome caller) is required!
|
||||
// Also, don't let the page to try to get the permission too many times.
|
||||
if (!mUserInputOrChromeCaller ||
|
||||
doc->mCancelledPointerLockRequests > kPointerLockRequestLimit) {
|
||||
Handled();
|
||||
DispatchPointerLockError(d);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
Allow(JS::UndefinedHandleValue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void Handled()
|
||||
{
|
||||
mElement = nullptr;
|
||||
mDocument = nullptr;
|
||||
if (gPendingPointerLockRequest == this) {
|
||||
gPendingPointerLockRequest = nullptr;
|
||||
}
|
||||
}
|
||||
NS_IMETHOD Run() final;
|
||||
|
||||
private:
|
||||
nsWeakPtr mElement;
|
||||
nsWeakPtr mDocument;
|
||||
bool mUserInputOrChromeCaller;
|
||||
|
||||
protected:
|
||||
virtual ~nsPointerLockPermissionRequest() {}
|
||||
nsCOMPtr<nsIContentPermissionRequester> mRequester;
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED(nsPointerLockPermissionRequest,
|
||||
Runnable,
|
||||
nsIContentPermissionRequest)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPointerLockPermissionRequest::GetTypes(nsIArray** aTypes)
|
||||
static const char*
|
||||
GetPointerLockError(Element* aElement, Element* aCurrentLock,
|
||||
bool aNoFocusCheck = false)
|
||||
{
|
||||
nsTArray<nsString> emptyOptions;
|
||||
return nsContentPermissionUtils::CreatePermissionArray(NS_LITERAL_CSTRING("pointerLock"),
|
||||
NS_LITERAL_CSTRING("unused"),
|
||||
emptyOptions,
|
||||
aTypes);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPointerLockPermissionRequest::GetPrincipal(nsIPrincipal** aPrincipal)
|
||||
{
|
||||
nsCOMPtr<nsIDocument> d = do_QueryReferent(mDocument);
|
||||
if (d) {
|
||||
NS_ADDREF(*aPrincipal = d->NodePrincipal());
|
||||
// Check if pointer lock pref is enabled
|
||||
if (!Preferences::GetBool("full-screen-api.pointer-lock.enabled")) {
|
||||
return "PointerLockDeniedDisabled";
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPointerLockPermissionRequest::GetWindow(mozIDOMWindow** aWindow)
|
||||
{
|
||||
nsCOMPtr<nsIDocument> d = do_QueryReferent(mDocument);
|
||||
if (d) {
|
||||
NS_IF_ADDREF(*aWindow = d->GetInnerWindow());
|
||||
nsCOMPtr<nsIDocument> ownerDoc = aElement->OwnerDoc();
|
||||
if (aCurrentLock && aCurrentLock->OwnerDoc() != ownerDoc) {
|
||||
return "PointerLockDeniedInUse";
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPointerLockPermissionRequest::GetElement(nsIDOMElement** aElement)
|
||||
{
|
||||
// It is enough to implement GetWindow.
|
||||
*aElement = nullptr;
|
||||
return NS_OK;
|
||||
}
|
||||
if (!aElement->IsInUncomposedDoc()) {
|
||||
return "PointerLockDeniedNotInDocument";
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPointerLockPermissionRequest::Cancel()
|
||||
{
|
||||
nsCOMPtr<nsIDocument> d = do_QueryReferent(mDocument);
|
||||
Handled();
|
||||
if (d) {
|
||||
auto doc = static_cast<nsDocument*>(d.get());
|
||||
if (doc->mCancelledPointerLockRequests <= kPointerLockRequestLimit) {
|
||||
doc->mCancelledPointerLockRequests++;
|
||||
if (ownerDoc->GetSandboxFlags() & SANDBOXED_POINTER_LOCK) {
|
||||
return "PointerLockDeniedSandboxed";
|
||||
}
|
||||
|
||||
// Check if the element is in a document with a docshell.
|
||||
if (!ownerDoc->GetContainer()) {
|
||||
return "PointerLockDeniedHidden";
|
||||
}
|
||||
nsCOMPtr<nsPIDOMWindowOuter> ownerWindow = ownerDoc->GetWindow();
|
||||
if (!ownerWindow) {
|
||||
return "PointerLockDeniedHidden";
|
||||
}
|
||||
nsCOMPtr<nsPIDOMWindowInner> ownerInnerWindow = ownerDoc->GetInnerWindow();
|
||||
if (!ownerInnerWindow) {
|
||||
return "PointerLockDeniedHidden";
|
||||
}
|
||||
if (ownerWindow->GetCurrentInnerWindow() != ownerInnerWindow) {
|
||||
return "PointerLockDeniedHidden";
|
||||
}
|
||||
|
||||
nsCOMPtr<nsPIDOMWindowOuter> top = ownerWindow->GetScriptableTop();
|
||||
if (!top || !top->GetExtantDoc() || top->GetExtantDoc()->Hidden()) {
|
||||
return "PointerLockDeniedHidden";
|
||||
}
|
||||
|
||||
if (!aNoFocusCheck) {
|
||||
mozilla::ErrorResult rv;
|
||||
if (!top->GetExtantDoc()->HasFocus(rv)) {
|
||||
return "PointerLockDeniedNotFocused";
|
||||
}
|
||||
DispatchPointerLockError(d);
|
||||
}
|
||||
return NS_OK;
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPointerLockPermissionRequest::Allow(JS::HandleValue aChoices)
|
||||
PointerLockRequest::Run()
|
||||
{
|
||||
MOZ_ASSERT(aChoices.isUndefined());
|
||||
|
||||
nsCOMPtr<Element> e = do_QueryReferent(mElement);
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryReferent(mDocument);
|
||||
nsDocument* d = static_cast<nsDocument*>(doc.get());
|
||||
if (!e || !d || gPendingPointerLockRequest != this ||
|
||||
e->GetUncomposedDoc() != d) {
|
||||
Handled();
|
||||
DispatchPointerLockError(d);
|
||||
const char* error = nullptr;
|
||||
if (!e || !d || !e->GetUncomposedDoc()) {
|
||||
error = "PointerLockDeniedNotInDocument";
|
||||
} else if (e->GetUncomposedDoc() != d) {
|
||||
error = "PointerLockDeniedMovedDocument";
|
||||
}
|
||||
if (!error) {
|
||||
nsCOMPtr<Element> pointerLockedElement =
|
||||
do_QueryReferent(EventStateManager::sPointerLockedElement);
|
||||
if (e == pointerLockedElement) {
|
||||
DispatchPointerLockChange(d);
|
||||
return NS_OK;
|
||||
}
|
||||
// Note, we must bypass focus change, so pass true as the last parameter!
|
||||
error = GetPointerLockError(e, pointerLockedElement, true);
|
||||
}
|
||||
// If it is neither user input initiated, nor requested in fullscreen,
|
||||
// it should be rejected.
|
||||
if (!error && !mUserInputOrChromeCaller && !doc->GetFullscreenElement()) {
|
||||
error = "PointerLockDeniedNotInputDriven";
|
||||
}
|
||||
if (!error && !d->SetPointerLock(e, NS_STYLE_CURSOR_NONE)) {
|
||||
error = "PointerLockDeniedFailedToLock";
|
||||
}
|
||||
if (error) {
|
||||
DispatchPointerLockError(d, error);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Mark handled here so that we don't need to call it everywhere below.
|
||||
Handled();
|
||||
|
||||
nsCOMPtr<Element> pointerLockedElement =
|
||||
do_QueryReferent(EventStateManager::sPointerLockedElement);
|
||||
if (e == pointerLockedElement) {
|
||||
DispatchPointerLockChange(d);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Note, we must bypass focus change, so pass true as the last parameter!
|
||||
if (!d->ShouldLockPointer(e, pointerLockedElement, true)) {
|
||||
DispatchPointerLockError(d);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (!d->SetPointerLock(e, NS_STYLE_CURSOR_NONE)) {
|
||||
DispatchPointerLockError(d);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
d->mCancelledPointerLockRequests = 0;
|
||||
e->SetPointerLock();
|
||||
EventStateManager::sPointerLockedElement = do_GetWeakReference(e);
|
||||
EventStateManager::sPointerLockedDoc = do_GetWeakReference(doc);
|
||||
|
@ -12500,43 +12421,148 @@ nsPointerLockPermissionRequest::Allow(JS::HandleValue aChoices)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPointerLockPermissionRequest::GetRequester(nsIContentPermissionRequester** aRequester)
|
||||
void
|
||||
nsDocument::RequestPointerLock(Element* aElement)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aRequester);
|
||||
NS_ASSERTION(aElement,
|
||||
"Must pass non-null element to nsDocument::RequestPointerLock");
|
||||
|
||||
nsCOMPtr<nsIContentPermissionRequester> requester = mRequester;
|
||||
requester.forget(aRequester);
|
||||
nsCOMPtr<Element> pointerLockedElement =
|
||||
do_QueryReferent(EventStateManager::sPointerLockedElement);
|
||||
if (aElement == pointerLockedElement) {
|
||||
DispatchPointerLockChange(this);
|
||||
return;
|
||||
}
|
||||
|
||||
if (const char* msg = GetPointerLockError(aElement, pointerLockedElement)) {
|
||||
DispatchPointerLockError(this, msg);
|
||||
return;
|
||||
}
|
||||
|
||||
bool userInputOrChromeCaller = EventStateManager::IsHandlingUserInput() ||
|
||||
nsContentUtils::IsCallerChrome();
|
||||
NS_DispatchToMainThread(new PointerLockRequest(aElement,
|
||||
userInputOrChromeCaller));
|
||||
}
|
||||
|
||||
bool
|
||||
nsDocument::SetPointerLock(Element* aElement, int aCursorStyle)
|
||||
{
|
||||
MOZ_ASSERT(!aElement || aElement->OwnerDoc() == this,
|
||||
"We should be either unlocking pointer (aElement is nullptr), "
|
||||
"or locking pointer to an element in this document");
|
||||
#ifdef DEBUG
|
||||
if (!aElement) {
|
||||
nsCOMPtr<nsIDocument> pointerLockedDoc =
|
||||
do_QueryReferent(EventStateManager::sPointerLockedDoc);
|
||||
MOZ_ASSERT(pointerLockedDoc == this);
|
||||
}
|
||||
#endif
|
||||
|
||||
nsIPresShell* shell = GetShell();
|
||||
if (!shell) {
|
||||
NS_WARNING("SetPointerLock(): No PresShell");
|
||||
return false;
|
||||
}
|
||||
nsPresContext* presContext = shell->GetPresContext();
|
||||
if (!presContext) {
|
||||
NS_WARNING("SetPointerLock(): Unable to get PresContext");
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIWidget> widget;
|
||||
nsIFrame* rootFrame = shell->GetRootFrame();
|
||||
if (!NS_WARN_IF(!rootFrame)) {
|
||||
widget = rootFrame->GetNearestWidget();
|
||||
NS_WARN_IF_FALSE(widget, "SetPointerLock(): Unable to find widget "
|
||||
"in shell->GetRootFrame()->GetNearestWidget();");
|
||||
if (aElement && !widget) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Hide the cursor and set pointer lock for future mouse events
|
||||
RefPtr<EventStateManager> esm = presContext->EventStateManager();
|
||||
esm->SetCursor(aCursorStyle, nullptr, false,
|
||||
0.0f, 0.0f, widget, true);
|
||||
esm->SetPointerLock(widget, aElement);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
nsDocument::UnlockPointer(nsIDocument* aDoc)
|
||||
{
|
||||
if (!EventStateManager::sIsPointerLocked) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocument> pointerLockedDoc =
|
||||
do_QueryReferent(EventStateManager::sPointerLockedDoc);
|
||||
if (!pointerLockedDoc || (aDoc && aDoc != pointerLockedDoc)) {
|
||||
return;
|
||||
}
|
||||
nsDocument* doc = static_cast<nsDocument*>(pointerLockedDoc.get());
|
||||
if (!doc->SetPointerLock(nullptr, NS_STYLE_CURSOR_AUTO)) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<Element> pointerLockedElement =
|
||||
do_QueryReferent(EventStateManager::sPointerLockedElement);
|
||||
if (pointerLockedElement) {
|
||||
pointerLockedElement->ClearPointerLock();
|
||||
}
|
||||
|
||||
EventStateManager::sPointerLockedElement = nullptr;
|
||||
EventStateManager::sPointerLockedDoc = nullptr;
|
||||
|
||||
nsContentUtils::DispatchEventOnlyToChrome(
|
||||
doc, ToSupports(pointerLockedElement),
|
||||
NS_LITERAL_STRING("MozDOMPointerLock:Exited"),
|
||||
/* Bubbles */ true, /* Cancelable */ false, /* DefaultAction */ nullptr);
|
||||
|
||||
DispatchPointerLockChange(pointerLockedDoc);
|
||||
}
|
||||
|
||||
void
|
||||
nsIDocument::UnlockPointer(nsIDocument* aDoc)
|
||||
{
|
||||
nsDocument::UnlockPointer(aDoc);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocument::MozExitPointerLock()
|
||||
{
|
||||
nsIDocument::MozExitPointerLock();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static void
|
||||
RedispatchPendingPointerLockRequest(nsIDocument* aDocument)
|
||||
NS_IMETHODIMP
|
||||
nsDocument::GetMozPointerLockElement(nsIDOMElement** aPointerLockedElement)
|
||||
{
|
||||
if (!gPendingPointerLockRequest) {
|
||||
return;
|
||||
}
|
||||
nsCOMPtr<nsIDocument> doc =
|
||||
do_QueryReferent(gPendingPointerLockRequest->mDocument);
|
||||
if (doc != aDocument) {
|
||||
return;
|
||||
}
|
||||
nsCOMPtr<Element> elem =
|
||||
do_QueryReferent(gPendingPointerLockRequest->mElement);
|
||||
if (!elem || elem->GetUncomposedDoc() != aDocument) {
|
||||
gPendingPointerLockRequest->Handled();
|
||||
return;
|
||||
Element* el = nsIDocument::GetMozPointerLockElement();
|
||||
nsCOMPtr<nsIDOMElement> retval = do_QueryInterface(el);
|
||||
retval.forget(aPointerLockedElement);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
Element*
|
||||
nsIDocument::GetMozPointerLockElement()
|
||||
{
|
||||
nsCOMPtr<Element> pointerLockedElement =
|
||||
do_QueryReferent(EventStateManager::sPointerLockedElement);
|
||||
if (!pointerLockedElement) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// We have a request pending on the document which may previously be
|
||||
// blocked for fullscreen change. Create a clone and re-dispatch it
|
||||
// to guarantee that Run() method gets called again.
|
||||
bool userInputOrChromeCaller =
|
||||
gPendingPointerLockRequest->mUserInputOrChromeCaller;
|
||||
gPendingPointerLockRequest->Handled();
|
||||
gPendingPointerLockRequest =
|
||||
new nsPointerLockPermissionRequest(elem, userInputOrChromeCaller);
|
||||
NS_DispatchToMainThread(gPendingPointerLockRequest);
|
||||
// Make sure pointer locked element is in the same document.
|
||||
nsCOMPtr<nsIDocument> pointerLockedDoc =
|
||||
do_QueryReferent(EventStateManager::sPointerLockedDoc);
|
||||
if (pointerLockedDoc != this) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return pointerLockedElement;
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -12612,218 +12638,9 @@ nsDocument::OnAppThemeChanged()
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsDocument::RequestPointerLock(Element* aElement)
|
||||
{
|
||||
NS_ASSERTION(aElement,
|
||||
"Must pass non-null element to nsDocument::RequestPointerLock");
|
||||
|
||||
nsCOMPtr<Element> pointerLockedElement =
|
||||
do_QueryReferent(EventStateManager::sPointerLockedElement);
|
||||
if (aElement == pointerLockedElement) {
|
||||
DispatchPointerLockChange(this);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ShouldLockPointer(aElement, pointerLockedElement)) {
|
||||
DispatchPointerLockError(this);
|
||||
return;
|
||||
}
|
||||
|
||||
bool userInputOrChromeCaller = EventStateManager::IsHandlingUserInput() ||
|
||||
nsContentUtils::IsCallerChrome();
|
||||
|
||||
gPendingPointerLockRequest =
|
||||
new nsPointerLockPermissionRequest(aElement, userInputOrChromeCaller);
|
||||
nsCOMPtr<nsIRunnable> r = gPendingPointerLockRequest.get();
|
||||
NS_DispatchToMainThread(r);
|
||||
}
|
||||
|
||||
bool
|
||||
nsDocument::ShouldLockPointer(Element* aElement, Element* aCurrentLock,
|
||||
bool aNoFocusCheck)
|
||||
{
|
||||
// Check if pointer lock pref is enabled
|
||||
if (!Preferences::GetBool("full-screen-api.pointer-lock.enabled")) {
|
||||
NS_WARNING("ShouldLockPointer(): Pointer Lock pref not enabled");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (aCurrentLock && aCurrentLock->OwnerDoc() != aElement->OwnerDoc()) {
|
||||
NS_WARNING("ShouldLockPointer(): Existing pointer lock element in a different document");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!aElement->IsInUncomposedDoc()) {
|
||||
NS_WARNING("ShouldLockPointer(): Element without Document");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mSandboxFlags & SANDBOXED_POINTER_LOCK) {
|
||||
NS_WARNING("ShouldLockPointer(): Document is sandboxed and doesn't allow pointer-lock");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if the element is in a document with a docshell.
|
||||
nsCOMPtr<nsIDocument> ownerDoc = aElement->OwnerDoc();
|
||||
if (!ownerDoc->GetContainer()) {
|
||||
return false;
|
||||
}
|
||||
nsCOMPtr<nsPIDOMWindowOuter> ownerWindow = ownerDoc->GetWindow();
|
||||
if (!ownerWindow) {
|
||||
return false;
|
||||
}
|
||||
nsCOMPtr<nsPIDOMWindowInner> ownerInnerWindow = ownerDoc->GetInnerWindow();
|
||||
if (!ownerInnerWindow) {
|
||||
return false;
|
||||
}
|
||||
if (ownerWindow->GetCurrentInnerWindow() != ownerInnerWindow) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsPIDOMWindowOuter> top = ownerWindow->GetScriptableTop();
|
||||
if (!top || !top->GetExtantDoc() || top->GetExtantDoc()->Hidden()) {
|
||||
NS_WARNING("ShouldLockPointer(): Top document isn't visible.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!aNoFocusCheck) {
|
||||
mozilla::ErrorResult rv;
|
||||
if (!top->GetExtantDoc()->HasFocus(rv)) {
|
||||
NS_WARNING("ShouldLockPointer(): Top document isn't focused.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
nsDocument::SetPointerLock(Element* aElement, int aCursorStyle)
|
||||
{
|
||||
MOZ_ASSERT(!aElement || aElement->OwnerDoc() == this,
|
||||
"We should be either unlocking pointer (aElement is nullptr), "
|
||||
"or locking pointer to an element in this document");
|
||||
#ifdef DEBUG
|
||||
if (!aElement) {
|
||||
nsCOMPtr<nsIDocument> pointerLockedDoc =
|
||||
do_QueryReferent(EventStateManager::sPointerLockedDoc);
|
||||
MOZ_ASSERT(pointerLockedDoc == this);
|
||||
}
|
||||
#endif
|
||||
|
||||
nsIPresShell* shell = GetShell();
|
||||
if (!shell) {
|
||||
NS_WARNING("SetPointerLock(): No PresShell");
|
||||
return false;
|
||||
}
|
||||
nsPresContext* presContext = shell->GetPresContext();
|
||||
if (!presContext) {
|
||||
NS_WARNING("SetPointerLock(): Unable to get PresContext");
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIWidget> widget;
|
||||
nsIFrame* rootFrame = shell->GetRootFrame();
|
||||
if (!NS_WARN_IF(!rootFrame)) {
|
||||
widget = rootFrame->GetNearestWidget();
|
||||
NS_WARN_IF_FALSE(widget, "SetPointerLock(): Unable to find widget "
|
||||
"in shell->GetRootFrame()->GetNearestWidget();");
|
||||
if (aElement && !widget) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Hide the cursor and set pointer lock for future mouse events
|
||||
RefPtr<EventStateManager> esm = presContext->EventStateManager();
|
||||
esm->SetCursor(aCursorStyle, nullptr, false,
|
||||
0.0f, 0.0f, widget, true);
|
||||
esm->SetPointerLock(widget, aElement);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
nsDocument::UnlockPointer(nsIDocument* aDoc)
|
||||
{
|
||||
if (!EventStateManager::sIsPointerLocked) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocument> pointerLockedDoc =
|
||||
do_QueryReferent(EventStateManager::sPointerLockedDoc);
|
||||
if (!pointerLockedDoc || (aDoc && aDoc != pointerLockedDoc)) {
|
||||
return;
|
||||
}
|
||||
nsDocument* doc = static_cast<nsDocument*>(pointerLockedDoc.get());
|
||||
if (!doc->SetPointerLock(nullptr, NS_STYLE_CURSOR_AUTO)) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<Element> pointerLockedElement =
|
||||
do_QueryReferent(EventStateManager::sPointerLockedElement);
|
||||
if (pointerLockedElement) {
|
||||
pointerLockedElement->ClearPointerLock();
|
||||
}
|
||||
|
||||
EventStateManager::sPointerLockedElement = nullptr;
|
||||
EventStateManager::sPointerLockedDoc = nullptr;
|
||||
static_cast<nsDocument*>(pointerLockedDoc.get())->mAllowRelocking = !!aDoc;
|
||||
gPendingPointerLockRequest = nullptr;
|
||||
|
||||
nsContentUtils::DispatchEventOnlyToChrome(
|
||||
doc, ToSupports(pointerLockedElement),
|
||||
NS_LITERAL_STRING("MozDOMPointerLock:Exited"),
|
||||
/* Bubbles */ true, /* Cancelable */ false, /* DefaultAction */ nullptr);
|
||||
|
||||
DispatchPointerLockChange(pointerLockedDoc);
|
||||
}
|
||||
|
||||
void
|
||||
nsIDocument::UnlockPointer(nsIDocument* aDoc)
|
||||
{
|
||||
nsDocument::UnlockPointer(aDoc);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocument::MozExitPointerLock()
|
||||
{
|
||||
nsIDocument::MozExitPointerLock();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocument::GetMozPointerLockElement(nsIDOMElement** aPointerLockedElement)
|
||||
{
|
||||
Element* el = nsIDocument::GetMozPointerLockElement();
|
||||
nsCOMPtr<nsIDOMElement> retval = do_QueryInterface(el);
|
||||
retval.forget(aPointerLockedElement);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
Element*
|
||||
nsIDocument::GetMozPointerLockElement()
|
||||
{
|
||||
nsCOMPtr<Element> pointerLockedElement =
|
||||
do_QueryReferent(EventStateManager::sPointerLockedElement);
|
||||
if (!pointerLockedElement) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Make sure pointer locked element is in the same document.
|
||||
nsCOMPtr<nsIDocument> pointerLockedDoc =
|
||||
do_QueryReferent(EventStateManager::sPointerLockedDoc);
|
||||
if (pointerLockedDoc != this) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return pointerLockedElement;
|
||||
}
|
||||
|
||||
void
|
||||
nsDocument::XPCOMShutdown()
|
||||
{
|
||||
gPendingPointerLockRequest = nullptr;
|
||||
sProcessingStack.reset();
|
||||
}
|
||||
|
||||
|
|
|
@ -1268,8 +1268,6 @@ public:
|
|||
Element* GetFullscreenElement() override;
|
||||
|
||||
void RequestPointerLock(Element* aElement) override;
|
||||
bool ShouldLockPointer(Element* aElement, Element* aCurrentLock,
|
||||
bool aNoFocusCheck = false);
|
||||
bool SetPointerLock(Element* aElement, int aCursorStyle);
|
||||
static void UnlockPointer(nsIDocument* aDoc = nullptr);
|
||||
|
||||
|
@ -1651,11 +1649,7 @@ public:
|
|||
// terminated instead of letting it finish at its own pace.
|
||||
bool mParserAborted:1;
|
||||
|
||||
friend class nsPointerLockPermissionRequest;
|
||||
friend class nsCallRequestFullScreen;
|
||||
// When set, trying to lock the pointer doesn't require permission from the
|
||||
// user.
|
||||
bool mAllowRelocking:1;
|
||||
|
||||
// ScreenOrientation "pending promise" as described by
|
||||
// http://www.w3.org/TR/screen-orientation/
|
||||
|
@ -1674,10 +1668,6 @@ public:
|
|||
// 'style-sheet-applicable-state-changed' notification.
|
||||
bool mSSApplicableStateNotificationPending:1;
|
||||
|
||||
// The number of pointer lock requests which are cancelled by the user.
|
||||
// The value is saturated to kPointerLockRequestLimit+1 = 3.
|
||||
uint8_t mCancelledPointerLockRequests:2;
|
||||
|
||||
// Whether we have reported use counters for this document with Telemetry yet.
|
||||
// Normally this is only done at document destruction time, but for image
|
||||
// documents (SVG documents) that are not guaranteed to be destroyed, we
|
||||
|
|
|
@ -131,6 +131,13 @@ IsJavaMIME(const nsACString & aMIMEType)
|
|||
nsPluginHost::GetSpecialType(aMIMEType) == nsPluginHost::eSpecialType_Java;
|
||||
}
|
||||
|
||||
static bool
|
||||
IsFlashMIME(const nsACString & aMIMEType)
|
||||
{
|
||||
return
|
||||
nsPluginHost::GetSpecialType(aMIMEType) == nsPluginHost::eSpecialType_Flash;
|
||||
}
|
||||
|
||||
static bool
|
||||
InActiveDocument(nsIContent *aContent)
|
||||
{
|
||||
|
@ -465,11 +472,10 @@ private:
|
|||
///
|
||||
|
||||
static bool
|
||||
IsSuccessfulRequest(nsIRequest* aRequest)
|
||||
IsSuccessfulRequest(nsIRequest* aRequest, nsresult* aStatus)
|
||||
{
|
||||
nsresult status;
|
||||
nsresult rv = aRequest->GetStatus(&status);
|
||||
if (NS_FAILED(rv) || NS_FAILED(status)) {
|
||||
nsresult rv = aRequest->GetStatus(aStatus);
|
||||
if (NS_FAILED(rv) || NS_FAILED(*aStatus)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -719,6 +725,7 @@ nsObjectLoadingContent::nsObjectLoadingContent()
|
|||
, mInstantiating(false)
|
||||
, mNetworkCreated(true)
|
||||
, mActivated(false)
|
||||
, mContentBlockingDisabled(false)
|
||||
, mIsStopping(false)
|
||||
, mIsLoading(false)
|
||||
, mScriptRequested(false)
|
||||
|
@ -1123,13 +1130,31 @@ nsObjectLoadingContent::OnStartRequest(nsIRequest *aRequest,
|
|||
nsCOMPtr<nsIChannel> chan(do_QueryInterface(aRequest));
|
||||
NS_ASSERTION(chan, "Why is our request not a channel?");
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsresult status;
|
||||
bool success = IsSuccessfulRequest(aRequest, &status);
|
||||
|
||||
if (IsSuccessfulRequest(aRequest)) {
|
||||
chan->GetURI(getter_AddRefs(uri));
|
||||
if (status == NS_ERROR_BLOCKED_URI) {
|
||||
nsCOMPtr<nsIConsoleService> console(
|
||||
do_GetService("@mozilla.org/consoleservice;1"));
|
||||
if (console) {
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
chan->GetURI(getter_AddRefs(uri));
|
||||
nsAutoCString spec;
|
||||
uri->GetSpec(spec);
|
||||
nsString message = NS_LITERAL_STRING("Blocking ") +
|
||||
NS_ConvertASCIItoUTF16(spec.get()) +
|
||||
NS_LITERAL_STRING(" since it was found on an internal Firefox blocklist.");
|
||||
console->LogStringMessage(message.get());
|
||||
}
|
||||
Telemetry::Accumulate(Telemetry::PLUGIN_BLOCKED_FOR_STABILITY, 1);
|
||||
return NS_ERROR_FAILURE;
|
||||
} else if (status == NS_ERROR_TRACKING_URI) {
|
||||
return NS_ERROR_FAILURE;
|
||||
} else {
|
||||
mContentBlockingDisabled = true;
|
||||
}
|
||||
|
||||
if (!uri) {
|
||||
if (!success) {
|
||||
LOG(("OBJLC [%p]: OnStartRequest: Request failed\n", this));
|
||||
// If the request fails, we still call LoadObject() to handle fallback
|
||||
// content and notifying of failure. (mChannelLoaded && !mChannel) indicates
|
||||
|
@ -2280,32 +2305,6 @@ nsObjectLoadingContent::LoadObject(bool aNotify,
|
|||
allowLoad = CheckProcessPolicy(&contentPolicy);
|
||||
}
|
||||
|
||||
// This needs to be reverted once the plugin stability experiment is over (see bug #1268120).
|
||||
if (allowLoad && Preferences::GetBool(kPrefBlockURIs)) {
|
||||
RefPtr<nsChannelClassifier> channelClassifier = new nsChannelClassifier();
|
||||
nsCOMPtr<nsIURIClassifier> classifier = do_GetService(NS_URICLASSIFIERSERVICE_CONTRACTID);
|
||||
if (classifier) {
|
||||
nsAutoCString tables;
|
||||
Preferences::GetCString("urlclassifier.blockedTable", &tables);
|
||||
nsAutoCString results;
|
||||
rv = classifier->ClassifyLocalWithTables(mURI, tables, results);
|
||||
if (NS_SUCCEEDED(rv) && !results.IsEmpty()) {
|
||||
nsAutoCString uri;
|
||||
mURI->GetSpec(uri);
|
||||
nsCOMPtr<nsIConsoleService> console(
|
||||
do_GetService("@mozilla.org/consoleservice;1"));
|
||||
if (console) {
|
||||
nsString message = NS_LITERAL_STRING("Blocking ") +
|
||||
NS_ConvertASCIItoUTF16(uri) +
|
||||
NS_LITERAL_STRING(" since it was found on an internal Firefox blocklist.");
|
||||
console->LogStringMessage(message.get());
|
||||
}
|
||||
Telemetry::Accumulate(Telemetry::PLUGIN_BLOCKED_FOR_STABILITY, 1);
|
||||
allowLoad = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Content policy implementations can mutate the DOM, check for re-entry
|
||||
if (!mIsLoading) {
|
||||
LOG(("OBJLC [%p]: We re-entered in content policy, leaving original load",
|
||||
|
@ -2353,6 +2352,13 @@ nsObjectLoadingContent::LoadObject(bool aNotify,
|
|||
}
|
||||
}
|
||||
|
||||
// Items resolved as Image/Document are no candidates for content blocking,
|
||||
// as well as invalid plugins (they will not have the mContentType set).
|
||||
if ((mType == eType_Null || mType == eType_Plugin) && ShouldBlockContent()) {
|
||||
LOG(("OBJLC [%p]: Enable content blocking", this));
|
||||
mType = eType_Loading;
|
||||
}
|
||||
|
||||
// If we're a plugin but shouldn't start yet, load fallback with
|
||||
// reason click-to-play instead. Items resolved as Image/Document
|
||||
// will not be checked for previews, as well as invalid plugins
|
||||
|
@ -3362,6 +3368,20 @@ static bool sPrefsInitialized;
|
|||
static uint32_t sSessionTimeoutMinutes;
|
||||
static uint32_t sPersistentTimeoutDays;
|
||||
|
||||
bool
|
||||
nsObjectLoadingContent::ShouldBlockContent()
|
||||
{
|
||||
if (mContentBlockingDisabled)
|
||||
return false;
|
||||
|
||||
if (!IsFlashMIME(mContentType) || !Preferences::GetBool(kPrefBlockURIs)) {
|
||||
mContentBlockingDisabled = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
nsObjectLoadingContent::ShouldPlay(FallbackType &aReason, bool aIgnoreCurrentType)
|
||||
{
|
||||
|
|
|
@ -445,6 +445,11 @@ class nsObjectLoadingContent : public nsImageLoadingContent
|
|||
*/
|
||||
nsresult CloseChannel();
|
||||
|
||||
/**
|
||||
* If this object should be tested against blocking list.
|
||||
*/
|
||||
bool ShouldBlockContent();
|
||||
|
||||
/**
|
||||
* If this object is allowed to play plugin content, or if it would display
|
||||
* click-to-play instead.
|
||||
|
@ -653,6 +658,9 @@ class nsObjectLoadingContent : public nsImageLoadingContent
|
|||
// activated by PlayPlugin(). (see ShouldPlay())
|
||||
bool mActivated : 1;
|
||||
|
||||
// Whether content blocking is enabled or not for this object.
|
||||
bool mContentBlockingDisabled : 1;
|
||||
|
||||
// Protects DoStopPlugin from reentry (bug 724781).
|
||||
bool mIsStopping : 1;
|
||||
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -9,6 +9,7 @@
|
|||
#include "GLContextTypes.h"
|
||||
#include "GLTypes.h"
|
||||
#include "WebGLStrongTypes.h"
|
||||
#include "WebGLTypes.h"
|
||||
|
||||
|
||||
template <class T>
|
||||
|
@ -56,66 +57,72 @@ public:
|
|||
const uint32_t mWidth;
|
||||
const uint32_t mHeight;
|
||||
const uint32_t mDepth;
|
||||
const bool mHasData;
|
||||
const bool mIsSrcPremult;
|
||||
|
||||
protected:
|
||||
TexUnpackBlob(const WebGLContext* webgl, uint32_t alignment, uint32_t rowLength,
|
||||
uint32_t imageHeight, uint32_t width, uint32_t height, uint32_t depth,
|
||||
bool hasData);
|
||||
TexUnpackBlob(const WebGLContext* webgl, TexImageTarget target, uint32_t rowLength,
|
||||
uint32_t width, uint32_t height, uint32_t depth, bool isSrcPremult);
|
||||
|
||||
public:
|
||||
virtual ~TexUnpackBlob() { }
|
||||
|
||||
virtual bool TexOrSubImage(bool isSubImage, bool needsRespec, const char* funcName,
|
||||
WebGLTexture* tex, TexImageTarget target, GLint level,
|
||||
const webgl::DriverUnpackInfo* dui, GLint xOffset,
|
||||
GLint yOffset, GLint zOffset,
|
||||
GLenum* const out_error) const = 0;
|
||||
protected:
|
||||
bool ConvertIfNeeded(WebGLContext* webgl, const char* funcName, const void* srcBytes,
|
||||
uint32_t srcStride, uint8_t srcBPP, WebGLTexelFormat srcFormat,
|
||||
const webgl::DriverUnpackInfo* dstDUI,
|
||||
const void** const out_bytes,
|
||||
UniqueBuffer* const out_anchoredBuffer) const;
|
||||
|
||||
static void OriginsForDOM(WebGLContext* webgl, gl::OriginPos* const out_src,
|
||||
gl::OriginPos* const out_dst);
|
||||
public:
|
||||
virtual bool HasData() const { return true; }
|
||||
|
||||
virtual bool TexOrSubImage(bool isSubImage, bool needsRespec, const char* funcName,
|
||||
WebGLTexture* tex, TexImageTarget target, GLint level,
|
||||
const webgl::DriverUnpackInfo* dui, GLint xOffset,
|
||||
GLint yOffset, GLint zOffset,
|
||||
GLenum* const out_error) const = 0;
|
||||
};
|
||||
|
||||
class TexUnpackBytes : public TexUnpackBlob
|
||||
class TexUnpackBytes final : public TexUnpackBlob
|
||||
{
|
||||
public:
|
||||
const void* const mBytes;
|
||||
|
||||
TexUnpackBytes(const WebGLContext* webgl, uint32_t width, uint32_t height,
|
||||
uint32_t depth, const void* bytes);
|
||||
TexUnpackBytes(const WebGLContext* webgl, TexImageTarget target, uint32_t width,
|
||||
uint32_t height, uint32_t depth, const void* bytes);
|
||||
|
||||
virtual bool HasData() const override { return bool(mBytes); }
|
||||
|
||||
virtual bool TexOrSubImage(bool isSubImage, bool needsRespec, const char* funcName,
|
||||
WebGLTexture* tex, TexImageTarget target, GLint level,
|
||||
const webgl::DriverUnpackInfo* dui, GLint xOffset,
|
||||
GLint yOffset, GLint zOffset,
|
||||
GLenum* const out_error) const override;
|
||||
WebGLTexture* tex, TexImageTarget target, GLint level,
|
||||
const webgl::DriverUnpackInfo* dui, GLint xOffset,
|
||||
GLint yOffset, GLint zOffset,
|
||||
GLenum* const out_error) const override;
|
||||
};
|
||||
|
||||
class TexUnpackImage : public TexUnpackBlob
|
||||
class TexUnpackImage final : public TexUnpackBlob
|
||||
{
|
||||
public:
|
||||
const RefPtr<layers::Image> mImage;
|
||||
const bool mIsAlphaPremult;
|
||||
|
||||
TexUnpackImage(const WebGLContext* webgl, uint32_t imageHeight, uint32_t width,
|
||||
uint32_t height, uint32_t depth, const RefPtr<layers::Image>& image,
|
||||
TexUnpackImage(const WebGLContext* webgl, TexImageTarget target, uint32_t width,
|
||||
uint32_t height, uint32_t depth, layers::Image* image,
|
||||
bool isAlphaPremult);
|
||||
|
||||
virtual bool TexOrSubImage(bool isSubImage, bool needsRespec, const char* funcName,
|
||||
WebGLTexture* tex, TexImageTarget target, GLint level,
|
||||
const webgl::DriverUnpackInfo* dui, GLint xOffset,
|
||||
GLint yOffset, GLint zOffset,
|
||||
GLenum* const out_error) const override;
|
||||
WebGLTexture* tex, TexImageTarget target, GLint level,
|
||||
const webgl::DriverUnpackInfo* dui, GLint xOffset,
|
||||
GLint yOffset, GLint zOffset,
|
||||
GLenum* const out_error) const override;
|
||||
};
|
||||
|
||||
class TexUnpackSurface : public TexUnpackBlob
|
||||
class TexUnpackSurface final : public TexUnpackBlob
|
||||
{
|
||||
public:
|
||||
const RefPtr<gfx::SourceSurface> mSurf;
|
||||
const bool mIsAlphaPremult;
|
||||
const RefPtr<gfx::DataSourceSurface> mSurf;
|
||||
|
||||
TexUnpackSurface(const WebGLContext* webgl, uint32_t imageHeight, uint32_t width,
|
||||
uint32_t height, uint32_t depth, gfx::SourceSurface* surf,
|
||||
TexUnpackSurface(const WebGLContext* webgl, TexImageTarget target, uint32_t width,
|
||||
uint32_t height, uint32_t depth, gfx::DataSourceSurface* surf,
|
||||
bool isAlphaPremult);
|
||||
|
||||
virtual bool TexOrSubImage(bool isSubImage, bool needsRespec, const char* funcName,
|
||||
|
@ -123,19 +130,6 @@ public:
|
|||
const webgl::DriverUnpackInfo* dui, GLint xOffset,
|
||||
GLint yOffset, GLint zOffset,
|
||||
GLenum* const out_error) const override;
|
||||
|
||||
protected:
|
||||
static bool ConvertSurface(WebGLContext* webgl, const webgl::DriverUnpackInfo* dui,
|
||||
gfx::DataSourceSurface* surf, bool isSurfAlphaPremult,
|
||||
UniqueBuffer* const out_convertedBuffer,
|
||||
uint8_t* const out_convertedAlignment,
|
||||
bool* const out_wasTrivial, bool* const out_outOfMemory);
|
||||
static bool UploadDataSurface(bool isSubImage, WebGLContext* webgl,
|
||||
TexImageTarget target, GLint level,
|
||||
const webgl::DriverUnpackInfo* dui, GLint xOffset,
|
||||
GLint yOffset, GLint zOffset, GLsizei width,
|
||||
GLsizei height, gfx::DataSourceSurface* surf,
|
||||
bool isSurfAlphaPremult, GLenum* const out_glError);
|
||||
};
|
||||
|
||||
} // namespace webgl
|
||||
|
|
|
@ -288,6 +288,7 @@ public:
|
|||
void ErrorInvalidEnumInfo(const char* info, const char* funcName,
|
||||
GLenum enumValue);
|
||||
void ErrorOutOfMemory(const char* fmt = 0, ...);
|
||||
void ErrorImplementationBug(const char* fmt = 0, ...);
|
||||
|
||||
const char* ErrorName(GLenum error);
|
||||
|
||||
|
@ -963,10 +964,6 @@ protected:
|
|||
WebGLTexture** const out_texture,
|
||||
WebGLTexture::ImageInfo** const out_imageInfo);
|
||||
|
||||
bool GetUnpackValuesForImage(const char* funcName, uint32_t srcImageWidth,
|
||||
uint32_t srcImageHeight, uint32_t* const out_rowLength,
|
||||
uint32_t* const out_imageHeight);
|
||||
|
||||
bool ValidateUnpackInfo(const char* funcName, GLenum format, GLenum type,
|
||||
webgl::PackingInfo* const out);
|
||||
|
||||
|
@ -1334,24 +1331,8 @@ protected:
|
|||
WebGLTexelFormat dstFormat, bool dstPremultiplied,
|
||||
size_t dstTexelSize);
|
||||
|
||||
public:
|
||||
nsLayoutUtils::SurfaceFromElementResult
|
||||
SurfaceFromElement(dom::Element* elem)
|
||||
{
|
||||
uint32_t flags = nsLayoutUtils::SFE_WANT_IMAGE_SURFACE |
|
||||
nsLayoutUtils::SFE_USE_ELEMENT_SIZE_IF_VECTOR;
|
||||
//////
|
||||
|
||||
if (mPixelStore_ColorspaceConversion == LOCAL_GL_NONE)
|
||||
flags |= nsLayoutUtils::SFE_NO_COLORSPACE_CONVERSION;
|
||||
|
||||
if (!mPixelStore_PremultiplyAlpha)
|
||||
flags |= nsLayoutUtils::SFE_PREFER_NO_PREMULTIPLY_ALPHA;
|
||||
|
||||
RefPtr<gfx::DrawTarget> idealDrawTarget = nullptr; // Don't care for now.
|
||||
return nsLayoutUtils::SurfaceFromElement(elem, flags, idealDrawTarget);
|
||||
}
|
||||
|
||||
protected:
|
||||
// Returns false if `object` is null or not valid.
|
||||
template<class ObjectType>
|
||||
bool ValidateObject(const char* info, ObjectType* object);
|
||||
|
@ -1629,6 +1610,7 @@ public:
|
|||
friend class ScopedUnpackReset;
|
||||
friend class webgl::TexUnpackBlob;
|
||||
friend class webgl::TexUnpackBytes;
|
||||
friend class webgl::TexUnpackImage;
|
||||
friend class webgl::TexUnpackSurface;
|
||||
friend class WebGLTexture;
|
||||
friend class WebGLFBAttachPoint;
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "WebGLContextUtils.h"
|
||||
#include "WebGLContext.h"
|
||||
|
||||
#include "GLContext.h"
|
||||
|
@ -23,7 +24,6 @@
|
|||
#include "WebGLProgram.h"
|
||||
#include "WebGLTexture.h"
|
||||
#include "WebGLVertexArray.h"
|
||||
#include "WebGLContextUtils.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
@ -207,6 +207,22 @@ WebGLContext::ErrorOutOfMemory(const char* fmt, ...)
|
|||
return SynthesizeGLError(LOCAL_GL_OUT_OF_MEMORY);
|
||||
}
|
||||
|
||||
void
|
||||
WebGLContext::ErrorImplementationBug(const char* fmt, ...)
|
||||
{
|
||||
const nsPrintfCString warning("Implementation bug, please file at %s! %s",
|
||||
"https://bugzilla.mozilla.org/", fmt);
|
||||
|
||||
va_list va;
|
||||
va_start(va, fmt);
|
||||
GenerateWarning(warning.BeginReading(), va);
|
||||
va_end(va);
|
||||
|
||||
MOZ_ASSERT(false, "WebGLContext::ErrorImplementationBug");
|
||||
NS_ERROR("WebGLContext::ErrorImplementationBug");
|
||||
return SynthesizeGLError(LOCAL_GL_OUT_OF_MEMORY);
|
||||
}
|
||||
|
||||
const char*
|
||||
WebGLContext::ErrorName(GLenum error)
|
||||
{
|
||||
|
|
|
@ -412,6 +412,9 @@ TexImageTargetForTargetAndFace(TexTarget target, uint8_t face)
|
|||
already_AddRefed<mozilla::layers::Image>
|
||||
ImageFromVideo(dom::HTMLVideoElement* elem);
|
||||
|
||||
bool
|
||||
IsTarget3D(TexImageTarget target);
|
||||
|
||||
GLenum
|
||||
DoTexImage(gl::GLContext* gl, TexImageTarget target, GLint level,
|
||||
const webgl::DriverUnpackInfo* dui, GLsizei width, GLsizei height,
|
||||
|
|
|
@ -178,11 +178,12 @@ WebGLContext::ValidateUnpackPixels(const char* funcName, uint32_t fullRows,
|
|||
}
|
||||
|
||||
static UniquePtr<webgl::TexUnpackBlob>
|
||||
BlobFromView(WebGLContext* webgl, const char* funcName, uint32_t width, uint32_t height,
|
||||
uint32_t depth, const webgl::PackingInfo& pi,
|
||||
BlobFromView(WebGLContext* webgl, const char* funcName, TexImageTarget target,
|
||||
uint32_t width, uint32_t height, uint32_t depth,
|
||||
const webgl::PackingInfo& pi,
|
||||
const dom::Nullable<dom::ArrayBufferView>& maybeView)
|
||||
{
|
||||
const void* bytes = nullptr;
|
||||
const uint8_t* bytes = nullptr;
|
||||
uint32_t byteCount = 0;
|
||||
|
||||
if (!maybeView.IsNull()) {
|
||||
|
@ -203,8 +204,8 @@ BlobFromView(WebGLContext* webgl, const char* funcName, uint32_t width, uint32_t
|
|||
}
|
||||
}
|
||||
|
||||
UniquePtr<webgl::TexUnpackBlob> blob(new webgl::TexUnpackBytes(webgl, width, height,
|
||||
depth, bytes));
|
||||
UniquePtr<webgl::TexUnpackBlob> blob(new webgl::TexUnpackBytes(webgl, target, width,
|
||||
height, depth, bytes));
|
||||
|
||||
//////
|
||||
|
||||
|
@ -268,7 +269,7 @@ WebGLTexture::TexOrSubImage(bool isSubImage, const char* funcName, TexImageTarge
|
|||
if (!mContext->ValidateUnpackInfo(funcName, unpackFormat, unpackType, &pi))
|
||||
return;
|
||||
|
||||
const auto blob = BlobFromView(mContext, funcName, width, height, depth, pi,
|
||||
const auto blob = BlobFromView(mContext, funcName, target, width, height, depth, pi,
|
||||
maybeView);
|
||||
if (!blob)
|
||||
return;
|
||||
|
@ -280,7 +281,7 @@ WebGLTexture::TexOrSubImage(bool isSubImage, const char* funcName, TexImageTarge
|
|||
////////////////////////////////////////
|
||||
// ImageData
|
||||
|
||||
static already_AddRefed<gfx::SourceSurface>
|
||||
static already_AddRefed<gfx::DataSourceSurface>
|
||||
FromImageData(WebGLContext* webgl, const char* funcName, GLenum unpackType,
|
||||
dom::ImageData* imageData, dom::Uint8ClampedArray* scopedArr)
|
||||
{
|
||||
|
@ -299,7 +300,7 @@ FromImageData(WebGLContext* webgl, const char* funcName, GLenum unpackType,
|
|||
|
||||
uint8_t* wrappableData = (uint8_t*)data;
|
||||
|
||||
RefPtr<gfx::SourceSurface> surf =
|
||||
RefPtr<gfx::DataSourceSurface> surf =
|
||||
gfx::Factory::CreateWrappingDataSourceSurface(wrappableData,
|
||||
stride,
|
||||
size,
|
||||
|
@ -312,35 +313,6 @@ FromImageData(WebGLContext* webgl, const char* funcName, GLenum unpackType,
|
|||
return surf.forget();
|
||||
}
|
||||
|
||||
bool
|
||||
WebGLContext::GetUnpackValuesForImage(const char* funcName, uint32_t srcImageWidth,
|
||||
uint32_t srcImageHeight,
|
||||
uint32_t* const out_rowLength,
|
||||
uint32_t* const out_imageHeight)
|
||||
{
|
||||
uint32_t rowLength = mPixelStore_UnpackRowLength;
|
||||
if (!rowLength) {
|
||||
rowLength = srcImageWidth;
|
||||
} else if (rowLength != srcImageWidth) {
|
||||
ErrorInvalidOperation("%s: UNPACK_ROW_LENGTH, if set, must be == width of"
|
||||
" object.");
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t imageHeight = mPixelStore_UnpackImageHeight;
|
||||
if (!imageHeight) {
|
||||
imageHeight = srcImageHeight;
|
||||
} else if (imageHeight > srcImageHeight) {
|
||||
ErrorInvalidOperation("%s: UNPACK_IMAGE_HEIGHT, if set, must be <= height of"
|
||||
" object");
|
||||
return false;
|
||||
}
|
||||
|
||||
*out_rowLength = rowLength;
|
||||
*out_imageHeight = imageHeight;
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
WebGLTexture::TexOrSubImage(bool isSubImage, const char* funcName, TexImageTarget target,
|
||||
GLint level, GLenum internalFormat, GLint xOffset,
|
||||
|
@ -362,27 +334,20 @@ WebGLTexture::TexOrSubImage(bool isSubImage, const char* funcName, TexImageTarge
|
|||
const uint32_t height = imageData->Height();
|
||||
const uint32_t depth = 1;
|
||||
|
||||
uint32_t rowLength, imageHeight;
|
||||
if (!mContext->GetUnpackValuesForImage(funcName, imageData->Width(),
|
||||
imageData->Height(), &rowLength, &imageHeight))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
dom::RootedTypedArray<dom::Uint8ClampedArray> scopedArr(
|
||||
nsContentUtils::RootingCx());
|
||||
const RefPtr<gfx::SourceSurface> surf = FromImageData(mContext, funcName, unpackType,
|
||||
imageData, &scopedArr);
|
||||
dom::RootedTypedArray<dom::Uint8ClampedArray> scopedArr(nsContentUtils::RootingCx());
|
||||
const RefPtr<gfx::DataSourceSurface> surf = FromImageData(mContext, funcName,
|
||||
unpackType, imageData,
|
||||
&scopedArr);
|
||||
if (!surf)
|
||||
return;
|
||||
|
||||
// WhatWG "HTML Living Standard" (30 October 2015):
|
||||
// "The getImageData(sx, sy, sw, sh) method [...] Pixels must be returned as
|
||||
// non-premultiplied alpha values."
|
||||
const bool surfIsAlphaPremult = false;
|
||||
const bool isAlphaPremult = false;
|
||||
|
||||
const webgl::TexUnpackSurface blob(mContext, imageHeight, width, height, depth, surf,
|
||||
surfIsAlphaPremult);
|
||||
const webgl::TexUnpackSurface blob(mContext, target, width, height, depth, surf,
|
||||
isAlphaPremult);
|
||||
|
||||
const uint32_t fullRows = imageData->Height();
|
||||
const uint32_t tailPixels = 0;
|
||||
|
@ -407,7 +372,21 @@ WebGLTexture::TexOrSubImage(bool isSubImage, const char* funcName, TexImageTarge
|
|||
if (!mContext->ValidateUnpackInfo(funcName, unpackFormat, unpackType, &pi))
|
||||
return;
|
||||
|
||||
auto sfer = mContext->SurfaceFromElement(elem);
|
||||
//////
|
||||
|
||||
uint32_t flags = nsLayoutUtils::SFE_WANT_IMAGE_SURFACE |
|
||||
nsLayoutUtils::SFE_USE_ELEMENT_SIZE_IF_VECTOR;
|
||||
|
||||
if (mContext->mPixelStore_ColorspaceConversion == LOCAL_GL_NONE)
|
||||
flags |= nsLayoutUtils::SFE_NO_COLORSPACE_CONVERSION;
|
||||
|
||||
if (!mContext->mPixelStore_PremultiplyAlpha)
|
||||
flags |= nsLayoutUtils::SFE_PREFER_NO_PREMULTIPLY_ALPHA;
|
||||
|
||||
RefPtr<gfx::DrawTarget> idealDrawTarget = nullptr; // Don't care for now.
|
||||
auto sfer = nsLayoutUtils::SurfaceFromElement(elem, flags, idealDrawTarget);
|
||||
|
||||
//////
|
||||
|
||||
uint32_t elemWidth = 0;
|
||||
uint32_t elemHeight = 0;
|
||||
|
@ -418,23 +397,25 @@ WebGLTexture::TexOrSubImage(bool isSubImage, const char* funcName, TexImageTarge
|
|||
elemHeight = layersImage->GetSize().height;
|
||||
}
|
||||
|
||||
gfx::SourceSurface* surf = nullptr;
|
||||
RefPtr<gfx::DataSourceSurface> dataSurf;
|
||||
if (!layersImage && sfer.GetSourceSurface()) {
|
||||
surf = sfer.GetSourceSurface();
|
||||
const auto surf = sfer.GetSourceSurface();
|
||||
elemWidth = surf->GetSize().width;
|
||||
elemHeight = surf->GetSize().height;
|
||||
|
||||
// WARNING: OSX can lose our MakeCurrent here.
|
||||
dataSurf = surf->GetDataSurface();
|
||||
}
|
||||
|
||||
//////
|
||||
|
||||
// Eventually, these will be args.
|
||||
const uint32_t width = elemWidth;
|
||||
const uint32_t height = elemHeight;
|
||||
const uint32_t depth = 1;
|
||||
|
||||
// While it's counter-intuitive, the shape of the SFEResult API means that we should
|
||||
// try to pull out a surface first, and then, if we do pull out a surface, check
|
||||
// CORS/write-only/etc..
|
||||
if (!layersImage && !surf) {
|
||||
webgl::TexUnpackBytes blob(mContext, width, height, depth, nullptr);
|
||||
if (!layersImage && !dataSurf) {
|
||||
const webgl::TexUnpackBytes blob(mContext, target, width, height, depth, nullptr);
|
||||
TexOrSubImageBlob(isSubImage, funcName, target, level, internalFormat, xOffset,
|
||||
yOffset, zOffset, pi, &blob);
|
||||
return;
|
||||
|
@ -442,6 +423,10 @@ WebGLTexture::TexOrSubImage(bool isSubImage, const char* funcName, TexImageTarge
|
|||
|
||||
//////
|
||||
|
||||
// While it's counter-intuitive, the shape of the SFEResult API means that we should
|
||||
// try to pull out a surface first, and then, if we do pull out a surface, check
|
||||
// CORS/write-only/etc..
|
||||
|
||||
if (!sfer.mCORSUsed) {
|
||||
auto& srcPrincipal = sfer.mPrincipal;
|
||||
nsIPrincipal* dstPrincipal = mContext->GetCanvas()->NodePrincipal();
|
||||
|
@ -468,23 +453,16 @@ WebGLTexture::TexOrSubImage(bool isSubImage, const char* funcName, TexImageTarge
|
|||
//////
|
||||
// Ok, we're good!
|
||||
|
||||
uint32_t rowLength, imageHeight;
|
||||
if (!mContext->GetUnpackValuesForImage(funcName, elemWidth, elemHeight, &rowLength,
|
||||
&imageHeight))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UniquePtr<const webgl::TexUnpackBlob> blob;
|
||||
const bool isAlphaPremult = sfer.mIsPremultiplied;
|
||||
|
||||
if (layersImage) {
|
||||
blob.reset(new webgl::TexUnpackImage(mContext, imageHeight, width, height, depth,
|
||||
blob.reset(new webgl::TexUnpackImage(mContext, target, width, height, depth,
|
||||
layersImage, isAlphaPremult));
|
||||
} else {
|
||||
MOZ_ASSERT(surf);
|
||||
blob.reset(new webgl::TexUnpackSurface(mContext, imageHeight, width, height,
|
||||
depth, surf, isAlphaPremult));
|
||||
MOZ_ASSERT(dataSurf);
|
||||
blob.reset(new webgl::TexUnpackSurface(mContext, target, width, height, depth,
|
||||
dataSurf, isAlphaPremult));
|
||||
}
|
||||
|
||||
const uint32_t fullRows = elemHeight;
|
||||
|
@ -836,8 +814,8 @@ DoTexStorage(gl::GLContext* gl, TexTarget target, GLsizei levels, GLenum sizedFo
|
|||
return errorScope.GetError();
|
||||
}
|
||||
|
||||
static bool
|
||||
Is3D(TexImageTarget target)
|
||||
bool
|
||||
IsTarget3D(TexImageTarget target)
|
||||
{
|
||||
switch (target.get()) {
|
||||
case LOCAL_GL_TEXTURE_2D:
|
||||
|
@ -867,7 +845,7 @@ DoTexImage(gl::GLContext* gl, TexImageTarget target, GLint level,
|
|||
|
||||
gl::GLContext::LocalErrorScope errorScope(*gl);
|
||||
|
||||
if (Is3D(target)) {
|
||||
if (IsTarget3D(target)) {
|
||||
gl->fTexImage3D(target.get(), level, dui->internalFormat, width, height, depth,
|
||||
border, dui->unpackFormat, dui->unpackType, data);
|
||||
} else {
|
||||
|
@ -886,7 +864,7 @@ DoTexSubImage(gl::GLContext* gl, TexImageTarget target, GLint level, GLint xOffs
|
|||
{
|
||||
gl::GLContext::LocalErrorScope errorScope(*gl);
|
||||
|
||||
if (Is3D(target)) {
|
||||
if (IsTarget3D(target)) {
|
||||
gl->fTexSubImage3D(target.get(), level, xOffset, yOffset, zOffset, width, height,
|
||||
depth, pi.format, pi.type, data);
|
||||
} else {
|
||||
|
@ -908,7 +886,7 @@ DoCompressedTexImage(gl::GLContext* gl, TexImageTarget target, GLint level,
|
|||
|
||||
gl::GLContext::LocalErrorScope errorScope(*gl);
|
||||
|
||||
if (Is3D(target)) {
|
||||
if (IsTarget3D(target)) {
|
||||
gl->fCompressedTexImage3D(target.get(), level, internalFormat, width, height,
|
||||
depth, border, dataSize, data);
|
||||
} else {
|
||||
|
@ -928,7 +906,7 @@ DoCompressedTexSubImage(gl::GLContext* gl, TexImageTarget target, GLint level,
|
|||
{
|
||||
gl::GLContext::LocalErrorScope errorScope(*gl);
|
||||
|
||||
if (Is3D(target)) {
|
||||
if (IsTarget3D(target)) {
|
||||
gl->fCompressedTexSubImage3D(target.get(), level, xOffset, yOffset, zOffset,
|
||||
width, height, depth, sizedUnpackFormat, dataSize,
|
||||
data);
|
||||
|
@ -950,7 +928,7 @@ DoCopyTexImage2D(gl::GLContext* gl, TexImageTarget target, GLint level,
|
|||
|
||||
gl::GLContext::LocalErrorScope errorScope(*gl);
|
||||
|
||||
MOZ_ASSERT(!Is3D(target));
|
||||
MOZ_ASSERT(!IsTarget3D(target));
|
||||
gl->fCopyTexImage2D(target.get(), level, internalFormat, x, y, width, height,
|
||||
border);
|
||||
|
||||
|
@ -964,7 +942,7 @@ DoCopyTexSubImage(gl::GLContext* gl, TexImageTarget target, GLint level, GLint x
|
|||
{
|
||||
gl::GLContext::LocalErrorScope errorScope(*gl);
|
||||
|
||||
if (Is3D(target)) {
|
||||
if (IsTarget3D(target)) {
|
||||
gl->fCopyTexSubImage3D(target.get(), level, xOffset, yOffset, zOffset, x, y,
|
||||
width, height);
|
||||
} else {
|
||||
|
@ -1263,7 +1241,7 @@ WebGLTexture::TexImage(const char* funcName, TexImageTarget target, GLint level,
|
|||
|
||||
if (!mContext->IsWebGL2() && dstFormat->d) {
|
||||
if (target != LOCAL_GL_TEXTURE_2D ||
|
||||
blob->mHasData ||
|
||||
blob->HasData() ||
|
||||
level != 0)
|
||||
{
|
||||
mContext->ErrorInvalidOperation("%s: With format %s, this function may only"
|
||||
|
@ -1284,7 +1262,7 @@ WebGLTexture::TexImage(const char* funcName, TexImageTarget target, GLint level,
|
|||
// slower.
|
||||
|
||||
const ImageInfo newImageInfo(dstUsage, blob->mWidth, blob->mHeight, blob->mDepth,
|
||||
blob->mHasData);
|
||||
blob->HasData());
|
||||
|
||||
const bool isSubImage = false;
|
||||
const bool needsRespec = (imageInfo->mWidth != newImageInfo.mWidth ||
|
||||
|
|
|
@ -123,7 +123,7 @@ function testColorConversions() {
|
|||
testColorConversion("RGBA32", "GRAY8"),
|
||||
testColorConversion("RGBA32", "YUV444P"),
|
||||
testColorConversion("RGBA32", "YUV422P"),
|
||||
testColorConversion("RGBA32", "YUV420P"),
|
||||
testColorConversion("RGBA32", "YUV420P", 2),
|
||||
testColorConversion("RGBA32", "YUV420SP_NV12"),
|
||||
testColorConversion("RGBA32", "YUV420SP_NV21"),
|
||||
testColorConversion("RGBA32", "HSV", 0.01),
|
||||
|
@ -136,10 +136,10 @@ function testColorConversions() {
|
|||
testColorConversion("BGRA32", "BGR24"),
|
||||
testColorConversion("BGRA32", "GRAY8"),
|
||||
testColorConversion("BGRA32", "YUV444P", 3),
|
||||
testColorConversion("BGRA32", "YUV422P"),
|
||||
testColorConversion("BGRA32", "YUV420P"),
|
||||
testColorConversion("BGRA32", "YUV420SP_NV12"),
|
||||
testColorConversion("BGRA32", "YUV420SP_NV21"),
|
||||
testColorConversion("BGRA32", "YUV422P", 2),
|
||||
testColorConversion("BGRA32", "YUV420P", 2),
|
||||
testColorConversion("BGRA32", "YUV420SP_NV12", 2),
|
||||
testColorConversion("BGRA32", "YUV420SP_NV21", 2),
|
||||
testColorConversion("BGRA32", "HSV", 0.01),
|
||||
testColorConversion("BGRA32", "Lab", 0.5),
|
||||
|
||||
|
@ -178,7 +178,7 @@ function testColorConversions() {
|
|||
testColorConversion("YUV444P", "BGR24"),
|
||||
testColorConversion("YUV444P", "GRAY8"),
|
||||
testColorConversion("YUV444P", "YUV444P"),
|
||||
testColorConversion("YUV444P", "YUV422P", 3),
|
||||
testColorConversion("YUV444P", "YUV422P", 4),
|
||||
testColorConversion("YUV444P", "YUV420P", 3),
|
||||
testColorConversion("YUV444P", "YUV420SP_NV12", 3),
|
||||
testColorConversion("YUV444P", "YUV420SP_NV21", 3),
|
||||
|
@ -187,7 +187,7 @@ function testColorConversions() {
|
|||
|
||||
// From YUV422P
|
||||
testColorConversion("YUV422P", "RGBA32"),
|
||||
testColorConversion("YUV422P", "BGRA32"),
|
||||
testColorConversion("YUV422P", "BGRA32", 2),
|
||||
testColorConversion("YUV422P", "RGB24"),
|
||||
testColorConversion("YUV422P", "BGR24"),
|
||||
testColorConversion("YUV422P", "GRAY8"),
|
||||
|
@ -200,13 +200,13 @@ function testColorConversions() {
|
|||
testColorConversion("YUV422P", "Lab", 0.01),
|
||||
|
||||
// From YUV420P
|
||||
testColorConversion("YUV420P", "RGBA32"),
|
||||
testColorConversion("YUV420P", "BGRA32"),
|
||||
testColorConversion("YUV420P", "RGBA32", 2),
|
||||
testColorConversion("YUV420P", "BGRA32", 2),
|
||||
testColorConversion("YUV420P", "RGB24"),
|
||||
testColorConversion("YUV420P", "BGR24"),
|
||||
testColorConversion("YUV420P", "GRAY8"),
|
||||
testColorConversion("YUV420P", "YUV444P", 3),
|
||||
testColorConversion("YUV420P", "YUV422P"),
|
||||
testColorConversion("YUV420P", "YUV422P", 1),
|
||||
testColorConversion("YUV420P", "YUV420P"),
|
||||
testColorConversion("YUV420P", "YUV420SP_NV12"),
|
||||
testColorConversion("YUV420P", "YUV420SP_NV21"),
|
||||
|
@ -215,12 +215,12 @@ function testColorConversions() {
|
|||
|
||||
// From NV12
|
||||
testColorConversion("YUV420SP_NV12", "RGBA32"),
|
||||
testColorConversion("YUV420SP_NV12", "BGRA32"),
|
||||
testColorConversion("YUV420SP_NV12", "BGRA32", 2),
|
||||
testColorConversion("YUV420SP_NV12", "RGB24"),
|
||||
testColorConversion("YUV420SP_NV12", "BGR24"),
|
||||
testColorConversion("YUV420SP_NV12", "GRAY8"),
|
||||
testColorConversion("YUV420SP_NV12", "YUV444P", 3),
|
||||
testColorConversion("YUV420SP_NV12", "YUV422P"),
|
||||
testColorConversion("YUV420SP_NV12", "YUV422P", 1),
|
||||
testColorConversion("YUV420SP_NV12", "YUV420P"),
|
||||
testColorConversion("YUV420SP_NV12", "YUV420SP_NV12"),
|
||||
testColorConversion("YUV420SP_NV12", "YUV420SP_NV21"),
|
||||
|
@ -229,12 +229,12 @@ function testColorConversions() {
|
|||
|
||||
// From NV21
|
||||
testColorConversion("YUV420SP_NV21", "RGBA32"),
|
||||
testColorConversion("YUV420SP_NV21", "BGRA32"),
|
||||
testColorConversion("YUV420SP_NV21", "BGRA32", 2),
|
||||
testColorConversion("YUV420SP_NV21", "RGB24"),
|
||||
testColorConversion("YUV420SP_NV21", "BGR24"),
|
||||
testColorConversion("YUV420SP_NV21", "GRAY8"),
|
||||
testColorConversion("YUV420SP_NV21", "YUV444P", 3),
|
||||
testColorConversion("YUV420SP_NV21", "YUV422P"),
|
||||
testColorConversion("YUV420SP_NV21", "YUV422P", 1),
|
||||
testColorConversion("YUV420SP_NV21", "YUV420P"),
|
||||
testColorConversion("YUV420SP_NV21", "YUV420SP_NV12"),
|
||||
testColorConversion("YUV420SP_NV21", "YUV420SP_NV21"),
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "mozilla/Telemetry.h"
|
||||
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsISettingsService.h"
|
||||
|
||||
#include "nsGeolocation.h"
|
||||
#include "nsDOMClassInfoID.h"
|
||||
|
@ -31,6 +32,7 @@
|
|||
#include "mozilla/dom/Event.h"
|
||||
#include "mozilla/WeakPtr.h"
|
||||
#include "mozilla/dom/PermissionMessageUtils.h"
|
||||
#include "mozilla/dom/SettingChangeNotificationBinding.h"
|
||||
#include "mozilla/dom/WakeLock.h"
|
||||
|
||||
class nsIPrincipal;
|
||||
|
@ -56,6 +58,9 @@ class nsIPrincipal;
|
|||
// that a window can make.
|
||||
#define MAX_GEO_REQUESTS_PER_WINDOW 1500
|
||||
|
||||
// The settings key.
|
||||
#define GEO_SETTINGS_ENABLED "geolocation.enabled"
|
||||
|
||||
using mozilla::Unused; // <snicker>
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
@ -141,6 +146,53 @@ CreatePositionOptionsCopy(const PositionOptions& aOptions)
|
|||
return geoOptions.forget();
|
||||
}
|
||||
|
||||
class GeolocationSettingsCallback : public nsISettingsServiceCallback
|
||||
{
|
||||
virtual ~GeolocationSettingsCallback() {
|
||||
MOZ_COUNT_DTOR(GeolocationSettingsCallback);
|
||||
}
|
||||
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
GeolocationSettingsCallback() {
|
||||
MOZ_COUNT_CTOR(GeolocationSettingsCallback);
|
||||
}
|
||||
|
||||
NS_IMETHOD Handle(const nsAString& aName, JS::Handle<JS::Value> aResult) override
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
// The geolocation is enabled by default:
|
||||
bool value = true;
|
||||
if (aResult.isBoolean()) {
|
||||
value = aResult.toBoolean();
|
||||
}
|
||||
|
||||
MozSettingValue(value);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD HandleError(const nsAString& aName) override
|
||||
{
|
||||
NS_WARNING("Unable to get value for '" GEO_SETTINGS_ENABLED "'");
|
||||
|
||||
// Default it's enabled:
|
||||
MozSettingValue(true);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void MozSettingValue(const bool aValue)
|
||||
{
|
||||
RefPtr<nsGeolocationService> gs = nsGeolocationService::GetGeolocationService();
|
||||
if (gs) {
|
||||
gs->HandleMozsettingValue(aValue);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS(GeolocationSettingsCallback, nsISettingsServiceCallback)
|
||||
|
||||
class RequestPromptEvent : public Runnable
|
||||
{
|
||||
public:
|
||||
|
@ -326,14 +378,12 @@ NS_INTERFACE_MAP_END
|
|||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsGeolocationRequest)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsGeolocationRequest)
|
||||
NS_IMPL_CYCLE_COLLECTION(nsGeolocationRequest, mCallback, mErrorCallback, mLocator)
|
||||
|
||||
void
|
||||
nsGeolocationRequest::Notify()
|
||||
{
|
||||
SetTimeoutTimer();
|
||||
NotifyErrorAndShutdown(nsIDOMGeoPositionError::TIMEOUT);
|
||||
}
|
||||
|
||||
void
|
||||
nsGeolocationRequest::NotifyErrorAndShutdown(uint16_t aErrorCode)
|
||||
{
|
||||
|
@ -505,7 +555,6 @@ nsGeolocationRequest::GetRequester(nsIContentPermissionRequester** aRequester)
|
|||
|
||||
nsCOMPtr<nsIContentPermissionRequester> requester = mRequester;
|
||||
requester.forget(aRequester);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -593,7 +642,6 @@ nsGeolocationRequest::SendLocation(nsIDOMGeoPosition* aPosition)
|
|||
MOZ_ASSERT(mShutdown || mIsWatchPositionRequest,
|
||||
"non-shutdown getCurrentPosition request after callback!");
|
||||
}
|
||||
|
||||
nsIPrincipal*
|
||||
nsGeolocationRequest::GetPrincipal()
|
||||
{
|
||||
|
@ -610,7 +658,6 @@ nsGeolocationRequest::Update(nsIDOMGeoPosition* aPosition)
|
|||
NS_DispatchToMainThread(ev);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGeolocationRequest::NotifyError(uint16_t aErrorCode)
|
||||
{
|
||||
|
@ -652,7 +699,6 @@ nsGeolocationRequest::TimerCallbackHolder::Notify(nsITimer*)
|
|||
RefPtr<nsGeolocationRequest> request(mRequest);
|
||||
request->Notify();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -671,6 +717,7 @@ NS_IMPL_RELEASE(nsGeolocationService)
|
|||
|
||||
|
||||
static bool sGeoEnabled = true;
|
||||
static bool sGeoInitPending = true;
|
||||
static int32_t sProviderTimeout = 6000; // Time, in milliseconds, to wait for the location provider to spin up.
|
||||
|
||||
nsresult nsGeolocationService::Init()
|
||||
|
@ -683,9 +730,28 @@ nsresult nsGeolocationService::Init()
|
|||
}
|
||||
|
||||
if (XRE_IsContentProcess()) {
|
||||
sGeoInitPending = false;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// check if the geolocation service is enable from settings
|
||||
nsCOMPtr<nsISettingsService> settings =
|
||||
do_GetService("@mozilla.org/settingsService;1");
|
||||
|
||||
if (settings) {
|
||||
nsCOMPtr<nsISettingsServiceLock> settingsLock;
|
||||
nsresult rv = settings->CreateLock(nullptr, getter_AddRefs(settingsLock));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
RefPtr<GeolocationSettingsCallback> callback = new GeolocationSettingsCallback();
|
||||
rv = settingsLock->Get(GEO_SETTINGS_ENABLED, callback);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
} else {
|
||||
// If we cannot obtain the settings service, we continue
|
||||
// assuming that the geolocation is enabled:
|
||||
sGeoInitPending = false;
|
||||
}
|
||||
|
||||
// geolocation service can be enabled -> now register observer
|
||||
nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
|
||||
if (!obs) {
|
||||
|
@ -693,6 +759,7 @@ nsresult nsGeolocationService::Init()
|
|||
}
|
||||
|
||||
obs->AddObserver(this, "xpcom-shutdown", false);
|
||||
obs->AddObserver(this, "mozsettings-changed", false);
|
||||
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
mProvider = new AndroidLocationProvider();
|
||||
|
@ -745,6 +812,47 @@ nsGeolocationService::~nsGeolocationService()
|
|||
{
|
||||
}
|
||||
|
||||
void
|
||||
nsGeolocationService::HandleMozsettingChanged(nsISupports* aSubject)
|
||||
{
|
||||
// The string that we're interested in will be a JSON string that looks like:
|
||||
// {"key":"gelocation.enabled","value":true}
|
||||
|
||||
RootedDictionary<SettingChangeNotification> setting(nsContentUtils::RootingCx());
|
||||
if (!WrappedJSToDictionary(aSubject, setting)) {
|
||||
return;
|
||||
}
|
||||
if (!setting.mKey.EqualsASCII(GEO_SETTINGS_ENABLED)) {
|
||||
return;
|
||||
}
|
||||
if (!setting.mValue.isBoolean()) {
|
||||
return;
|
||||
}
|
||||
|
||||
HandleMozsettingValue(setting.mValue.toBoolean());
|
||||
}
|
||||
|
||||
void
|
||||
nsGeolocationService::HandleMozsettingValue(const bool aValue)
|
||||
{
|
||||
if (!aValue) {
|
||||
// turn things off
|
||||
StopDevice();
|
||||
Update(nullptr);
|
||||
mLastPosition.position = nullptr;
|
||||
sGeoEnabled = false;
|
||||
} else {
|
||||
sGeoEnabled = true;
|
||||
}
|
||||
|
||||
if (sGeoInitPending) {
|
||||
sGeoInitPending = false;
|
||||
for (uint32_t i = 0, length = mGeolocators.Length(); i < length; ++i) {
|
||||
mGeolocators[i]->ServiceReady();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGeolocationService::Observe(nsISupports* aSubject,
|
||||
const char* aTopic,
|
||||
|
@ -754,6 +862,7 @@ nsGeolocationService::Observe(nsISupports* aSubject,
|
|||
nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
|
||||
if (obs) {
|
||||
obs->RemoveObserver(this, "xpcom-shutdown");
|
||||
obs->RemoveObserver(this, "mozsettings-changed");
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i< mGeolocators.Length(); i++) {
|
||||
|
@ -764,6 +873,11 @@ nsGeolocationService::Observe(nsISupports* aSubject,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
if (!strcmp("mozsettings-changed", aTopic)) {
|
||||
HandleMozsettingChanged(aSubject);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (!strcmp("timer-callback", aTopic)) {
|
||||
// decide if we can close down the service.
|
||||
for (uint32_t i = 0; i< mGeolocators.Length(); i++)
|
||||
|
@ -787,21 +901,17 @@ nsGeolocationService::Update(nsIDOMGeoPosition *aSomewhere)
|
|||
if (aSomewhere) {
|
||||
SetCachedPosition(aSomewhere);
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i< mGeolocators.Length(); i++) {
|
||||
mGeolocators[i]->Update(aSomewhere);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGeolocationService::NotifyError(uint16_t aErrorCode)
|
||||
{
|
||||
for (uint32_t i = 0; i < mGeolocators.Length(); i++) {
|
||||
mGeolocators[i]->NotifyError(aErrorCode);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -821,7 +931,7 @@ nsGeolocationService::GetCachedPosition()
|
|||
nsresult
|
||||
nsGeolocationService::StartDevice(nsIPrincipal *aPrincipal)
|
||||
{
|
||||
if (!sGeoEnabled) {
|
||||
if (!sGeoEnabled || sGeoInitPending) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
|
@ -872,6 +982,7 @@ nsGeolocationService::StopDisconnectTimer()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
nsGeolocationService::SetDisconnectTimer()
|
||||
{
|
||||
|
@ -894,7 +1005,6 @@ nsGeolocationService::HighAccuracyRequested()
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -908,11 +1018,17 @@ nsGeolocationService::UpdateAccuracy(bool aForceHigh)
|
|||
if (cpc->IsAlive()) {
|
||||
cpc->SendSetGeolocationHigherAccuracy(highRequired);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
mProvider->SetHighAccuracy(!mHigherAccuracy && highRequired);
|
||||
if (!mHigherAccuracy && highRequired) {
|
||||
mProvider->SetHighAccuracy(true);
|
||||
}
|
||||
|
||||
if (mHigherAccuracy && !highRequired) {
|
||||
mProvider->SetHighAccuracy(false);
|
||||
}
|
||||
|
||||
mHigherAccuracy = highRequired;
|
||||
}
|
||||
|
||||
|
@ -924,7 +1040,6 @@ nsGeolocationService::StopDevice()
|
|||
if (XRE_IsContentProcess()) {
|
||||
ContentChild* cpc = ContentChild::GetSingleton();
|
||||
cpc->SendRemoveGeolocationListener();
|
||||
|
||||
return; // bail early
|
||||
}
|
||||
|
||||
|
@ -960,10 +1075,8 @@ nsGeolocationService::GetGeolocationService()
|
|||
if (NS_FAILED(result->Init())) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ClearOnShutdown(&nsGeolocationService::sService);
|
||||
nsGeolocationService::sService = result;
|
||||
|
||||
return result.forget();
|
||||
}
|
||||
|
||||
|
@ -1066,21 +1179,21 @@ Geolocation::Init(nsPIDOMWindowInner* aContentDom)
|
|||
if (mService) {
|
||||
mService->AddLocator(this);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
Geolocation::ContainsRequest(nsGeolocationRequest* aRequest)
|
||||
{
|
||||
if (aRequest->IsWatch() && mWatchingCallbacks.Contains(aRequest)) {
|
||||
if (aRequest->IsWatch()) {
|
||||
if (mWatchingCallbacks.Contains(aRequest)) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if (mPendingCallbacks.Contains(aRequest)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (mPendingCallbacks.Contains(aRequest)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1104,27 +1217,23 @@ Geolocation::HandleEvent(nsIDOMEvent* aEvent)
|
|||
|
||||
MOZ_ASSERT(XRE_IsContentProcess());
|
||||
ContentChild* cpc = ContentChild::GetSingleton();
|
||||
|
||||
if (!info.lockingProcesses().Contains(cpc->GetID())) {
|
||||
cpc->SendRemoveGeolocationListener();
|
||||
mService->StopDisconnectTimer();
|
||||
}
|
||||
} else {
|
||||
mService->SetDisconnectTimer();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
mService->SetDisconnectTimer();
|
||||
|
||||
// We will unconditionally allow all the requests in the callbacks
|
||||
// because if a request is put into either of these two callbacks,
|
||||
// it means that it has been allowed before.
|
||||
// That's why when we resume them, we unconditionally allow them again.
|
||||
for (uint32_t i = 0, length = mWatchingCallbacks.Length(); i < length; ++i) {
|
||||
mWatchingCallbacks[i]->Allow(JS::UndefinedHandleValue);
|
||||
}
|
||||
|
||||
for (uint32_t i = 0, length = mPendingCallbacks.Length(); i < length; ++i) {
|
||||
mPendingCallbacks[i]->Allow(JS::UndefinedHandleValue);
|
||||
// We will unconditionally allow all the requests in the callbacks
|
||||
// because if a request is put into either of these two callbacks,
|
||||
// it means that it has been allowed before.
|
||||
// That's why when we resume them, we unconditionally allow them again.
|
||||
for (uint32_t i = 0, length = mWatchingCallbacks.Length(); i < length; ++i) {
|
||||
mWatchingCallbacks[i]->Allow(JS::UndefinedHandleValue);
|
||||
}
|
||||
for (uint32_t i = 0, length = mPendingCallbacks.Length(); i < length; ++i) {
|
||||
mPendingCallbacks[i]->Allow(JS::UndefinedHandleValue);
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -1225,10 +1334,8 @@ Geolocation::Update(nsIDOMGeoPosition *aSomewhere)
|
|||
for (uint32_t i = 0; i < mWatchingCallbacks.Length(); i++) {
|
||||
mWatchingCallbacks[i]->Update(aSomewhere);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
Geolocation::NotifyError(uint16_t aErrorCode)
|
||||
{
|
||||
|
@ -1236,7 +1343,6 @@ Geolocation::NotifyError(uint16_t aErrorCode)
|
|||
Shutdown();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
mozilla::Telemetry::Accumulate(mozilla::Telemetry::GEOLOCATION_ERROR, true);
|
||||
|
||||
for (uint32_t i = mPendingCallbacks.Length(); i > 0; i--) {
|
||||
|
@ -1260,7 +1366,6 @@ Geolocation::IsAlreadyCleared(nsGeolocationRequest* aRequest)
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1272,7 +1377,6 @@ Geolocation::ClearPendingRequest(nsGeolocationRequest* aRequest)
|
|||
this->ClearWatch(aRequest->WatchId());
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1335,6 +1439,11 @@ Geolocation::GetCurrentPosition(GeoPositionCallback& callback,
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (sGeoInitPending) {
|
||||
mPendingRequests.AppendElement(request);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return GetCurrentPositionReady(request);
|
||||
}
|
||||
|
||||
|
@ -1424,6 +1533,11 @@ Geolocation::WatchPosition(GeoPositionCallback& aCallback,
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (sGeoInitPending) {
|
||||
mPendingRequests.AppendElement(request);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return WatchPositionReady(request);
|
||||
}
|
||||
|
||||
|
|
|
@ -72,6 +72,9 @@ public:
|
|||
|
||||
nsresult Init();
|
||||
|
||||
void HandleMozsettingChanged(nsISupports* aSubject);
|
||||
void HandleMozsettingValue(const bool aValue);
|
||||
|
||||
// Management of the Geolocation objects
|
||||
void AddLocator(mozilla::dom::Geolocation* locator);
|
||||
void RemoveLocator(mozilla::dom::Geolocation* locator);
|
||||
|
|
|
@ -154,13 +154,14 @@ function checkInputURL()
|
|||
sendString("ttp://mozilla.org");
|
||||
checkValidApplies(element);
|
||||
|
||||
for (var i=0; i<13; ++i) {
|
||||
for (var i=0; i<10; ++i) {
|
||||
synthesizeKey("VK_BACK_SPACE", {});
|
||||
checkValidApplies(element);
|
||||
}
|
||||
|
||||
synthesizeKey("VK_BACK_SPACE", {});
|
||||
for (var i=0; i<4; ++i) {
|
||||
// "http://" is now invalid
|
||||
for (var i=0; i<7; ++i) {
|
||||
checkInvalidApplies(element);
|
||||
synthesizeKey("VK_BACK_SPACE", {});
|
||||
}
|
||||
|
|
|
@ -8,10 +8,6 @@
|
|||
#include <gtk/gtk.h>
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WIDGET_QT
|
||||
#include "nsQAppInstance.h"
|
||||
#endif
|
||||
|
||||
#include "ContentChild.h"
|
||||
|
||||
#include "BlobChild.h"
|
||||
|
@ -619,11 +615,6 @@ ContentChild::Init(MessageLoop* aIOLoop,
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WIDGET_QT
|
||||
// sigh, seriously
|
||||
nsQAppInstance::AddRef();
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_X11
|
||||
// Do this after initializing GDK, or GDK will install its own handler.
|
||||
XRE_InstallX11ErrorHandler();
|
||||
|
@ -1041,14 +1032,6 @@ ContentChild::InitXPCOM()
|
|||
global->SetInitialProcessData(data);
|
||||
}
|
||||
|
||||
// Loading the ServiceWorker configuration.
|
||||
ServiceWorkerConfiguration configuration;
|
||||
SendGetServiceWorkerConfiguration(&configuration);
|
||||
|
||||
RefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
|
||||
MOZ_ASSERT(swm);
|
||||
swm->LoadRegistrations(configuration.serviceWorkerRegistrations());
|
||||
|
||||
InitOnContentProcessCreated();
|
||||
}
|
||||
|
||||
|
@ -2642,6 +2625,15 @@ ContentChild::RecvAppInit()
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
ContentChild::RecvInitServiceWorkers(const ServiceWorkerConfiguration& aConfig)
|
||||
{
|
||||
RefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
|
||||
MOZ_ASSERT(swm);
|
||||
swm->LoadRegistrations(aConfig.serviceWorkerRegistrations());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
ContentChild::RecvLastPrivateDocShellDestroyed()
|
||||
{
|
||||
|
|
|
@ -457,6 +457,9 @@ public:
|
|||
|
||||
virtual bool RecvAppInit() override;
|
||||
|
||||
virtual bool
|
||||
RecvInitServiceWorkers(const ServiceWorkerConfiguration& aConfig) override;
|
||||
|
||||
virtual bool RecvLastPrivateDocShellDestroyed() override;
|
||||
|
||||
virtual bool RecvVolumes(InfallibleTArray<VolumeInfo>&& aVolumes) override;
|
||||
|
|
|
@ -2511,6 +2511,14 @@ ContentParent::InitInternal(ProcessPriority aInitialPriority,
|
|||
Unused << SendSetAudioSessionData(id, sessionName, iconPath);
|
||||
}
|
||||
#endif
|
||||
|
||||
RefPtr<ServiceWorkerRegistrar> swr = ServiceWorkerRegistrar::Get();
|
||||
MOZ_ASSERT(swr);
|
||||
|
||||
nsTArray<ServiceWorkerRegistrationData> registrations;
|
||||
swr->GetRegistrations(registrations);
|
||||
|
||||
Unused << SendInitServiceWorkers(ServiceWorkerConfiguration(registrations));
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -5503,18 +5511,6 @@ ContentParent::PermissionManagerRelease(const ContentParentId& aCpId,
|
|||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
ContentParent::RecvGetServiceWorkerConfiguration(ServiceWorkerConfiguration* aConfig)
|
||||
{
|
||||
MOZ_ASSERT(XRE_IsParentProcess());
|
||||
|
||||
RefPtr<ServiceWorkerRegistrar> swr = ServiceWorkerRegistrar::Get();
|
||||
MOZ_ASSERT(swr);
|
||||
|
||||
swr->GetRegistrations(aConfig->serviceWorkerRegistrations());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
ContentParent::RecvProfile(const nsCString& aProfile)
|
||||
{
|
||||
|
|
|
@ -1135,9 +1135,6 @@ private:
|
|||
virtual bool RecvUpdateDropEffect(const uint32_t& aDragAction,
|
||||
const uint32_t& aDropEffect) override;
|
||||
|
||||
virtual bool
|
||||
RecvGetServiceWorkerConfiguration(ServiceWorkerConfiguration* aConfig) override;
|
||||
|
||||
virtual bool RecvProfile(const nsCString& aProfile) override;
|
||||
|
||||
virtual bool RecvGetGraphicsDeviceInitData(DeviceInitData* aOut) override;
|
||||
|
|
|
@ -526,6 +526,11 @@ child:
|
|||
nsCString ID, nsCString vendor);
|
||||
async AppInit();
|
||||
|
||||
/**
|
||||
* Send ServiceWorkerRegistrationData to child process.
|
||||
*/
|
||||
async InitServiceWorkers(ServiceWorkerConfiguration aConfig);
|
||||
|
||||
// Notify child that last-pb-context-exited notification was observed
|
||||
async LastPrivateDocShellDestroyed();
|
||||
|
||||
|
@ -1084,12 +1089,6 @@ parent:
|
|||
async PContentPermissionRequest(PermissionRequest[] aRequests, Principal aPrincipal,
|
||||
TabId tabId);
|
||||
|
||||
/**
|
||||
* Send ServiceWorkerRegistrationData to child process.
|
||||
*/
|
||||
sync GetServiceWorkerConfiguration()
|
||||
returns (ServiceWorkerConfiguration aConfig);
|
||||
|
||||
async Profile(nsCString aProfile);
|
||||
|
||||
/**
|
||||
|
|
|
@ -168,7 +168,7 @@ if CONFIG['OS_ARCH'] != 'WINNT':
|
|||
|
||||
DEFINES['BIN_SUFFIX'] = '"%s"' % CONFIG['BIN_SUFFIX']
|
||||
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('android', 'gtk2', 'gonk', 'qt'):
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('android', 'gtk2', 'gonk'):
|
||||
DEFINES['MOZ_ENABLE_FREETYPE'] = True
|
||||
|
||||
if CONFIG['MOZ_TOOLKIT_SEARCH']:
|
||||
|
|
|
@ -78,6 +78,15 @@ FullscreenDeniedNotDescendant=Request for fullscreen was denied because requesti
|
|||
FullscreenDeniedNotFocusedTab=Request for fullscreen was denied because requesting element is not in the currently focused tab.
|
||||
RemovedFullscreenElement=Exited fullscreen because fullscreen element was removed from document.
|
||||
FocusedWindowedPluginWhileFullscreen=Exited fullscreen because windowed plugin was focused.
|
||||
PointerLockDeniedDisabled=Request for pointer lock was denied because Pointer Lock API is disabled by user preference.
|
||||
PointerLockDeniedInUse=Request for pointer lock was denied because the pointer is currently controlled by a different document.
|
||||
PointerLockDeniedNotInDocument=Request for pointer lock was denied because the requesting element is not in a document.
|
||||
PointerLockDeniedSandboxed=Request for pointer lock was denied because Pointer Lock API is restricted via sandbox.
|
||||
PointerLockDeniedHidden=Request for pointer lock was denied because the document is not visible.
|
||||
PointerLockDeniedNotFocused=Request for pointer lock was denied because the document is not focused.
|
||||
PointerLockDeniedMovedDocument=Request for pointer lock was denied because the requesting element has moved document.
|
||||
PointerLockDeniedNotInputDriven=Request for pointer lock was denied because Element.requestPointerLock() was not called from inside a short running user-generated event handler, and the document is not in full screen.
|
||||
PointerLockDeniedFailedToLock=Request for pointer lock was denied because the browser failed to lock the pointer.
|
||||
HTMLSyncXHRWarning=HTML parsing in XMLHttpRequest is not supported in the synchronous mode.
|
||||
InvalidRedirectChannelWarning=Unable to redirect to %S because the channel doesn’t implement nsIWritablePropertyBag2.
|
||||
ResponseTypeSyncXHRWarning=Use of XMLHttpRequest’s responseType attribute is no longer supported in the synchronous mode in window context.
|
||||
|
|
|
@ -160,6 +160,6 @@ TEST_DIRS += [
|
|||
'imptests',
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3', 'cocoa', 'windows', 'android', 'qt'):
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3', 'cocoa', 'windows', 'android'):
|
||||
TEST_DIRS += ['plugins/test']
|
||||
|
||||
|
|
|
@ -77,10 +77,6 @@ else:
|
|||
SOURCES += [
|
||||
'nsPluginNativeWindowGtk.cpp',
|
||||
]
|
||||
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'qt':
|
||||
UNIFIED_SOURCES += [
|
||||
'nsPluginNativeWindowQt.cpp',
|
||||
]
|
||||
else:
|
||||
UNIFIED_SOURCES += [
|
||||
'nsPluginNativeWindow.cpp',
|
||||
|
|
|
@ -1811,7 +1811,7 @@ _getvalue(NPP npp, NPNVariable variable, void *result)
|
|||
return NPERR_GENERIC_ERROR;
|
||||
#endif
|
||||
|
||||
#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_QT)
|
||||
#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK)
|
||||
case NPNVnetscapeWindow: {
|
||||
if (!npp || !npp->ndata)
|
||||
return NPERR_INVALID_INSTANCE_ERROR;
|
||||
|
@ -1860,10 +1860,6 @@ _getvalue(NPP npp, NPNVariable variable, void *result)
|
|||
*((NPNToolkitType*)result) = NPNVGtk2;
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WIDGET_QT
|
||||
/* Fake toolkit so flash plugin works */
|
||||
*((NPNToolkitType*)result) = NPNVGtk2;
|
||||
#endif
|
||||
if (*(NPNToolkitType*)result)
|
||||
return NPERR_NO_ERROR;
|
||||
|
||||
|
@ -1873,11 +1869,6 @@ _getvalue(NPP npp, NPNVariable variable, void *result)
|
|||
case NPNVSupportsXEmbedBool: {
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
*(NPBool*)result = true;
|
||||
#elif defined(MOZ_WIDGET_QT)
|
||||
// Desktop Flash fail to initialize if browser does not support NPNVSupportsXEmbedBool
|
||||
// even when wmode!=windowed, lets return fake support
|
||||
fprintf(stderr, "Fake support for XEmbed plugins in Qt port\n");
|
||||
*(NPBool*)result = true;
|
||||
#else
|
||||
*(NPBool*)result = false;
|
||||
#endif
|
||||
|
@ -1898,7 +1889,7 @@ _getvalue(NPP npp, NPNVariable variable, void *result)
|
|||
|
||||
case NPNVSupportsWindowless: {
|
||||
#if defined(XP_WIN) || defined(XP_MACOSX) || \
|
||||
(defined(MOZ_X11) && (defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_QT)))
|
||||
(defined(MOZ_X11) && defined(MOZ_WIDGET_GTK))
|
||||
*(NPBool*)result = true;
|
||||
#else
|
||||
*(NPBool*)result = false;
|
||||
|
|
|
@ -763,7 +763,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetNetscapeWindow(void *value)
|
|||
}
|
||||
|
||||
return NS_OK;
|
||||
#elif (defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_QT)) && defined(MOZ_X11)
|
||||
#elif defined(MOZ_WIDGET_GTK) && defined(MOZ_X11)
|
||||
// X11 window managers want the toplevel window for WM_TRANSIENT_FOR.
|
||||
nsIWidget* win = mPluginFrame->GetNearestWidget();
|
||||
if (!win)
|
||||
|
@ -2616,8 +2616,6 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const WidgetGUIEvent& anEvent)
|
|||
}
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
Window root = GDK_ROOT_WINDOW();
|
||||
#elif defined(MOZ_WIDGET_QT)
|
||||
Window root = RootWindowOfScreen(DefaultScreenOfDisplay(mozilla::DefaultXDisplay()));
|
||||
#else
|
||||
Window root = None; // Could XQueryTree, but this is not important.
|
||||
#endif
|
||||
|
|
|
@ -46,12 +46,8 @@ class PuppetWidget;
|
|||
using mozilla::widget::PuppetWidget;
|
||||
|
||||
#ifdef MOZ_X11
|
||||
#ifdef MOZ_WIDGET_QT
|
||||
#include "gfxQtNativeRenderer.h"
|
||||
#else
|
||||
#include "gfxXlibNativeRenderer.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
class nsPluginInstanceOwner final : public nsIPluginInstanceOwner
|
||||
, public nsIDOMEventListener
|
||||
|
@ -395,12 +391,7 @@ private:
|
|||
int mLastMouseDownButtonType;
|
||||
|
||||
#ifdef MOZ_X11
|
||||
class Renderer
|
||||
#if defined(MOZ_WIDGET_QT)
|
||||
: public gfxQtNativeRenderer
|
||||
#else
|
||||
: public gfxXlibNativeRenderer
|
||||
#endif
|
||||
class Renderer : public gfxXlibNativeRenderer
|
||||
{
|
||||
public:
|
||||
Renderer(NPWindow* aWindow, nsPluginInstanceOwner* aInstanceOwner,
|
||||
|
|
|
@ -1,89 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim:expandtab:shiftwidth=2:tabstop=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 is the Qt implementation of plugin native window.
|
||||
*/
|
||||
|
||||
#include "nsDebug.h"
|
||||
#include "nsPluginNativeWindow.h"
|
||||
#include "npapi.h"
|
||||
|
||||
/**
|
||||
* Qt implementation of plugin window
|
||||
*/
|
||||
class nsPluginNativeWindowQt : public nsPluginNativeWindow
|
||||
{
|
||||
public:
|
||||
nsPluginNativeWindowQt();
|
||||
virtual ~nsPluginNativeWindowQt();
|
||||
|
||||
virtual nsresult CallSetWindow(RefPtr<nsNPAPIPluginInstance> &aPluginInstance);
|
||||
private:
|
||||
|
||||
NPSetWindowCallbackStruct mWsInfo;
|
||||
};
|
||||
|
||||
nsPluginNativeWindowQt::nsPluginNativeWindowQt() : nsPluginNativeWindow()
|
||||
{
|
||||
//Initialize member variables
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr,"\n\n\nCreating plugin native window %p\n\n\n", (void *) this);
|
||||
#endif
|
||||
window = nullptr;
|
||||
x = 0;
|
||||
y = 0;
|
||||
width = 0;
|
||||
height = 0;
|
||||
memset(&clipRect, 0, sizeof(clipRect));
|
||||
ws_info = &mWsInfo;
|
||||
type = NPWindowTypeWindow;
|
||||
mWsInfo.type = 0;
|
||||
#if defined(MOZ_X11)
|
||||
mWsInfo.display = nullptr;
|
||||
mWsInfo.visual = nullptr;
|
||||
mWsInfo.colormap = 0;
|
||||
mWsInfo.depth = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
nsPluginNativeWindowQt::~nsPluginNativeWindowQt()
|
||||
{
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr,"\n\n\nDestoying plugin native window %p\n\n\n", (void *) this);
|
||||
#endif
|
||||
}
|
||||
|
||||
nsresult PLUG_NewPluginNativeWindow(nsPluginNativeWindow **aPluginNativeWindow)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aPluginNativeWindow);
|
||||
*aPluginNativeWindow = new nsPluginNativeWindowQt();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult PLUG_DeletePluginNativeWindow(nsPluginNativeWindow * aPluginNativeWindow)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aPluginNativeWindow);
|
||||
nsPluginNativeWindowQt *p = (nsPluginNativeWindowQt *)aPluginNativeWindow;
|
||||
delete p;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsPluginNativeWindowQt::CallSetWindow(RefPtr<nsNPAPIPluginInstance> &aPluginInstance)
|
||||
{
|
||||
if (aPluginInstance) {
|
||||
if (type == NPWindowTypeWindow) {
|
||||
return NS_ERROR_FAILURE;
|
||||
} // NPWindowTypeWindow
|
||||
aPluginInstance->SetWindow(this);
|
||||
}
|
||||
else if (mPluginInstance)
|
||||
mPluginInstance->SetWindow(nullptr);
|
||||
|
||||
SetPluginInstance(aPluginInstance);
|
||||
return NS_OK;
|
||||
}
|
|
@ -841,7 +841,7 @@ nsresult nsPluginStreamListenerPeer::ServeStreamAsFile(nsIRequest *request,
|
|||
if (owner) {
|
||||
NPWindow* window = nullptr;
|
||||
owner->GetWindow(window);
|
||||
#if (MOZ_WIDGET_GTK == 2) || defined(MOZ_WIDGET_QT)
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
// Should call GetPluginPort() here.
|
||||
// This part is copied from nsPluginInstanceOwner::GetPluginPort().
|
||||
nsCOMPtr<nsIWidget> widget;
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 3; 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/. */
|
||||
|
||||
#ifndef PluginHelperQt_h_
|
||||
#define PluginHelperQt_h_
|
||||
|
||||
class PluginHelperQt
|
||||
{
|
||||
public:
|
||||
static bool AnswerProcessSomeEvents();
|
||||
};
|
||||
|
||||
#endif // PluginHelperQt_h_
|
|
@ -54,9 +54,6 @@ using namespace std;
|
|||
#include <gdk/gdk.h>
|
||||
#include "gtk2xtbin.h"
|
||||
|
||||
#elif defined(MOZ_WIDGET_QT)
|
||||
#undef KeyPress
|
||||
#undef KeyRelease
|
||||
#elif defined(OS_WIN)
|
||||
|
||||
#include <windows.h>
|
||||
|
@ -1386,8 +1383,6 @@ PluginInstanceChild::AnswerNPP_SetWindow(const NPRemoteWindow& aWindow)
|
|||
|
||||
#elif defined(ANDROID)
|
||||
// TODO: Need Android impl
|
||||
#elif defined(MOZ_WIDGET_QT)
|
||||
// TODO: Need QT-nonX impl
|
||||
#elif defined(MOZ_WIDGET_UIKIT)
|
||||
// Don't care
|
||||
#else
|
||||
|
|
|
@ -287,9 +287,6 @@ PluginInstanceParent::AnswerNPN_GetValue_NPNVnetscapeWindow(NativeWindowHandle*
|
|||
#elif defined(ANDROID)
|
||||
// TODO: Need Android impl
|
||||
int id;
|
||||
#elif defined(MOZ_WIDGET_QT)
|
||||
// TODO: Need Qt non X impl
|
||||
int id;
|
||||
#else
|
||||
#warning Implement me
|
||||
#endif
|
||||
|
|
|
@ -102,7 +102,7 @@ struct NPRemoteWindow
|
|||
typedef HWND NativeWindowHandle;
|
||||
#elif defined(MOZ_X11)
|
||||
typedef XID NativeWindowHandle;
|
||||
#elif defined(XP_DARWIN) || defined(ANDROID) || defined(MOZ_WIDGET_QT)
|
||||
#elif defined(XP_DARWIN) || defined(ANDROID)
|
||||
typedef intptr_t NativeWindowHandle; // never actually used, will always be 0
|
||||
#else
|
||||
#error Need NativeWindowHandle for this platform
|
||||
|
|
|
@ -4,12 +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/. */
|
||||
|
||||
#ifdef MOZ_WIDGET_QT
|
||||
#include <QtCore/QTimer>
|
||||
#include "nsQAppInstance.h"
|
||||
#include "NestedLoopTimer.h"
|
||||
#endif
|
||||
|
||||
#include "mozilla/plugins/PluginModuleChild.h"
|
||||
|
||||
/* This must occur *after* plugins/PluginModuleChild.h to avoid typedefs conflicts. */
|
||||
|
@ -73,12 +67,6 @@ namespace {
|
|||
PluginModuleChild* gChromeInstance = nullptr;
|
||||
} // namespace
|
||||
|
||||
#ifdef MOZ_WIDGET_QT
|
||||
typedef void (*_gtk_init_fn)(int argc, char **argv);
|
||||
static _gtk_init_fn s_gtk_init = nullptr;
|
||||
static PRLibrary *sGtkLib = nullptr;
|
||||
#endif
|
||||
|
||||
#ifdef XP_WIN
|
||||
// Hooking CreateFileW for protected-mode magic
|
||||
static WindowsDllInterceptor sKernel32Intercept;
|
||||
|
@ -131,8 +119,6 @@ PluginModuleChild::PluginModuleChild(bool aIsChrome)
|
|||
, mGetEntryPointsFunc(0)
|
||||
#elif defined(MOZ_WIDGET_GTK)
|
||||
, mNestedLoopTimerId(0)
|
||||
#elif defined(MOZ_WIDGET_QT)
|
||||
, mNestedLoopTimerObject(0)
|
||||
#endif
|
||||
#ifdef OS_WIN
|
||||
, mNestedEventHook(nullptr)
|
||||
|
@ -325,6 +311,7 @@ PluginModuleChild::InitForChrome(const std::string& aPluginFilename,
|
|||
}
|
||||
|
||||
#if defined(MOZ_WIDGET_GTK)
|
||||
|
||||
typedef void (*GObjectDisposeFn)(GObject*);
|
||||
typedef gboolean (*GtkWidgetScrollEventFn)(GtkWidget*, GdkEventScroll*);
|
||||
typedef void (*GtkPlugEmbeddedFn)(GtkPlug*);
|
||||
|
@ -548,26 +535,6 @@ PluginModuleChild::ExitedCxxStack()
|
|||
g_source_remove(mNestedLoopTimerId);
|
||||
mNestedLoopTimerId = 0;
|
||||
}
|
||||
#elif defined (MOZ_WIDGET_QT)
|
||||
|
||||
void
|
||||
PluginModuleChild::EnteredCxxStack()
|
||||
{
|
||||
MOZ_ASSERT(mNestedLoopTimerObject == nullptr,
|
||||
"previous timer not descheduled");
|
||||
mNestedLoopTimerObject = new NestedLoopTimer(this);
|
||||
QTimer::singleShot(kNestedLoopDetectorIntervalMs,
|
||||
mNestedLoopTimerObject, SLOT(timeOut()));
|
||||
}
|
||||
|
||||
void
|
||||
PluginModuleChild::ExitedCxxStack()
|
||||
{
|
||||
MOZ_ASSERT(mNestedLoopTimerObject != nullptr,
|
||||
"nested loop timeout not scheduled");
|
||||
delete mNestedLoopTimerObject;
|
||||
mNestedLoopTimerObject = nullptr;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -628,19 +595,6 @@ PluginModuleChild::InitGraphics()
|
|||
real_gtk_plug_embedded = *embedded;
|
||||
*embedded = wrap_gtk_plug_embedded;
|
||||
|
||||
#elif defined(MOZ_WIDGET_QT)
|
||||
nsQAppInstance::AddRef();
|
||||
// Work around plugins that don't interact well without gtk initialized
|
||||
// see bug 566845
|
||||
#if defined(MOZ_X11)
|
||||
if (!sGtkLib)
|
||||
sGtkLib = PR_LoadLibrary("libgtk-x11-2.0.so.0");
|
||||
#endif
|
||||
if (sGtkLib) {
|
||||
s_gtk_init = (_gtk_init_fn)PR_FindFunctionSymbol(sGtkLib, "gtk_init");
|
||||
if (s_gtk_init)
|
||||
s_gtk_init(0, 0);
|
||||
}
|
||||
#else
|
||||
// may not be necessary on all platforms
|
||||
#endif
|
||||
|
@ -654,15 +608,6 @@ PluginModuleChild::InitGraphics()
|
|||
void
|
||||
PluginModuleChild::DeinitGraphics()
|
||||
{
|
||||
#ifdef MOZ_WIDGET_QT
|
||||
nsQAppInstance::Release();
|
||||
if (sGtkLib) {
|
||||
PR_UnloadLibrary(sGtkLib);
|
||||
sGtkLib = nullptr;
|
||||
s_gtk_init = nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(MOZ_X11) && defined(NS_FREE_PERMANENT_DATA)
|
||||
// We free some data off of XDisplay close hooks, ensure they're
|
||||
// run. Closing the display is pretty scary, so we only do it to
|
||||
|
@ -1149,7 +1094,7 @@ _getvalue(NPP aNPP,
|
|||
switch (aVariable) {
|
||||
// Copied from nsNPAPIPlugin.cpp
|
||||
case NPNVToolkit:
|
||||
#if defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_QT)
|
||||
#if defined(MOZ_WIDGET_GTK)
|
||||
*static_cast<NPNToolkitType*>(aValue) = NPNVGtk2;
|
||||
return NPERR_NO_ERROR;
|
||||
#endif
|
||||
|
|
|
@ -52,11 +52,6 @@ class PCrashReporterChild;
|
|||
|
||||
namespace plugins {
|
||||
|
||||
#ifdef MOZ_WIDGET_QT
|
||||
class NestedLoopTimer;
|
||||
static const int kNestedLoopDetectorIntervalMs = 90;
|
||||
#endif
|
||||
|
||||
class PluginInstanceChild;
|
||||
|
||||
class PluginModuleChild : public PPluginModuleChild
|
||||
|
@ -261,10 +256,6 @@ private:
|
|||
static gboolean DetectNestedEventLoop(gpointer data);
|
||||
static gboolean ProcessBrowserEvents(gpointer data);
|
||||
|
||||
virtual void EnteredCxxStack() override;
|
||||
virtual void ExitedCxxStack() override;
|
||||
#elif defined(MOZ_WIDGET_QT)
|
||||
|
||||
virtual void EnteredCxxStack() override;
|
||||
virtual void ExitedCxxStack() override;
|
||||
#endif
|
||||
|
@ -328,8 +319,6 @@ private:
|
|||
// MessagePumpForUI.
|
||||
int mTopLoopDepth;
|
||||
# endif
|
||||
#elif defined (MOZ_WIDGET_QT)
|
||||
NestedLoopTimer *mNestedLoopTimerObject;
|
||||
#endif
|
||||
|
||||
public: // called by PluginInstanceChild
|
||||
|
|
|
@ -4,10 +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/. */
|
||||
|
||||
#ifdef MOZ_WIDGET_QT
|
||||
#include "PluginHelperQt.h"
|
||||
#endif
|
||||
|
||||
#include "mozilla/plugins/PluginModuleParent.h"
|
||||
|
||||
#include "base/process_util.h"
|
||||
|
@ -2859,18 +2855,7 @@ PluginModuleParent::ContentsScaleFactorChanged(NPP instance, double aContentsSca
|
|||
}
|
||||
#endif // #if defined(XP_MACOSX)
|
||||
|
||||
#if defined(MOZ_WIDGET_QT)
|
||||
bool
|
||||
PluginModuleParent::AnswerProcessSomeEvents()
|
||||
{
|
||||
PLUGIN_LOG_DEBUG(("Spinning mini nested loop ..."));
|
||||
PluginHelperQt::AnswerProcessSomeEvents();
|
||||
PLUGIN_LOG_DEBUG(("... quitting mini nested loop"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#elif defined(XP_MACOSX)
|
||||
#if defined(XP_MACOSX)
|
||||
bool
|
||||
PluginModuleParent::AnswerProcessSomeEvents()
|
||||
{
|
||||
|
|
|
@ -90,17 +90,10 @@ PresentationConnection::Init()
|
|||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsILoadGroup> loadGroup;
|
||||
GetLoadGroup(getter_AddRefs(loadGroup));
|
||||
if(NS_WARN_IF(!loadGroup)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
rv = loadGroup->AddRequest(this, nullptr);
|
||||
rv = AddIntoLoadGroup();
|
||||
if(NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return false;
|
||||
}
|
||||
mWeakLoadGroup = do_GetWeakReference(loadGroup);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -117,11 +110,8 @@ PresentationConnection::Shutdown()
|
|||
nsresult rv = service->UnregisterSessionListener(mId, mRole);
|
||||
NS_WARN_IF(NS_FAILED(rv));
|
||||
|
||||
nsCOMPtr<nsILoadGroup> loadGroup = do_QueryReferent(mWeakLoadGroup);
|
||||
if (loadGroup) {
|
||||
loadGroup->RemoveRequest(this, nullptr, NS_OK);
|
||||
mWeakLoadGroup = nullptr;
|
||||
}
|
||||
rv = RemoveFromLoadGroup();
|
||||
NS_WARN_IF(NS_FAILED(rv));
|
||||
}
|
||||
|
||||
/* virtual */ void
|
||||
|
@ -176,20 +166,31 @@ PresentationConnection::Send(const nsAString& aData,
|
|||
void
|
||||
PresentationConnection::Close(ErrorResult& aRv)
|
||||
{
|
||||
// It only works when the state is CONNECTED.
|
||||
if (NS_WARN_IF(mState != PresentationConnectionState::Connected)) {
|
||||
// It only works when the state is CONNECTED or CONNECTING.
|
||||
if (NS_WARN_IF(mState != PresentationConnectionState::Connected &&
|
||||
mState != PresentationConnectionState::Connecting)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO Bug 1210340 - Support close semantics.
|
||||
aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
|
||||
nsCOMPtr<nsIPresentationService> service =
|
||||
do_GetService(PRESENTATION_SERVICE_CONTRACTID);
|
||||
if(NS_WARN_IF(!service)) {
|
||||
aRv.Throw(NS_ERROR_DOM_OPERATION_ERR);
|
||||
return;
|
||||
}
|
||||
|
||||
NS_WARN_IF(NS_FAILED(
|
||||
service->CloseSession(mId,
|
||||
mRole,
|
||||
nsIPresentationService::CLOSED_REASON_CLOSED)));
|
||||
}
|
||||
|
||||
void
|
||||
PresentationConnection::Terminate(ErrorResult& aRv)
|
||||
{
|
||||
// It only works when the state is CONNECTED.
|
||||
if (NS_WARN_IF(mState != PresentationConnectionState::Connected)) {
|
||||
// It only works when the state is CONNECTED or CONNECTING.
|
||||
if (NS_WARN_IF(mState != PresentationConnectionState::Connected &&
|
||||
mState != PresentationConnectionState::Connecting)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -276,7 +277,9 @@ PresentationConnection::ProcessStateChanged(nsresult aReason)
|
|||
CopyUTF8toUTF16(message, errorMsg);
|
||||
}
|
||||
|
||||
return DispatchConnectionClosedEvent(reason, errorMsg);
|
||||
NS_WARN_IF(NS_FAILED(DispatchConnectionClosedEvent(reason, errorMsg)));
|
||||
|
||||
return RemoveFromLoadGroup();
|
||||
}
|
||||
case PresentationConnectionState::Terminated: {
|
||||
nsCOMPtr<nsIPresentationService> service =
|
||||
|
@ -292,7 +295,9 @@ PresentationConnection::ProcessStateChanged(nsresult aReason)
|
|||
|
||||
RefPtr<AsyncEventDispatcher> asyncDispatcher =
|
||||
new AsyncEventDispatcher(this, NS_LITERAL_STRING("terminate"), false);
|
||||
return asyncDispatcher->PostDOMEvent();
|
||||
NS_WARN_IF(NS_FAILED(asyncDispatcher->PostDOMEvent()));
|
||||
|
||||
return RemoveFromLoadGroup();
|
||||
}
|
||||
default:
|
||||
MOZ_CRASH("Unknown presentation session state.");
|
||||
|
@ -475,3 +480,42 @@ PresentationConnection::SetLoadFlags(nsLoadFlags aLoadFlags)
|
|||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
PresentationConnection::AddIntoLoadGroup()
|
||||
{
|
||||
// Avoid adding to loadgroup multiple times
|
||||
if (mWeakLoadGroup) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsILoadGroup> loadGroup;
|
||||
nsresult rv = GetLoadGroup(getter_AddRefs(loadGroup));
|
||||
if(NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
rv = loadGroup->AddRequest(this, nullptr);
|
||||
if(NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
mWeakLoadGroup = do_GetWeakReference(loadGroup);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
PresentationConnection::RemoveFromLoadGroup()
|
||||
{
|
||||
if (!mWeakLoadGroup) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsILoadGroup> loadGroup = do_QueryReferent(mWeakLoadGroup);
|
||||
if (loadGroup) {
|
||||
mWeakLoadGroup = nullptr;
|
||||
return loadGroup->RemoveRequest(this, nullptr, NS_OK);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -79,6 +79,10 @@ private:
|
|||
|
||||
nsresult ProcessConnectionWentAway();
|
||||
|
||||
nsresult AddIntoLoadGroup();
|
||||
|
||||
nsresult RemoveFromLoadGroup();
|
||||
|
||||
nsString mId;
|
||||
uint8_t mRole;
|
||||
PresentationConnectionState mState;
|
||||
|
|
|
@ -105,9 +105,6 @@ function testSendMessage() {
|
|||
});
|
||||
}
|
||||
|
||||
// Currently, PresentationSessionInfo::NotifyTransportClosed only set the state to
|
||||
// STATE_CLOSED. So, when sender call connection.terminate(), we can only get STATE_CLOSED
|
||||
// at receiver side. This should be fixed in bu 1210340.
|
||||
function testConnectionClosed() {
|
||||
return new Promise(function(aResolve, aReject) {
|
||||
info('Receiver: --- testConnectionClosed ---');
|
||||
|
@ -116,7 +113,7 @@ function testConnectionClosed() {
|
|||
is(connection.state, "closed", "Receiver: Connection should be closed.");
|
||||
aResolve();
|
||||
};
|
||||
command('forward-command', JSON.stringify({ name: 'ready-to-terminate' }));
|
||||
command('forward-command', JSON.stringify({ name: 'ready-to-close' }));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -121,15 +121,15 @@ function testIncomingMessage() {
|
|||
});
|
||||
}
|
||||
|
||||
function testTerminateConnection() {
|
||||
function testCloseConnection() {
|
||||
return new Promise(function(aResolve, aReject) {
|
||||
connection.onterminate = function() {
|
||||
connection.onterminate = null;
|
||||
is(connection.state, "terminated", "Connection should be terminated.");
|
||||
connection.onclose = function() {
|
||||
connection.onclose = null;
|
||||
is(connection.state, "closed", "Connection should be closed.");
|
||||
aResolve();
|
||||
};
|
||||
|
||||
connection.terminate();
|
||||
connection.close();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -139,7 +139,7 @@ then(testConnectionAvailableSameOriginInnerIframe).
|
|||
then(testConnectionUnavailableDiffOriginInnerIframe).
|
||||
then(testConnectionListSameObject).
|
||||
then(testIncomingMessage).
|
||||
then(testTerminateConnection).
|
||||
then(testCloseConnection).
|
||||
then(finish);
|
||||
|
||||
</script>
|
||||
|
|
|
@ -177,17 +177,17 @@ function testIncomingMessage() {
|
|||
});
|
||||
}
|
||||
|
||||
function testTerminateConnection() {
|
||||
function testCloseConnection() {
|
||||
return new Promise(function(aResolve, aReject) {
|
||||
info('Sender: --- testTerminateConnection ---');
|
||||
connection.onterminate = function() {
|
||||
connection.onterminate = null;
|
||||
is(connection.state, "terminated", "Sender: Connection should be terminated.");
|
||||
info('Sender: --- testCloseConnection ---');
|
||||
connection.onclose = function() {
|
||||
connection.onclose = null;
|
||||
is(connection.state, "closed", "Sender: Connection should be closed.");
|
||||
aResolve();
|
||||
};
|
||||
gScript.addMessageListener('ready-to-terminate', function onReadyToTerminate() {
|
||||
gScript.removeMessageListener('ready-to-terminate', onReadyToTerminate);
|
||||
connection.terminate();
|
||||
gScript.addMessageListener('ready-to-close', function onReadyToClose() {
|
||||
gScript.removeMessageListener('ready-to-close', onReadyToClose);
|
||||
connection.close();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -208,7 +208,7 @@ function runTests() {
|
|||
.then(testStartConnection)
|
||||
.then(testSendMessage)
|
||||
.then(testIncomingMessage)
|
||||
.then(testTerminateConnection);
|
||||
.then(testCloseConnection);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
|
|
@ -184,17 +184,17 @@ function testIncomingMessage() {
|
|||
});
|
||||
}
|
||||
|
||||
function testTerminateConnection() {
|
||||
function testCloseConnection() {
|
||||
return new Promise(function(aResolve, aReject) {
|
||||
info('Sender: --- testTerminateConnection ---');
|
||||
connection.onterminate = function() {
|
||||
connection.onterminate = null;
|
||||
is(connection.state, "terminated", "Sender: Connection should be terminated.");
|
||||
info('Sender: --- testCloseConnection ---');
|
||||
connection.onclose = function() {
|
||||
connection.onclose = null;
|
||||
is(connection.state, "closed", "Sender: Connection should be closed.");
|
||||
aResolve();
|
||||
};
|
||||
gScript.addMessageListener('ready-to-terminate', function onReadyToTerminate() {
|
||||
gScript.removeMessageListener('ready-to-terminate', onReadyToTerminate);
|
||||
connection.terminate();
|
||||
gScript.addMessageListener('ready-to-close', function onReadyToClose() {
|
||||
gScript.removeMessageListener('ready-to-close', onReadyToClose);
|
||||
connection.close();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -215,7 +215,7 @@ function runTests() {
|
|||
.then(testStartConnection)
|
||||
.then(testSendMessage)
|
||||
.then(testIncomingMessage)
|
||||
.then(testTerminateConnection);
|
||||
.then(testCloseConnection);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
|
|
@ -157,20 +157,20 @@ function testIncomingMessage() {
|
|||
});
|
||||
}
|
||||
|
||||
function testTerminateConnection() {
|
||||
function testCloseConnection() {
|
||||
return new Promise(function(aResolve, aReject) {
|
||||
frameScript.addMessageListener('data-transport-closed', function dataTransportClosedHandler(aReason) {
|
||||
frameScript.removeMessageListener('data-transport-closed', dataTransportClosedHandler);
|
||||
info("The data transport is closed. " + aReason);
|
||||
});
|
||||
|
||||
connection.onterminate = function() {
|
||||
connection.onterminate = null;
|
||||
is(connection.state, "terminated", "Connection should be terminated.");
|
||||
connection.onclose = function() {
|
||||
connection.onclose = null;
|
||||
is(connection.state, "closed", "Connection should be closed.");
|
||||
aResolve();
|
||||
};
|
||||
|
||||
connection.terminate();
|
||||
connection.close();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -192,7 +192,7 @@ function runTests() {
|
|||
then(testStartConnection).
|
||||
then(testSend).
|
||||
then(testIncomingMessage).
|
||||
then(testTerminateConnection).
|
||||
then(testCloseConnection).
|
||||
then(teardown);
|
||||
}
|
||||
|
||||
|
|
|
@ -151,20 +151,20 @@ function testIncomingMessage() {
|
|||
});
|
||||
}
|
||||
|
||||
function testTerminateConnection() {
|
||||
function testCloseConnection() {
|
||||
return new Promise(function(aResolve, aReject) {
|
||||
gScript.addMessageListener('data-transport-closed', function dataTransportClosedHandler(aReason) {
|
||||
gScript.removeMessageListener('data-transport-closed', dataTransportClosedHandler);
|
||||
info("The data transport is closed. " + aReason);
|
||||
});
|
||||
|
||||
connection.onterminate = function() {
|
||||
connection.onterminate = null;
|
||||
is(connection.state, "terminated", "Connection should be terminated.");
|
||||
connection.onclose = function() {
|
||||
connection.onclose = null;
|
||||
is(connection.state, "closed", "Connection should be closed.");
|
||||
aResolve();
|
||||
};
|
||||
|
||||
connection.terminate();
|
||||
connection.close();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -185,7 +185,7 @@ function runTests() {
|
|||
then(testStartConnection).
|
||||
then(testSend).
|
||||
then(testIncomingMessage).
|
||||
then(testTerminateConnection).
|
||||
then(testCloseConnection).
|
||||
then(teardown);
|
||||
}
|
||||
|
||||
|
|
|
@ -101,20 +101,20 @@ function testStartConnection() {
|
|||
});
|
||||
}
|
||||
|
||||
function testTerminateConnection() {
|
||||
function testCloseConnection() {
|
||||
return new Promise(function(aResolve, aReject) {
|
||||
gScript.addMessageListener('data-transport-closed', function dataTransportClosedHandler(aReason) {
|
||||
gScript.removeMessageListener('data-transport-closed', dataTransportClosedHandler);
|
||||
info("The data transport is closed. " + aReason);
|
||||
});
|
||||
|
||||
connection.onterminate = function() {
|
||||
connection.onterminate = null;
|
||||
is(connection.state, "terminated", "Connection should be terminated.");
|
||||
connection.onclose = function() {
|
||||
connection.onclose = null;
|
||||
is(connection.state, "closed", "Connection should be closed.");
|
||||
aResolve();
|
||||
};
|
||||
|
||||
connection.terminate();
|
||||
connection.close();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -134,7 +134,7 @@ function runTests() {
|
|||
|
||||
testSetup().
|
||||
then(testStartConnection).
|
||||
then(testTerminateConnection).
|
||||
then(testCloseConnection).
|
||||
then(teardown);
|
||||
}
|
||||
|
||||
|
|
|
@ -648,7 +648,7 @@ nsCSPContext::SetRequestContext(nsIDOMDocument* aDOMDocument,
|
|||
doc->SetHasCSP(true);
|
||||
}
|
||||
else {
|
||||
NS_WARNING("No Document in SetRequestContext; can not query loadgroup; sending reports may fail.");
|
||||
CSPCONTEXTLOG(("No Document in SetRequestContext; can not query loadgroup; sending reports may fail."));
|
||||
mLoadingPrincipal = aPrincipal;
|
||||
mLoadingPrincipal->GetURI(getter_AddRefs(mSelfURI));
|
||||
// if no document is available, then it also does not make sense to queue console messages
|
||||
|
|
|
@ -6,9 +6,7 @@
|
|||
|
||||
toolkit = CONFIG['MOZ_WIDGET_TOOLKIT']
|
||||
|
||||
if toolkit == 'qt':
|
||||
DIRS += ['qt']
|
||||
elif toolkit == 'windows':
|
||||
if toolkit == 'windows':
|
||||
DIRS += ['windows']
|
||||
elif toolkit == 'cocoa':
|
||||
DIRS += ['mac']
|
||||
|
|
|
@ -36,6 +36,10 @@ skip-if = buildapp == 'b2g' || toolkit == 'android' #TIMED_OUT
|
|||
skip-if = buildapp == 'b2g' || toolkit == 'android' #TIMED_OUT
|
||||
[test_manyWindows.html]
|
||||
skip-if = buildapp == 'b2g'
|
||||
[test_mozsettings.html]
|
||||
skip-if = buildapp == 'b2g' || toolkit == 'android'
|
||||
[test_mozsettingsWatch.html]
|
||||
skip-if = buildapp == 'b2g' || toolkit == 'android'
|
||||
[test_optional_api_params.html]
|
||||
skip-if = buildapp == 'b2g'
|
||||
[test_shutdown.html]
|
||||
|
|
|
@ -0,0 +1,92 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=478911
|
||||
-->
|
||||
<head>
|
||||
<title>Test for getCurrentPosition </title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="geolocation_common.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=777594">Mozilla Bug 777594</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SimpleTest.requestFlakyTimeout("untriaged");
|
||||
|
||||
var timeToWaitMs = 1000;
|
||||
|
||||
resume_geolocationProvider(function() {
|
||||
force_prompt(true, test1);
|
||||
});
|
||||
|
||||
SpecialPowers.importInMainProcess("resource://gre/modules/SettingsRequestManager.jsm");
|
||||
|
||||
function test1() {
|
||||
//This pushPermissions call is after pushPrefEnv call and pushPrefEnv calls follow after this
|
||||
SpecialPowers.pushPermissions([{'type': 'settings-read', 'allow': true, 'context': document},
|
||||
{'type': 'settings-write', 'allow': true, 'context': document},
|
||||
{'type': 'settings-api-write', 'allow': true, 'context': document},
|
||||
{'type': 'settings-api-read', 'allow': true, 'context': document}
|
||||
], test2);
|
||||
}
|
||||
|
||||
function test2() {
|
||||
ok(navigator.geolocation, "get geolocation object");
|
||||
|
||||
toggleGeolocationSetting(false, function() {
|
||||
ok(true, "turned off geolocation via mozSettings");
|
||||
setTimeout(function() {
|
||||
navigator.geolocation.getCurrentPosition(successCallbackAfterMozsettingOff,
|
||||
failureCallbackAfterMozsettingOff);
|
||||
}, timeToWaitMs); // need to wait a bit for all of these async callbacks to finish
|
||||
});
|
||||
}
|
||||
|
||||
function successCallbackAfterMozsettingOff(position) {
|
||||
ok(false, "Success callback should not have been called after setting geolocation.enabled to false.");
|
||||
|
||||
toggleGeolocationSetting(true, function() {
|
||||
ok(true, "turned on geolocation via mozSettings");
|
||||
setTimeout(function() {
|
||||
navigator.geolocation.getCurrentPosition(successCallbackAfterMozsettingOn,
|
||||
failureCallbackAfterMozsettingOn);
|
||||
}, timeToWaitMs); // need to wait a bit for all of these async callbacks to finish
|
||||
});
|
||||
}
|
||||
|
||||
function failureCallbackAfterMozsettingOff(error) {
|
||||
ok(true, "Geolocation didn't work after setting geolocation.enabled to false.");
|
||||
|
||||
toggleGeolocationSetting(true, function() {
|
||||
ok(true, "turned on geolocation via mozSettings");
|
||||
setTimeout(function() {
|
||||
navigator.geolocation.getCurrentPosition(successCallbackAfterMozsettingOn,
|
||||
failureCallbackAfterMozsettingOn);
|
||||
}, timeToWaitMs); // need to wait a bit for all of these async callbacks to finish
|
||||
});
|
||||
}
|
||||
|
||||
function successCallbackAfterMozsettingOn(position) {
|
||||
ok(true, "Geolocation worked after setting geolocation.enabled to true.");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
function failureCallbackAfterMozsettingOn(error) {
|
||||
ok(false, "Geolocation didn't work after setting geolocation.enabled to true.");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=478911
|
||||
-->
|
||||
<head>
|
||||
<title>Test for getCurrentPosition </title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="geolocation_common.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=777594">Mozilla Bug 777594</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SimpleTest.requestFlakyTimeout("untriaged");
|
||||
|
||||
resume_geolocationProvider(function() {
|
||||
force_prompt(true, test1);
|
||||
});
|
||||
|
||||
SpecialPowers.importInMainProcess("resource://gre/modules/SettingsRequestManager.jsm");
|
||||
|
||||
function test1() {
|
||||
//This pushPermissions call is after pushPrefEnv call and pushPrefEnv calls follow after this
|
||||
SpecialPowers.pushPermissions([{'type': 'settings-read', 'allow': true, 'context': document},
|
||||
{'type': 'settings-write', 'allow': true, 'context': document},
|
||||
{'type': 'settings-api-write', 'allow': true, 'context': document},
|
||||
{'type': 'settings-api-read', 'allow': true, 'context': document}
|
||||
], test2);
|
||||
}
|
||||
|
||||
var watchId;
|
||||
function test2() {
|
||||
ok(navigator.geolocation, "get geolocation object");
|
||||
|
||||
toggleGeolocationSetting(false, function() {
|
||||
ok(true, "turned off geolocation via mozSettings");
|
||||
setTimeout(function() {
|
||||
watchId = navigator.geolocation.watchPosition(successCallbackAfterMozsettingOff,
|
||||
failureCallbackAfterMozsettingOff);
|
||||
}, 500); // need to wait a bit for all of these async callbacks to finish
|
||||
});
|
||||
}
|
||||
|
||||
function successCallbackAfterMozsettingOff(position) {
|
||||
ok(false, "Success callback should not have been called after setting geolocation.enabled to false.");
|
||||
|
||||
navigator.geolocation.clearWatch(watchId);
|
||||
toggleGeolocationSetting(true, function() {
|
||||
ok(true, "turned on geolocation via mozSettings");
|
||||
setTimeout(function() {
|
||||
watchId = navigator.geolocation.watchPosition(successCallbackAfterMozsettingOn,
|
||||
failureCallbackAfterMozsettingOn);
|
||||
}, 500); // need to wait a bit for all of these async callbacks to finish
|
||||
});
|
||||
}
|
||||
|
||||
function failureCallbackAfterMozsettingOff(error) {
|
||||
ok(true, "Geolocation didn't work after setting geolocation.enabled to false.");
|
||||
|
||||
navigator.geolocation.clearWatch(watchId);
|
||||
toggleGeolocationSetting(true, function() {
|
||||
ok(true, "turned on geolocation via mozSettings");
|
||||
setTimeout(function() {
|
||||
watchId = navigator.geolocation.watchPosition(successCallbackAfterMozsettingOn,
|
||||
failureCallbackAfterMozsettingOn);
|
||||
}, 500); // need to wait a bit for all of these async callbacks to finish
|
||||
});
|
||||
}
|
||||
|
||||
function successCallbackAfterMozsettingOn(position) {
|
||||
ok(true, "Geolocation worked after setting geolocation.enabled to true.");
|
||||
|
||||
navigator.geolocation.clearWatch(watchId);
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
function failureCallbackAfterMozsettingOn(error) {
|
||||
ok(false, "Geolocation didn't work after setting geolocation.enabled to true.");
|
||||
|
||||
navigator.geolocation.clearWatch(watchId);
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -8,6 +8,8 @@
|
|||
#include "mozilla/dom/URLSearchParamsBinding.h"
|
||||
#include "mozilla/dom/EncodingUtils.h"
|
||||
#include "nsDOMString.h"
|
||||
#include "nsIInputStream.h"
|
||||
#include "nsStringStream.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -300,6 +302,7 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(URLSearchParams)
|
|||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(URLSearchParams)
|
||||
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
||||
NS_INTERFACE_MAP_ENTRY(nsIXHRSendable)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
|
@ -444,5 +447,103 @@ URLSearchParams::GetValueAtIndex(uint32_t aIndex) const
|
|||
return mParams->GetValueAtIndex(aIndex);
|
||||
}
|
||||
|
||||
// Helper functions for structured cloning
|
||||
inline bool
|
||||
ReadString(JSStructuredCloneReader* aReader, nsString& aString)
|
||||
{
|
||||
MOZ_ASSERT(aReader);
|
||||
|
||||
bool read;
|
||||
uint32_t nameLength, zero;
|
||||
read = JS_ReadUint32Pair(aReader, &nameLength, &zero);
|
||||
if (!read) {
|
||||
return false;
|
||||
}
|
||||
MOZ_ASSERT(zero == 0);
|
||||
aString.SetLength(nameLength);
|
||||
size_t charSize = sizeof(nsString::char_type);
|
||||
read = JS_ReadBytes(aReader, (void*) aString.BeginWriting(),
|
||||
nameLength * charSize);
|
||||
if (!read) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
inline bool
|
||||
WriteString(JSStructuredCloneWriter* aWriter, const nsString& aString)
|
||||
{
|
||||
MOZ_ASSERT(aWriter);
|
||||
|
||||
size_t charSize = sizeof(nsString::char_type);
|
||||
return JS_WriteUint32Pair(aWriter, aString.Length(), 0) &&
|
||||
JS_WriteBytes(aWriter, aString.get(), aString.Length() * charSize);
|
||||
}
|
||||
|
||||
bool
|
||||
URLParams::WriteStructuredClone(JSStructuredCloneWriter* aWriter) const
|
||||
{
|
||||
const uint32_t& nParams = mParams.Length();
|
||||
if (!JS_WriteUint32Pair(aWriter, nParams, 0)) {
|
||||
return false;
|
||||
}
|
||||
for (uint32_t i = 0; i < nParams; ++i) {
|
||||
if (!WriteString(aWriter, mParams[i].mKey) ||
|
||||
!WriteString(aWriter, mParams[i].mValue)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
URLParams::ReadStructuredClone(JSStructuredCloneReader* aReader)
|
||||
{
|
||||
MOZ_ASSERT(aReader);
|
||||
|
||||
DeleteAll();
|
||||
|
||||
uint32_t nParams, zero;
|
||||
nsAutoString key, value;
|
||||
if (!JS_ReadUint32Pair(aReader, &nParams, &zero)) {
|
||||
return false;
|
||||
}
|
||||
MOZ_ASSERT(zero == 0);
|
||||
for (uint32_t i = 0; i < nParams; ++i) {
|
||||
if (!ReadString(aReader, key) || !ReadString(aReader, value)) {
|
||||
return false;
|
||||
}
|
||||
Append(key, value);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
URLSearchParams::WriteStructuredClone(JSStructuredCloneWriter* aWriter) const
|
||||
{
|
||||
return mParams->WriteStructuredClone(aWriter);
|
||||
}
|
||||
|
||||
bool
|
||||
URLSearchParams::ReadStructuredClone(JSStructuredCloneReader* aReader)
|
||||
{
|
||||
return mParams->ReadStructuredClone(aReader);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
URLSearchParams::GetSendInfo(nsIInputStream** aBody, uint64_t* aContentLength,
|
||||
nsACString& aContentType, nsACString& aCharset)
|
||||
{
|
||||
aContentType.AssignLiteral("application/x-www-form-urlencoded");
|
||||
aCharset.AssignLiteral("UTF-8");
|
||||
|
||||
nsAutoString serialized;
|
||||
Serialize(serialized);
|
||||
NS_ConvertUTF16toUTF8 converted(serialized);
|
||||
*aContentLength = converted.Length();
|
||||
return NS_NewCStringInputStream(aBody, converted);
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -7,12 +7,14 @@
|
|||
#ifndef mozilla_dom_URLSearchParams_h
|
||||
#define mozilla_dom_URLSearchParams_h
|
||||
|
||||
#include "js/StructuredClone.h"
|
||||
#include "mozilla/dom/BindingDeclarations.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsWrapperCache.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsIUnicodeDecoder.h"
|
||||
#include "nsIXMLHttpRequest.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -108,6 +110,12 @@ public:
|
|||
return mParams[aIndex].mValue;
|
||||
}
|
||||
|
||||
bool
|
||||
ReadStructuredClone(JSStructuredCloneReader* aReader);
|
||||
|
||||
bool
|
||||
WriteStructuredClone(JSStructuredCloneWriter* aWriter) const;
|
||||
|
||||
private:
|
||||
void DecodeString(const nsACString& aInput, nsAString& aOutput);
|
||||
void ConvertString(const nsACString& aInput, nsAString& aOutput);
|
||||
|
@ -122,17 +130,19 @@ private:
|
|||
nsCOMPtr<nsIUnicodeDecoder> mDecoder;
|
||||
};
|
||||
|
||||
class URLSearchParams final : public nsISupports,
|
||||
class URLSearchParams final : public nsIXHRSendable,
|
||||
public nsWrapperCache
|
||||
{
|
||||
~URLSearchParams();
|
||||
|
||||
public:
|
||||
NS_DECL_NSIXHRSENDABLE
|
||||
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(URLSearchParams)
|
||||
|
||||
URLSearchParams(nsISupports* aParent,
|
||||
URLSearchParamsObserver* aObserver);
|
||||
explicit URLSearchParams(nsISupports* aParent,
|
||||
URLSearchParamsObserver* aObserver=nullptr);
|
||||
|
||||
URLSearchParams(nsISupports* aParent,
|
||||
const URLSearchParams& aOther);
|
||||
|
@ -189,6 +199,12 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
ReadStructuredClone(JSStructuredCloneReader* aReader);
|
||||
|
||||
bool
|
||||
WriteStructuredClone(JSStructuredCloneWriter* aWriter) const;
|
||||
|
||||
private:
|
||||
void AppendInternal(const nsAString& aName, const nsAString& aValue);
|
||||
|
||||
|
|
|
@ -387,5 +387,17 @@
|
|||
url = new URL("scheme://tmp\\test", base);
|
||||
is(url.href, "scheme://tmp\\test");
|
||||
</script>
|
||||
|
||||
<script>
|
||||
/** Test for Bug 1275746 **/
|
||||
SimpleTest.doesThrow(() => { var url = new URL("http:"); }, "http: is not a valid URL");
|
||||
SimpleTest.doesThrow(() => { var url = new URL("http:///"); }, "http: is not a valid URL");
|
||||
|
||||
var url = new URL("file:");
|
||||
is(url.href, "file:///", "Parsing file: should work.");
|
||||
|
||||
url = new URL("file:///");
|
||||
is(url.href, "file:///", "Parsing file:/// should work.");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -60,11 +60,10 @@ interface PresentationConnection : EventTarget {
|
|||
* Both the controlling and receiving browsing context can close the
|
||||
* connection. Then the connection state should turn into "closed".
|
||||
*
|
||||
* This function only works when the state is not "connected".
|
||||
* This function only works when the state is "connected" or "connecting".
|
||||
*/
|
||||
// TODO Bug 1210340 - Support close semantics.
|
||||
// [Throws]
|
||||
// void close();
|
||||
[Throws]
|
||||
void close();
|
||||
|
||||
/*
|
||||
* Both the controlling and receiving browsing context can terminate the
|
||||
|
|
|
@ -102,6 +102,8 @@ interface XMLHttpRequest : XMLHttpRequestEventTarget {
|
|||
void send(FormData data);
|
||||
[Throws]
|
||||
void send(InputStream data);
|
||||
[Throws]
|
||||
void send(URLSearchParams data);
|
||||
|
||||
[Throws]
|
||||
void abort();
|
||||
|
|
|
@ -479,28 +479,6 @@ bool WpaSupplicant::ExecuteCommand(CommandOptions aOptions,
|
|||
aResult.mStatus = mWifiHotspotUtils->do_wifi_connect_to_hostapd();
|
||||
} else if (aOptions.mCmd.EqualsLiteral("close_hostapd_connection")) {
|
||||
aResult.mStatus = mWifiHotspotUtils->do_wifi_close_hostapd_connection();
|
||||
} else if (aOptions.mCmd.EqualsLiteral("hostapd_command")) {
|
||||
size_t len = BUFFER_SIZE - 1;
|
||||
char buffer[BUFFER_SIZE];
|
||||
NS_ConvertUTF16toUTF8 request(aOptions.mRequest);
|
||||
aResult.mStatus = mWifiHotspotUtils->do_wifi_hostapd_command(request.get(),
|
||||
buffer,
|
||||
&len);
|
||||
nsString value;
|
||||
if (aResult.mStatus == 0) {
|
||||
if (buffer[len - 1] == '\n') { // remove trailing new lines.
|
||||
len--;
|
||||
}
|
||||
buffer[len] = '\0';
|
||||
CheckBuffer(buffer, len, value);
|
||||
}
|
||||
aResult.mReply = value;
|
||||
} else if (aOptions.mCmd.EqualsLiteral("hostapd_get_stations")) {
|
||||
aResult.mStatus = mWifiHotspotUtils->do_wifi_hostapd_get_stations();
|
||||
} else if (aOptions.mCmd.EqualsLiteral("connect_to_hostapd")) {
|
||||
aResult.mStatus = mWifiHotspotUtils->do_wifi_connect_to_hostapd();
|
||||
} else if (aOptions.mCmd.EqualsLiteral("close_hostapd_connection")) {
|
||||
aResult.mStatus = mWifiHotspotUtils->do_wifi_close_hostapd_connection();
|
||||
|
||||
} else {
|
||||
NS_WARNING("WpaSupplicant::ExecuteCommand : Unknown command");
|
||||
|
|
|
@ -1234,7 +1234,7 @@ ExtendableMessageEvent::Constructor(mozilla::dom::EventTarget* aEventTarget,
|
|||
event->mClient = aOptions.mSource.Value().Value().GetAsClient();
|
||||
} else if (aOptions.mSource.Value().Value().IsServiceWorker()){
|
||||
event->mServiceWorker = aOptions.mSource.Value().Value().GetAsServiceWorker();
|
||||
} else if (aOptions.mSource.Value().Value().IsServiceWorker()){
|
||||
} else if (aOptions.mSource.Value().Value().IsMessagePort()){
|
||||
event->mMessagePort = aOptions.mSource.Value().Value().GetAsMessagePort();
|
||||
}
|
||||
MOZ_ASSERT(event->mClient || event->mServiceWorker || event->mMessagePort);
|
||||
|
|
|
@ -10,7 +10,7 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
|
|||
DIRS += ['mac']
|
||||
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
|
||||
DIRS += ['android']
|
||||
elif CONFIG['MOZ_WIDGET_TOOLKIT'] in ('qt', 'gtk2', 'gtk3'):
|
||||
elif CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3'):
|
||||
DIRS += ['unix']
|
||||
else:
|
||||
DIRS += ['emacs']
|
||||
|
|
|
@ -19,6 +19,7 @@ namespace dom {
|
|||
|
||||
class Blob;
|
||||
class FormData;
|
||||
class URLSearchParams;
|
||||
class XMLHttpRequestUpload;
|
||||
|
||||
class XMLHttpRequest : public XMLHttpRequestEventTarget
|
||||
|
@ -88,6 +89,9 @@ public:
|
|||
virtual void
|
||||
Send(JSContext* aCx, Blob& aBlob, ErrorResult& aRv) = 0;
|
||||
|
||||
virtual void
|
||||
Send(JSContext* aCx, URLSearchParams& aURLSearchParams, ErrorResult& aRv) = 0;
|
||||
|
||||
virtual void
|
||||
Send(JSContext* aCx, nsIDocument& aDoc, ErrorResult& aRv) = 0;
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/FetchUtil.h"
|
||||
#include "mozilla/dom/FormData.h"
|
||||
#include "mozilla/dom/URLSearchParams.h"
|
||||
#include "mozilla/EventDispatcher.h"
|
||||
#include "mozilla/EventListenerManager.h"
|
||||
#include "mozilla/LoadInfo.h"
|
||||
|
@ -2217,6 +2218,15 @@ GetRequestBodyInternal(nsIInputStream* aStream, nsIInputStream** aResult,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult
|
||||
GetRequestBodyInternal(URLSearchParams* aURLSearchParams,
|
||||
nsIInputStream** aResult, uint64_t* aContentLength,
|
||||
nsACString& aContentType, nsACString& aCharset)
|
||||
{
|
||||
return aURLSearchParams->GetSendInfo(aResult, aContentLength,
|
||||
aContentType, aCharset);
|
||||
}
|
||||
|
||||
static nsresult
|
||||
GetRequestBodyInternal(nsIXHRSendable* aSendable, nsIInputStream** aResult,
|
||||
uint64_t* aContentLength, nsACString& aContentType,
|
||||
|
@ -2344,6 +2354,10 @@ XMLHttpRequestMainThread::GetRequestBody(nsIVariant* aVariant,
|
|||
nsACString& aContentType,
|
||||
nsACString& aCharset)
|
||||
{
|
||||
// null the content type and charset by default, as per XHR spec step 4
|
||||
aContentType.SetIsVoid(true);
|
||||
aCharset.SetIsVoid(true);
|
||||
|
||||
if (aVariant) {
|
||||
return GetRequestBodyInternal(aVariant, aResult, aContentLength,
|
||||
aContentType, aCharset);
|
||||
|
@ -2393,6 +2407,12 @@ XMLHttpRequestMainThread::GetRequestBody(nsIVariant* aVariant,
|
|||
return GetRequestBodyInternal(value.mFormData, aResult, aContentLength,
|
||||
aContentType, aCharset);
|
||||
}
|
||||
case XMLHttpRequestMainThread::RequestBody::eURLSearchParams:
|
||||
{
|
||||
MOZ_ASSERT(value.mURLSearchParams);
|
||||
return GetRequestBodyInternal(value.mURLSearchParams, aResult,
|
||||
aContentLength, aContentType, aCharset);
|
||||
}
|
||||
case XMLHttpRequestMainThread::RequestBody::eInputStream:
|
||||
{
|
||||
return GetRequestBodyInternal(value.mStream, aResult, aContentLength,
|
||||
|
@ -2512,11 +2532,10 @@ XMLHttpRequestMainThread::Send(nsIVariant* aVariant, const Nullable<RequestBody>
|
|||
nsAutoCString contentType;
|
||||
if (NS_FAILED(httpChannel->
|
||||
GetRequestHeader(NS_LITERAL_CSTRING("Content-Type"),
|
||||
contentType)) ||
|
||||
contentType.IsEmpty()) {
|
||||
contentType))) {
|
||||
contentType = defaultContentType;
|
||||
|
||||
if (!charset.IsEmpty()) {
|
||||
if (!charset.IsEmpty() && !contentType.IsVoid()) {
|
||||
// If we are providing the default content type, then we also need to
|
||||
// provide a charset declaration.
|
||||
contentType.Append(NS_LITERAL_CSTRING(";charset="));
|
||||
|
|
|
@ -56,6 +56,7 @@ namespace dom {
|
|||
class Blob;
|
||||
class BlobSet;
|
||||
class FormData;
|
||||
class URLSearchParams;
|
||||
class XMLHttpRequestUpload;
|
||||
|
||||
// A helper for building up an ArrayBuffer object's data
|
||||
|
@ -263,6 +264,11 @@ private:
|
|||
{
|
||||
mValue.mBlob = &aBlob;
|
||||
}
|
||||
explicit RequestBody(mozilla::dom::URLSearchParams& aURLSearchParams) :
|
||||
mType(eURLSearchParams)
|
||||
{
|
||||
mValue.mURLSearchParams = &aURLSearchParams;
|
||||
}
|
||||
explicit RequestBody(nsIDocument* aDocument) : mType(eDocument)
|
||||
{
|
||||
mValue.mDocument = aDocument;
|
||||
|
@ -288,7 +294,8 @@ private:
|
|||
eDocument,
|
||||
eDOMString,
|
||||
eFormData,
|
||||
eInputStream
|
||||
eInputStream,
|
||||
eURLSearchParams
|
||||
};
|
||||
union Value {
|
||||
const ArrayBuffer* mArrayBuffer;
|
||||
|
@ -298,6 +305,7 @@ private:
|
|||
const nsAString* mString;
|
||||
FormData* mFormData;
|
||||
nsIInputStream* mStream;
|
||||
URLSearchParams* mURLSearchParams;
|
||||
};
|
||||
|
||||
Type GetType() const
|
||||
|
@ -368,6 +376,12 @@ public:
|
|||
aRv = Send(RequestBody(aBlob));
|
||||
}
|
||||
|
||||
virtual void Send(JSContext* /*aCx*/, URLSearchParams& aURLSearchParams,
|
||||
ErrorResult& aRv) override
|
||||
{
|
||||
aRv = Send(RequestBody(aURLSearchParams));
|
||||
}
|
||||
|
||||
virtual void
|
||||
Send(JSContext* /*aCx*/, nsIDocument& aDoc, ErrorResult& aRv) override
|
||||
{
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "mozilla/dom/FormData.h"
|
||||
#include "mozilla/dom/ProgressEvent.h"
|
||||
#include "mozilla/dom/StructuredCloneHolder.h"
|
||||
#include "mozilla/dom/URLSearchParams.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
@ -2166,6 +2167,39 @@ XMLHttpRequestWorker::Send(JSContext* aCx, FormData& aBody, ErrorResult& aRv)
|
|||
SendInternal(sendRunnable, aRv);
|
||||
}
|
||||
|
||||
void
|
||||
XMLHttpRequestWorker::Send(JSContext* aCx, URLSearchParams& aBody,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
mWorkerPrivate->AssertIsOnWorkerThread();
|
||||
|
||||
if (mCanceled) {
|
||||
aRv.ThrowUncatchableException();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mProxy) {
|
||||
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
return;
|
||||
}
|
||||
|
||||
JS::Rooted<JS::Value> value(aCx);
|
||||
if (!GetOrCreateDOMReflector(aCx, &aBody, &value)) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return;
|
||||
}
|
||||
|
||||
RefPtr<SendRunnable> sendRunnable =
|
||||
new SendRunnable(mWorkerPrivate, mProxy, EmptyString());
|
||||
|
||||
sendRunnable->Write(aCx, value, aRv);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return;
|
||||
}
|
||||
|
||||
SendInternal(sendRunnable, aRv);
|
||||
}
|
||||
|
||||
void
|
||||
XMLHttpRequestWorker::Send(JSContext* aCx, const ArrayBuffer& aBody,
|
||||
ErrorResult& aRv)
|
||||
|
|
|
@ -175,6 +175,9 @@ public:
|
|||
virtual void
|
||||
Send(JSContext* aCx, const ArrayBufferView& aBody, ErrorResult& aRv) override;
|
||||
|
||||
virtual void
|
||||
Send(JSContext* aCx, URLSearchParams& aBody, ErrorResult& aRv) override;
|
||||
|
||||
virtual void
|
||||
Send(JSContext* aCx, nsIDocument& aDoc, ErrorResult& aRv) override
|
||||
{
|
||||
|
|
|
@ -1123,7 +1123,7 @@ HTMLEditor::TabInTable(bool inIsShift,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
Element*
|
||||
already_AddRefed<Element>
|
||||
HTMLEditor::CreateBR(nsINode* aNode,
|
||||
int32_t aOffset,
|
||||
EDirection aSelect)
|
||||
|
@ -1134,7 +1134,7 @@ HTMLEditor::CreateBR(nsINode* aNode,
|
|||
// We assume everything is fine if the br is not null, irrespective of retval
|
||||
CreateBRImpl(address_of(parent), &offset, address_of(outBRNode), aSelect);
|
||||
nsCOMPtr<Element> ret = do_QueryInterface(outBRNode);
|
||||
return ret;
|
||||
return ret.forget();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -492,8 +492,8 @@ protected:
|
|||
bool SetCaretInTableCell(nsIDOMElement* aElement);
|
||||
|
||||
NS_IMETHOD TabInTable(bool inIsShift, bool* outHandled);
|
||||
Element* CreateBR(nsINode* aNode, int32_t aOffset,
|
||||
EDirection aSelect = eNone);
|
||||
already_AddRefed<Element> CreateBR(nsINode* aNode, int32_t aOffset,
|
||||
EDirection aSelect = eNone);
|
||||
NS_IMETHOD CreateBR(
|
||||
nsIDOMNode* aNode, int32_t aOffset,
|
||||
nsCOMPtr<nsIDOMNode>* outBRNode,
|
||||
|
|
|
@ -437,7 +437,7 @@ TextEditor::TypedText(const nsAString& aString, ETypingAction aAction)
|
|||
}
|
||||
}
|
||||
|
||||
Element*
|
||||
already_AddRefed<Element>
|
||||
TextEditor::CreateBRImpl(nsCOMPtr<nsINode>* aInOutParent,
|
||||
int32_t* aInOutOffset,
|
||||
EDirection aSelect)
|
||||
|
@ -448,7 +448,7 @@ TextEditor::CreateBRImpl(nsCOMPtr<nsINode>* aInOutParent,
|
|||
CreateBRImpl(address_of(parent), aInOutOffset, address_of(br), aSelect);
|
||||
*aInOutParent = do_QueryInterface(parent);
|
||||
nsCOMPtr<Element> ret(do_QueryInterface(br));
|
||||
return ret;
|
||||
return ret.forget();
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
|
|
@ -184,8 +184,9 @@ protected:
|
|||
NS_IMETHOD CreateBR(nsIDOMNode* aNode, int32_t aOffset,
|
||||
nsCOMPtr<nsIDOMNode>* outBRNode,
|
||||
EDirection aSelect = eNone);
|
||||
Element* CreateBRImpl(nsCOMPtr<nsINode>* aInOutParent, int32_t* aInOutOffset,
|
||||
EDirection aSelect);
|
||||
already_AddRefed<Element> CreateBRImpl(nsCOMPtr<nsINode>* aInOutParent,
|
||||
int32_t* aInOutOffset,
|
||||
EDirection aSelect);
|
||||
nsresult CreateBRImpl(nsCOMPtr<nsIDOMNode>* aInOutParent,
|
||||
int32_t* aInOutOffset,
|
||||
nsCOMPtr<nsIDOMNode>* outBRNode,
|
||||
|
|
|
@ -166,7 +166,7 @@ WSRunObject::PrepareToSplitAcrossBlocks(HTMLEditor* aHTMLEditor,
|
|||
return wsObj.PrepareToSplitAcrossBlocksPriv();
|
||||
}
|
||||
|
||||
Element*
|
||||
already_AddRefed<Element>
|
||||
WSRunObject::InsertBreak(nsCOMPtr<nsINode>* aInOutParent,
|
||||
int32_t* aInOutOffset,
|
||||
nsIEditor::EDirection aSelect)
|
||||
|
|
|
@ -215,9 +215,9 @@ public:
|
|||
// and makes any needed adjustments to ws around that point.
|
||||
// example of fixup: normalws after {aInOutParent,aInOutOffset}
|
||||
// needs to begin with nbsp.
|
||||
dom::Element* InsertBreak(nsCOMPtr<nsINode>* aInOutParent,
|
||||
int32_t* aInOutOffset,
|
||||
nsIEditor::EDirection aSelect);
|
||||
already_AddRefed<dom::Element> InsertBreak(nsCOMPtr<nsINode>* aInOutParent,
|
||||
int32_t* aInOutOffset,
|
||||
nsIEditor::EDirection aSelect);
|
||||
|
||||
// InsertText inserts a string at {aInOutParent,aInOutOffset} and makes any
|
||||
// needed adjustments to ws around that point. Example of fixup:
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче