Merge mozilla-central and inbound
|
@ -5648,25 +5648,20 @@ var OfflineApps = {
|
|||
if (!aBrowser)
|
||||
return;
|
||||
|
||||
var notificationBox = gBrowser.getNotificationBox(aBrowser);
|
||||
var notification = notificationBox.getNotificationWithValue("offline-app-usage");
|
||||
if (!notification) {
|
||||
var buttons = [{
|
||||
label: gNavigatorBundle.getString("offlineApps.manageUsage"),
|
||||
accessKey: gNavigatorBundle.getString("offlineApps.manageUsageAccessKey"),
|
||||
callback: OfflineApps.manage
|
||||
}];
|
||||
let mainAction = {
|
||||
label: gNavigatorBundle.getString("offlineApps.manageUsage"),
|
||||
accessKey: gNavigatorBundle.getString("offlineApps.manageUsageAccessKey"),
|
||||
callback: OfflineApps.manage
|
||||
};
|
||||
|
||||
var warnQuota = gPrefService.getIntPref("offline-apps.quota.warn");
|
||||
const priority = notificationBox.PRIORITY_WARNING_MEDIUM;
|
||||
var message = gNavigatorBundle.getFormattedString("offlineApps.usage",
|
||||
[ aURI.host,
|
||||
warnQuota / 1024 ]);
|
||||
let warnQuota = gPrefService.getIntPref("offline-apps.quota.warn");
|
||||
let message = gNavigatorBundle.getFormattedString("offlineApps.usage",
|
||||
[ aURI.host,
|
||||
warnQuota / 1024 ]);
|
||||
|
||||
notificationBox.appendNotification(message, "offline-app-usage",
|
||||
"chrome://browser/skin/Info.png",
|
||||
priority, buttons);
|
||||
}
|
||||
let anchorID = "indexedDB-notification-icon";
|
||||
PopupNotifications.show(aBrowser, "offline-app-usage", message,
|
||||
anchorID, mainAction);
|
||||
|
||||
// Now that we've warned once, prevent the warning from showing up
|
||||
// again.
|
||||
|
|
|
@ -332,6 +332,9 @@ _BROWSER_FILES = \
|
|||
browser_blob-channelname.js \
|
||||
browser_aboutHealthReport.js \
|
||||
healthreport_testRemoteCommands.html \
|
||||
browser_offlineQuotaNotification.js \
|
||||
offlineQuotaNotification.html \
|
||||
offlineQuotaNotification.cacheManifest \
|
||||
$(NULL)
|
||||
|
||||
# Disable tests on Windows due to frequent failures (bugs 825739, 841341)
|
||||
|
|
|
@ -0,0 +1,74 @@
|
|||
/**
|
||||
* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
// Test offline quota warnings - must be run as a mochitest-browser test or
|
||||
// else the test runner gets in the way of notifications due to bug 857897.
|
||||
|
||||
const URL = "http://mochi.test:8888/browser/browser/base/content/test/offlineQuotaNotification.html";
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
// Clean up after ourself
|
||||
let uri = Services.io.newURI(URL, null, null);
|
||||
var principal = Services.scriptSecurityManager.getNoAppCodebasePrincipal(uri);
|
||||
Services.perms.removeFromPrincipal(principal, "offline-app");
|
||||
Services.prefs.clearUserPref("offline-apps.quota.warn");
|
||||
});
|
||||
|
||||
// Check that the "preferences" UI is opened and showing which websites have
|
||||
// offline storage permissions - currently this is the "network" tab in the
|
||||
// "advanced" pane.
|
||||
function checkPreferences(prefsWin) {
|
||||
// We expect a 'paneload' event for the 'advanced' pane, then
|
||||
// a 'select' event on the 'network' tab inside that pane.
|
||||
prefsWin.addEventListener("paneload", function paneload(evt) {
|
||||
prefsWin.removeEventListener("paneload", paneload);
|
||||
is(evt.target.id, "paneAdvanced", "advanced pane loaded");
|
||||
let tabPanels = evt.target.getElementsByTagName("tabpanels")[0];
|
||||
tabPanels.addEventListener("select", function tabselect() {
|
||||
tabPanels.removeEventListener("select", tabselect);
|
||||
is(tabPanels.selectedPanel.id, "networkPanel", "networkPanel is selected");
|
||||
// all good, we are done.
|
||||
prefsWin.close();
|
||||
finish();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
gBrowser.selectedBrowser.addEventListener("load", function onload() {
|
||||
gBrowser.selectedBrowser.removeEventListener("load", onload, true);
|
||||
gBrowser.selectedBrowser.contentWindow.applicationCache.oncached = function() {
|
||||
executeSoon(function() {
|
||||
// We got cached - now we should have provoked the quota warning.
|
||||
let notification = PopupNotifications.getNotification('offline-app-usage');
|
||||
ok(notification, "have offline-app-usage notification");
|
||||
// select the default action - this should cause the preferences
|
||||
// window to open - which we track either via a window watcher (for
|
||||
// the window-based prefs) or via an "Initialized" event (for
|
||||
// in-content prefs.)
|
||||
if (Services.prefs.getBoolPref("browser.preferences.inContent")) {
|
||||
// Bug 881576 - ensure this works with inContent prefs.
|
||||
todo(false, "Bug 881576 - this test needs to be updated for inContent prefs");
|
||||
} else {
|
||||
Services.ww.registerNotification(function wwobserver(aSubject, aTopic, aData) {
|
||||
if (aTopic != "domwindowopened")
|
||||
return;
|
||||
Services.ww.unregisterNotification(wwobserver);
|
||||
checkPreferences(aSubject);
|
||||
});
|
||||
PopupNotifications.panel.firstElementChild.button.click();
|
||||
}
|
||||
});
|
||||
};
|
||||
Services.prefs.setIntPref("offline-apps.quota.warn", 1);
|
||||
|
||||
// Click the notification panel's "Allow" button. This should kick
|
||||
// off updates which will call our oncached handler above.
|
||||
PopupNotifications.panel.firstElementChild.button.click();
|
||||
}, true);
|
||||
|
||||
gBrowser.contentWindow.location = URL;
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
CACHE MANIFEST
|
||||
# Any copyright is dedicated to the Public Domain.
|
||||
# http://creativecommons.org/publicdomain/zero/1.0/
|
||||
|
||||
# store a "large" file so an "over quota warning" will be issued - any file
|
||||
# larger than 1kb and in '_BROWSER_FILES' should be right...
|
||||
title_test.svg
|
|
@ -0,0 +1,9 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html manifest="offlineQuotaNotification.cacheManifest">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test offline app quota notification</title>
|
||||
<!-- Any copyright is dedicated to the Public Domain.
|
||||
- http://creativecommons.org/publicdomain/zero/1.0/ -->
|
||||
</head>
|
||||
</html>
|
|
@ -1392,7 +1392,7 @@ DocumentWalker.prototype = {
|
|||
return;
|
||||
if (node.contentDocument) {
|
||||
return this._reparentWalker(node.contentDocument);
|
||||
} else if (node instanceof nodeDocument(node).defaultView.GetSVGDocument) {
|
||||
} else if (node.getSVGDocument) {
|
||||
return this._reparentWalker(node.getSVGDocument());
|
||||
}
|
||||
return this.walker.firstChild();
|
||||
|
@ -1405,7 +1405,7 @@ DocumentWalker.prototype = {
|
|||
return;
|
||||
if (node.contentDocument) {
|
||||
return this._reparentWalker(node.contentDocument);
|
||||
} else if (node instanceof nodeDocument(node).defaultView.GetSVGDocument) {
|
||||
} else if (node.getSVGDocument) {
|
||||
return this._reparentWalker(node.getSVGDocument());
|
||||
}
|
||||
return this.walker.lastChild();
|
||||
|
|
|
@ -64,7 +64,7 @@ DOMHelpers.prototype = {
|
|||
return null;
|
||||
}
|
||||
|
||||
if (node instanceof this.window.GetSVGDocument) {
|
||||
if (node.getSVGDocument) {
|
||||
let svgDocument = node.getSVGDocument();
|
||||
if (svgDocument) {
|
||||
// then the node is a frame
|
||||
|
|
|
@ -1214,7 +1214,8 @@ toolbar[iconsize="small"] #webrtc-status-button {
|
|||
|
||||
.popup-notification-icon[popupid="indexedDB-permissions-prompt"],
|
||||
.popup-notification-icon[popupid="indexedDB-quota-prompt"],
|
||||
.popup-notification-icon[popupid*="offline-app-requested"] {
|
||||
.popup-notification-icon[popupid*="offline-app-requested"],
|
||||
.popup-notification-icon[popupid="offline-app-usage"] {
|
||||
list-style-image: url(chrome://global/skin/icons/question-64.png);
|
||||
}
|
||||
|
||||
|
|
|
@ -3296,7 +3296,8 @@ toolbarbutton.chevron > .toolbarbutton-menu-dropmarker {
|
|||
|
||||
.popup-notification-icon[popupid="indexedDB-permissions-prompt"],
|
||||
.popup-notification-icon[popupid="indexedDB-quota-prompt"],
|
||||
.popup-notification-icon[popupid*="offline-app-requested"] {
|
||||
.popup-notification-icon[popupid*="offline-app-requested"],
|
||||
.popup-notification-icon[popupid="offline-app-usage"] {
|
||||
list-style-image: url(chrome://global/skin/icons/question-64.png);
|
||||
}
|
||||
|
||||
|
|
|
@ -2455,7 +2455,8 @@ toolbarbutton.bookmark-item[dragover="true"][open="true"] {
|
|||
|
||||
.popup-notification-icon[popupid="indexedDB-permissions-prompt"],
|
||||
.popup-notification-icon[popupid="indexedDB-quota-prompt"],
|
||||
.popup-notification-icon[popupid*="offline-app-requested"] {
|
||||
.popup-notification-icon[popupid*="offline-app-requested"],
|
||||
.popup-notification-icon[popupid="offline-app-usage"] {
|
||||
list-style-image: url(chrome://global/skin/icons/question-64.png);
|
||||
}
|
||||
|
||||
|
|
|
@ -9363,6 +9363,8 @@ nsIDocument::CaretPositionFromPoint(float aX, float aY)
|
|||
nscoord y = nsPresContext::CSSPixelsToAppUnits(aY);
|
||||
nsPoint pt(x, y);
|
||||
|
||||
FlushPendingNotifications(Flush_Layout);
|
||||
|
||||
nsIPresShell *ps = GetShell();
|
||||
if (!ps) {
|
||||
return nullptr;
|
||||
|
|
|
@ -37,9 +37,8 @@ NS_IMPL_RELEASE_INHERITED(HTMLIFrameElement, Element)
|
|||
// QueryInterface implementation for HTMLIFrameElement
|
||||
NS_INTERFACE_TABLE_HEAD(HTMLIFrameElement)
|
||||
NS_HTML_CONTENT_INTERFACES(nsGenericHTMLFrameElement)
|
||||
NS_INTERFACE_TABLE_INHERITED2(HTMLIFrameElement,
|
||||
nsIDOMHTMLIFrameElement,
|
||||
nsIDOMGetSVGDocument)
|
||||
NS_INTERFACE_TABLE_INHERITED1(HTMLIFrameElement,
|
||||
nsIDOMHTMLIFrameElement)
|
||||
NS_INTERFACE_TABLE_TO_MAP_SEGUE
|
||||
NS_ELEMENT_INTERFACE_MAP_END
|
||||
|
||||
|
@ -82,12 +81,6 @@ HTMLIFrameElement::GetContentWindow(nsIDOMWindow** aContentWindow)
|
|||
return nsGenericHTMLFrameElement::GetContentWindow(aContentWindow);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLIFrameElement::GetSVGDocument(nsIDOMDocument **aResult)
|
||||
{
|
||||
return GetContentDocument(aResult);
|
||||
}
|
||||
|
||||
bool
|
||||
HTMLIFrameElement::ParseAttribute(int32_t aNamespaceID,
|
||||
nsIAtom* aAttribute,
|
||||
|
|
|
@ -9,14 +9,12 @@
|
|||
#include "mozilla/Attributes.h"
|
||||
#include "nsGenericHTMLFrameElement.h"
|
||||
#include "nsIDOMHTMLIFrameElement.h"
|
||||
#include "nsIDOMGetSVGDocument.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class HTMLIFrameElement MOZ_FINAL : public nsGenericHTMLFrameElement
|
||||
, public nsIDOMHTMLIFrameElement
|
||||
, public nsIDOMGetSVGDocument
|
||||
{
|
||||
public:
|
||||
HTMLIFrameElement(already_AddRefed<nsINodeInfo> aNodeInfo,
|
||||
|
@ -40,9 +38,6 @@ public:
|
|||
// nsIDOMHTMLIFrameElement
|
||||
NS_DECL_NSIDOMHTMLIFRAMEELEMENT
|
||||
|
||||
// nsIDOMGetSVGDocument
|
||||
NS_DECL_NSIDOMGETSVGDOCUMENT
|
||||
|
||||
// nsIContent
|
||||
virtual bool ParseAttribute(int32_t aNamespaceID,
|
||||
nsIAtom* aAttribute,
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#include "nsIDocument.h"
|
||||
#include "nsIPluginDocument.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMSVGDocument.h"
|
||||
#include "nsFormSubmission.h"
|
||||
#include "nsIObjectFrame.h"
|
||||
#include "nsNPAPIPluginInstance.h"
|
||||
|
@ -81,7 +80,7 @@ NS_IMPL_RELEASE_INHERITED(HTMLObjectElement, Element)
|
|||
|
||||
NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(HTMLObjectElement)
|
||||
NS_HTML_CONTENT_INTERFACES(nsGenericHTMLFormElement)
|
||||
NS_INTERFACE_TABLE_INHERITED12(HTMLObjectElement,
|
||||
NS_INTERFACE_TABLE_INHERITED11(HTMLObjectElement,
|
||||
nsIDOMHTMLObjectElement,
|
||||
imgINotificationObserver,
|
||||
nsIRequestObserver,
|
||||
|
@ -92,8 +91,7 @@ NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(HTMLObjectElement)
|
|||
imgIOnloadBlocker,
|
||||
nsIInterfaceRequestor,
|
||||
nsIChannelEventSink,
|
||||
nsIConstraintValidation,
|
||||
nsIDOMGetSVGDocument)
|
||||
nsIConstraintValidation)
|
||||
NS_INTERFACE_TABLE_TO_MAP_SEGUE
|
||||
NS_ELEMENT_INTERFACE_MAP_END
|
||||
|
||||
|
@ -350,12 +348,6 @@ HTMLObjectElement::GetContentWindow()
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLObjectElement::GetSVGDocument(nsIDOMDocument **aResult)
|
||||
{
|
||||
return GetContentDocument(aResult);
|
||||
}
|
||||
|
||||
bool
|
||||
HTMLObjectElement::ParseAttribute(int32_t aNamespaceID,
|
||||
nsIAtom *aAttribute,
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include "nsObjectLoadingContent.h"
|
||||
#include "nsIDOMHTMLObjectElement.h"
|
||||
#include "nsIConstraintValidation.h"
|
||||
#include "nsIDOMGetSVGDocument.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -21,7 +20,6 @@ class HTMLObjectElement MOZ_FINAL : public nsGenericHTMLFormElement
|
|||
, public nsObjectLoadingContent
|
||||
, public nsIDOMHTMLObjectElement
|
||||
, public nsIConstraintValidation
|
||||
, public nsIDOMGetSVGDocument
|
||||
{
|
||||
public:
|
||||
HTMLObjectElement(already_AddRefed<nsINodeInfo> aNodeInfo,
|
||||
|
@ -45,9 +43,6 @@ public:
|
|||
// nsIDOMHTMLObjectElement
|
||||
NS_DECL_NSIDOMHTMLOBJECTELEMENT
|
||||
|
||||
// nsIDOMGetSVGDocument
|
||||
NS_DECL_NSIDOMGETSVGDOCUMENT
|
||||
|
||||
virtual nsresult BindToTree(nsIDocument *aDocument, nsIContent *aParent,
|
||||
nsIContent *aBindingParent,
|
||||
bool aCompileEventHandlers) MOZ_OVERRIDE;
|
||||
|
|
|
@ -107,7 +107,6 @@ NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(HTMLSharedObjectElement)
|
|||
NS_INTERFACE_TABLE_TO_MAP_SEGUE
|
||||
NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLAppletElement, applet)
|
||||
NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLEmbedElement, embed)
|
||||
NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMGetSVGDocument, embed)
|
||||
NS_ELEMENT_INTERFACE_MAP_END
|
||||
|
||||
NS_IMPL_ELEMENT_CLONE(HTMLSharedObjectElement)
|
||||
|
@ -224,27 +223,7 @@ NS_IMPL_STRING_ATTR(HTMLSharedObjectElement, Width, width)
|
|||
int32_t
|
||||
HTMLSharedObjectElement::TabIndexDefault()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLSharedObjectElement::GetSVGDocument(nsIDOMDocument **aResult)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
|
||||
*aResult = nullptr;
|
||||
|
||||
if (!IsInDoc()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// XXXbz should this use GetCurrentDoc()? sXBL/XBL2 issue!
|
||||
nsIDocument *sub_doc = OwnerDoc()->GetSubDocumentFor(this);
|
||||
if (!sub_doc) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return CallQueryInterface(sub_doc, aResult);
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "nsError.h"
|
||||
#include "nsIDOMHTMLAppletElement.h"
|
||||
#include "nsIDOMHTMLEmbedElement.h"
|
||||
#include "nsIDOMGetSVGDocument.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -23,7 +22,6 @@ class HTMLSharedObjectElement : public nsGenericHTMLElement
|
|||
, public nsObjectLoadingContent
|
||||
, public nsIDOMHTMLAppletElement
|
||||
, public nsIDOMHTMLEmbedElement
|
||||
, public nsIDOMGetSVGDocument
|
||||
{
|
||||
public:
|
||||
HTMLSharedObjectElement(already_AddRefed<nsINodeInfo> aNodeInfo,
|
||||
|
@ -56,9 +54,6 @@ public:
|
|||
NS_IMETHOD GetType(nsAString &aType) MOZ_OVERRIDE;
|
||||
NS_IMETHOD SetType(const nsAString &aType) MOZ_OVERRIDE;
|
||||
|
||||
// nsIDOMGetSVGDocument
|
||||
NS_DECL_NSIDOMGETSVGDOCUMENT
|
||||
|
||||
virtual nsresult BindToTree(nsIDocument *aDocument, nsIContent *aParent,
|
||||
nsIContent *aBindingParent,
|
||||
bool aCompileEventHandlers) MOZ_OVERRIDE;
|
||||
|
|
|
@ -617,6 +617,9 @@ UndoMutationObserver::IsManagerForMutation(nsIContent* aContent)
|
|||
nsIDocument* doc = aContent->OwnerDoc();
|
||||
NS_ENSURE_TRUE(doc, false);
|
||||
undoManager = doc->GetUndoManager();
|
||||
// The document will not have an undoManager if the
|
||||
// documentElement is removed.
|
||||
NS_ENSURE_TRUE(undoManager, false);
|
||||
}
|
||||
|
||||
// Check if the nsITransactionManager is the same for both the
|
||||
|
|
|
@ -273,6 +273,7 @@ MOCHITEST_FILES = \
|
|||
test_bug827426.html \
|
||||
test_bug838582.html \
|
||||
test_bug839913.html \
|
||||
test_bug840877.html \
|
||||
test_bug841466.html \
|
||||
test_iframe_sandbox_inheritance.html \
|
||||
file_iframe_sandbox_a_if1.html \
|
||||
|
|
|
@ -135,7 +135,7 @@ HTML_TAG("div", "Div");
|
|||
HTML_TAG("dl", "DList");
|
||||
HTML_TAG("dt", "");
|
||||
HTML_TAG("em", "");
|
||||
HTML_TAG("embed", "Embed", [ "nsIDOMGetSVGDocument" ], objectIfaces);
|
||||
HTML_TAG("embed", "Embed", [], objectIfaces);
|
||||
HTML_TAG("fieldset", "FieldSet");
|
||||
HTML_TAG("figcaption", "")
|
||||
HTML_TAG("figure", "")
|
||||
|
@ -156,7 +156,7 @@ HTML_TAG("hgroup", "")
|
|||
HTML_TAG("hr", "HR");
|
||||
HTML_TAG("html", "Html");
|
||||
HTML_TAG("i", "");
|
||||
HTML_TAG("iframe", "IFrame", [ "nsIDOMGetSVGDocument", "nsIDOMMozBrowserFrame" ],
|
||||
HTML_TAG("iframe", "IFrame", [ "nsIDOMMozBrowserFrame" ],
|
||||
[ "nsIFrameLoaderOwner" ]);
|
||||
HTML_TAG("image", "");
|
||||
HTML_TAG("img", "Image", [ "nsIImageLoadingContent" ], []);
|
||||
|
@ -184,7 +184,7 @@ HTML_TAG("nobr", "");
|
|||
HTML_TAG("noembed", "");
|
||||
HTML_TAG("noframes", "");
|
||||
HTML_TAG("noscript", "");
|
||||
HTML_TAG("object", "Object", [ "nsIDOMGetSVGDocument" ],
|
||||
HTML_TAG("object", "Object", [],
|
||||
objectIfaces.concat([ "nsIImageLoadingContent" ]));
|
||||
HTML_TAG("ol", "OList");
|
||||
HTML_TAG("optgroup", "OptGroup");
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=840877
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 840877</title>
|
||||
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=840877">Mozilla Bug 840877</a>
|
||||
<p id="display"></p>
|
||||
<div id="content"></div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
/** Test for Bug 840877 **/
|
||||
|
||||
var root = document.documentElement;
|
||||
var undoMan = document.undoManager;
|
||||
var newChild = document.createElement("div");
|
||||
// Removing the documentElement from the document removes the element from the document's undo scope.
|
||||
document.removeChild(root);
|
||||
undoMan.transact({ executeAutomatic: function() { root.appendChild(newChild); }}, true);
|
||||
// Append the document element back so that we don't break mochitests.
|
||||
document.appendChild(root);
|
||||
// Element appended by executeAutomatic should be a child of the documentElement.
|
||||
is(root.childNodes[root.childNodes.length - 1], newChild, "Document element should have child appened by transaction.");
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -94,13 +94,14 @@ static const uint8_t gZeroChannel[MAX_AUDIO_SAMPLE_SIZE*AUDIO_PROCESSING_FRAMES]
|
|||
void
|
||||
DownmixAndInterleave(const nsTArray<const void*>& aChannelData,
|
||||
AudioSampleFormat aSourceFormat, int32_t aDuration,
|
||||
float aVolume, int32_t aOutputChannels,
|
||||
float aVolume, uint32_t aOutputChannels,
|
||||
AudioDataValue* aOutput)
|
||||
{
|
||||
nsAutoTArray<const void*,GUESS_AUDIO_CHANNELS> channelData;
|
||||
nsAutoTArray<float,AUDIO_PROCESSING_FRAMES*GUESS_AUDIO_CHANNELS> downmixConversionBuffer;
|
||||
nsAutoTArray<float,AUDIO_PROCESSING_FRAMES*GUESS_AUDIO_CHANNELS> downmixOutputBuffer;
|
||||
|
||||
channelData.SetLength(aChannelData.Length());
|
||||
if (aSourceFormat != AUDIO_FORMAT_FLOAT32) {
|
||||
NS_ASSERTION(aSourceFormat == AUDIO_FORMAT_S16, "unknown format");
|
||||
downmixConversionBuffer.SetLength(aDuration*aChannelData.Length());
|
||||
|
@ -127,8 +128,10 @@ DownmixAndInterleave(const nsTArray<const void*>& aChannelData,
|
|||
outputChannelData[i] = outputChannelBuffers[i] =
|
||||
downmixOutputBuffer.Elements() + aDuration*i;
|
||||
}
|
||||
AudioChannelsDownMix(channelData, outputChannelBuffers.Elements(),
|
||||
aOutputChannels, aDuration);
|
||||
if (channelData.Length() > aOutputChannels) {
|
||||
AudioChannelsDownMix(channelData, outputChannelBuffers.Elements(),
|
||||
aOutputChannels, aDuration);
|
||||
}
|
||||
InterleaveAndConvertBuffer(outputChannelData.Elements(), AUDIO_FORMAT_FLOAT32,
|
||||
aDuration, aVolume, aOutputChannels, aOutput);
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ void InterleaveAndConvertBuffer(const void** aSourceChannels,
|
|||
*/
|
||||
void DownmixAndInterleave(const nsTArray<const void*>& aChannelData,
|
||||
AudioSampleFormat aSourceFormat, int32_t aDuration,
|
||||
float aVolume, int32_t aOutputChannels,
|
||||
float aVolume, uint32_t aOutputChannels,
|
||||
AudioDataValue* aOutput);
|
||||
|
||||
/**
|
||||
|
|
|
@ -207,7 +207,7 @@ WebVTTLoadListener::OnParsedCue(webvtt_cue* aCue)
|
|||
mElement->mTrack->AddCue(*textTrackCue);
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
WebVTTLoadListener::OnReportError(uint32_t aLine, uint32_t aCol,
|
||||
webvtt_error aError)
|
||||
{
|
||||
|
@ -225,6 +225,19 @@ WebVTTLoadListener::OnReportError(uint32_t aLine, uint32_t aCol,
|
|||
|
||||
LOG("error: %s(%d:%d) - %s\n", file.get(), aLine, aCol, error);
|
||||
#endif
|
||||
|
||||
switch(aError) {
|
||||
// Errors which should result in dropped cues
|
||||
// if the return value is negative:
|
||||
case WEBVTT_MALFORMED_TIMESTAMP:
|
||||
return -1;
|
||||
|
||||
// By default, we can safely ignore other errors
|
||||
// or else parsing the document will be aborted regardless
|
||||
// of the return value.
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void WEBVTT_CALLBACK
|
||||
|
@ -240,8 +253,7 @@ WebVTTLoadListener::OnReportErrorWebVTTCallBack(void* aUserData, uint32_t aLine,
|
|||
webvtt_error aError)
|
||||
{
|
||||
WebVTTLoadListener* self = static_cast<WebVTTLoadListener*>(aUserData);
|
||||
self->OnReportError(aLine, aCol, aError);
|
||||
return WEBVTT_SUCCESS;
|
||||
return self->OnReportError(aLine, aCol, aError);
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
|
|
|
@ -61,7 +61,7 @@ public:
|
|||
WebVTTLoadListener(HTMLTrackElement* aElement);
|
||||
~WebVTTLoadListener();
|
||||
void OnParsedCue(webvtt_cue* aCue);
|
||||
void OnReportError(uint32_t aLine, uint32_t aCol, webvtt_error aError);
|
||||
int OnReportError(uint32_t aLine, uint32_t aCol, webvtt_error aError);
|
||||
// Loads the libwebvtt parser. Must call this function in order to the
|
||||
// WebVTTLoadListener to be ready to accept data.
|
||||
nsresult LoadResource();
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
<script>
|
||||
o1 = new window.AudioContext(2, 16, 44100);
|
||||
o2 = o1.createBufferSource();
|
||||
o12 = o1.createBiquadFilter();
|
||||
o1.destination.channelCountMode = 'max';
|
||||
o2.buffer = function(){
|
||||
var buffer = o1.createBuffer(2, 326, 77632);
|
||||
for(var c=0; c<2; c++) {
|
||||
for(var i=0; i<326; i++) {
|
||||
buffer.getChannelData(c)[i] = -1;
|
||||
}
|
||||
}
|
||||
return buffer;
|
||||
}();
|
||||
o2.connect(o1.destination);
|
||||
o2.buffer = function(){
|
||||
var buffer = o1.createBuffer(3, 405, o1.sampleRate);
|
||||
for(var c=0; c<3; c++) {
|
||||
for(var i=0; i<405; i++) {
|
||||
buffer.getChannelData(c)[i] = 1;
|
||||
}
|
||||
}
|
||||
return buffer;
|
||||
}();
|
||||
</script>
|
|
@ -45,3 +45,4 @@ load 880342-2.html
|
|||
load 880384.html
|
||||
load 880404.html
|
||||
load 880724.html
|
||||
load 881775.html
|
||||
|
|
|
@ -48,7 +48,6 @@
|
|||
#include "nsIScriptContext.h"
|
||||
#include "nsIScriptRuntime.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIScriptGlobalObjectOwner.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "mozilla/css/StyleRule.h"
|
||||
#include "nsIStyleSheet.h"
|
||||
|
@ -2544,7 +2543,7 @@ nsXULPrototypeScript::Compile(const PRUnichar* aText,
|
|||
nsIURI* aURI,
|
||||
uint32_t aLineNo,
|
||||
nsIDocument* aDocument,
|
||||
nsIScriptGlobalObjectOwner* aGlobalOwner)
|
||||
nsIScriptGlobalObject* aGlobal)
|
||||
{
|
||||
// We'll compile the script using the prototype document's special
|
||||
// script object as the parent. This ensures that we won't end up
|
||||
|
@ -2556,21 +2555,16 @@ nsXULPrototypeScript::Compile(const PRUnichar* aText,
|
|||
// our script object would reference the first document, and the
|
||||
// first document would indirectly reference the prototype document
|
||||
// because it keeps the prototype cache alive. Circularity!
|
||||
nsresult rv;
|
||||
NS_ASSERTION(aGlobal, "prototype doc has no script global");
|
||||
if (!aGlobal) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
// Use the prototype document's special context
|
||||
nsIScriptContext *context;
|
||||
|
||||
{
|
||||
nsIScriptGlobalObject* global = aGlobalOwner->GetScriptGlobalObject();
|
||||
NS_ASSERTION(global != nullptr, "prototype doc has no script global");
|
||||
if (! global)
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
context = global->GetScriptContext();
|
||||
NS_ASSERTION(context != nullptr, "no context for script global");
|
||||
if (! context)
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
nsIScriptContext *context = aGlobal->GetScriptContext();
|
||||
NS_ASSERTION(context, "no context for script global");
|
||||
if (! context) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
nsAutoCString urlspec;
|
||||
|
@ -2585,20 +2579,16 @@ nsXULPrototypeScript::Compile(const PRUnichar* aText,
|
|||
// source from the files on demand.
|
||||
bool saveSource = !mOutOfLine;
|
||||
|
||||
rv = context->CompileScript(aText,
|
||||
aTextLength,
|
||||
// Use the enclosing document's principal
|
||||
// XXX is this right? or should we use the
|
||||
// protodoc's?
|
||||
// If we start using the protodoc's, make sure
|
||||
// the DowngradePrincipalIfNeeded stuff in
|
||||
// XULDocument::OnStreamComplete still works!
|
||||
aDocument->NodePrincipal(),
|
||||
urlspec.get(),
|
||||
aLineNo,
|
||||
mLangVersion,
|
||||
&newScriptObject,
|
||||
saveSource);
|
||||
nsresult rv = context->CompileScript(aText, aTextLength,
|
||||
// Use the enclosing document's principal
|
||||
// XXX is this right? or should we use the
|
||||
// protodoc's?
|
||||
// If we start using the protodoc's, make sure
|
||||
// the DowngradePrincipalIfNeeded stuff in
|
||||
// XULDocument::OnStreamComplete still works!
|
||||
aDocument->NodePrincipal(),
|
||||
urlspec.get(), aLineNo, mLangVersion,
|
||||
&newScriptObject, saveSource);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ class nsIDocShell;
|
|||
|
||||
class nsIObjectInputStream;
|
||||
class nsIObjectOutputStream;
|
||||
class nsIScriptGlobalObjectOwner;
|
||||
class nsIScriptGlobalObject;
|
||||
class nsXULPrototypeNode;
|
||||
typedef nsTArray<nsRefPtr<nsXULPrototypeNode> > nsPrototypeArray;
|
||||
|
||||
|
@ -231,7 +231,7 @@ public:
|
|||
nsresult Compile(const PRUnichar* aText, int32_t aTextLength,
|
||||
nsIURI* aURI, uint32_t aLineNo,
|
||||
nsIDocument* aDocument,
|
||||
nsIScriptGlobalObjectOwner* aGlobalOwner);
|
||||
nsIScriptGlobalObject* aGlobal);
|
||||
|
||||
void UnlinkJSObjects();
|
||||
|
||||
|
|
|
@ -12,13 +12,11 @@
|
|||
|
||||
class nsIXULTemplateBuilder;
|
||||
class nsIContent;
|
||||
class nsIScriptGlobalObjectOwner;
|
||||
|
||||
|
||||
// 3e872e97-b678-418e-a7e3-41b8305d4e75
|
||||
// 81ba4be5-6cc5-478a-9b08-b3e7ed524455
|
||||
#define NS_IXULDOCUMENT_IID \
|
||||
{ 0x3e872e97, 0xb678, 0x418e, \
|
||||
{ 0xa7, 0xe3, 0x41, 0xb8, 0x30, 0x5d, 0x4e, 0x75 } }
|
||||
{0x81ba4be5, 0x6cc5, 0x478a, {0x9b, 0x08, 0xb3, 0xe7, 0xed, 0x52, 0x44, 0x55}}
|
||||
|
||||
|
||||
/*
|
||||
|
@ -38,11 +36,6 @@ public:
|
|||
*/
|
||||
virtual void GetElementsForID(const nsAString& aID, nsCOMArray<nsIContent>& aElements) = 0;
|
||||
|
||||
/**
|
||||
* Get the nsIScriptGlobalObjectOwner for this document.
|
||||
*/
|
||||
NS_IMETHOD GetScriptGlobalObjectOwner(nsIScriptGlobalObjectOwner** aGlobalOwner) = 0;
|
||||
|
||||
/**
|
||||
* Notify the XUL document that a subtree has been added
|
||||
*/
|
||||
|
|
|
@ -1211,13 +1211,6 @@ XULDocument::ResolveForwardReferences()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
XULDocument::GetScriptGlobalObjectOwner(nsIScriptGlobalObjectOwner** aGlobalOwner)
|
||||
{
|
||||
NS_IF_ADDREF(*aGlobalOwner = mMasterPrototype);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
//
|
||||
// nsIDOMDocument interface
|
||||
|
@ -3538,7 +3531,8 @@ XULDocument::OnStreamComplete(nsIStreamLoader* aLoader,
|
|||
EmptyString(), this, stringStr);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = scriptProto->Compile(stringStr.get(), stringStr.Length(),
|
||||
uri, 1, this, mCurrentPrototype);
|
||||
uri, 1, this,
|
||||
mCurrentPrototype->GetScriptGlobalObject());
|
||||
}
|
||||
|
||||
aStatus = rv;
|
||||
|
|
|
@ -126,7 +126,6 @@ public:
|
|||
virtual void GetElementsForID(const nsAString& aID,
|
||||
nsCOMArray<nsIContent>& aElements) MOZ_OVERRIDE;
|
||||
|
||||
NS_IMETHOD GetScriptGlobalObjectOwner(nsIScriptGlobalObjectOwner** aGlobalOwner) MOZ_OVERRIDE;
|
||||
NS_IMETHOD AddSubtreeToDocument(nsIContent* aContent) MOZ_OVERRIDE;
|
||||
NS_IMETHOD RemoveSubtreeFromDocument(nsIContent* aContent) MOZ_OVERRIDE;
|
||||
NS_IMETHOD SetTemplateBuilderFor(nsIContent* aContent,
|
||||
|
|
|
@ -565,7 +565,8 @@ XULContentSinkImpl::HandleEndElement(const PRUnichar *aName)
|
|||
script->mOutOfLine = false;
|
||||
if (doc)
|
||||
script->Compile(mText, mTextLength, mDocumentURL,
|
||||
script->mLineNo, doc, mPrototype);
|
||||
script->mLineNo, doc,
|
||||
mPrototype->GetScriptGlobalObject());
|
||||
}
|
||||
|
||||
FlushText(false);
|
||||
|
|
|
@ -988,9 +988,9 @@ nsJSContext::JSOptionChangedCallback(const char *pref, void *data)
|
|||
|
||||
bool strict = Preferences::GetBool(js_strict_option_str);
|
||||
if (strict)
|
||||
newDefaultJSOptions |= JSOPTION_STRICT;
|
||||
newDefaultJSOptions |= JSOPTION_EXTRA_WARNINGS;
|
||||
else
|
||||
newDefaultJSOptions &= ~JSOPTION_STRICT;
|
||||
newDefaultJSOptions &= ~JSOPTION_EXTRA_WARNINGS;
|
||||
|
||||
// The vanilla GetGlobalObject returns null if a global isn't set up on
|
||||
// the context yet. We can sometimes be call midway through context init,
|
||||
|
@ -1056,9 +1056,9 @@ nsJSContext::JSOptionChangedCallback(const char *pref, void *data)
|
|||
// In debug builds, warnings are enabled in chrome context if
|
||||
// javascript.options.strict.debug is true
|
||||
bool strictDebug = Preferences::GetBool(js_strict_debug_option_str);
|
||||
if (strictDebug && (newDefaultJSOptions & JSOPTION_STRICT) == 0) {
|
||||
if (strictDebug && (newDefaultJSOptions & JSOPTION_EXTRA_WARNINGS) == 0) {
|
||||
if (chromeWindow || !contentWindow)
|
||||
newDefaultJSOptions |= JSOPTION_STRICT;
|
||||
newDefaultJSOptions |= JSOPTION_EXTRA_WARNINGS;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
XPIDL_SOURCES += [
|
||||
'nsIDOMGetSVGDocument.idl',
|
||||
'nsIDOMSVGAnimatedEnum.idl',
|
||||
'nsIDOMSVGAnimatedInteger.idl',
|
||||
'nsIDOMSVGAnimatedLength.idl',
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "domstubs.idl"
|
||||
|
||||
interface nsIDOMSVGDocument;
|
||||
|
||||
[scriptable, uuid(b5d3074c-4f63-4936-bf39-49034efa26a5)]
|
||||
interface nsIDOMGetSVGDocument : nsISupports
|
||||
{
|
||||
nsIDOMDocument getSVGDocument ( );
|
||||
// raises( DOMException );
|
||||
};
|
|
@ -140,7 +140,6 @@ var interfaceNamesInGlobalScope =
|
|||
"GeoPositionCoords",
|
||||
"GeoPositionError",
|
||||
"GeoPositionErrorCallback",
|
||||
"GetSVGDocument",
|
||||
"GetUserMediaErrorCallback",
|
||||
"GetUserMediaSuccessCallback",
|
||||
"GlobalObjectConstructor",
|
||||
|
|
|
@ -36,7 +36,7 @@ partial interface HTMLEmbedElement {
|
|||
};
|
||||
|
||||
partial interface HTMLEmbedElement {
|
||||
// nsIDOMGetSVGDocument
|
||||
// GetSVGDocument
|
||||
Document? getSVGDocument();
|
||||
};
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ partial interface HTMLIFrameElement {
|
|||
};
|
||||
|
||||
partial interface HTMLIFrameElement {
|
||||
// nsIDOMGetSVGDocument
|
||||
// GetSVGDocument
|
||||
Document? getSVGDocument();
|
||||
};
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ partial interface HTMLObjectElement {
|
|||
};
|
||||
|
||||
partial interface HTMLObjectElement {
|
||||
// nsIDOMGetSVGDocument
|
||||
// GetSVGDocument
|
||||
Document? getSVGDocument();
|
||||
};
|
||||
|
||||
|
|
|
@ -285,7 +285,7 @@ LoadJSContextOptions(const char* aPrefName, void* /* aClosure */)
|
|||
// Common options.
|
||||
uint32_t commonOptions = kRequiredJSContextOptions;
|
||||
if (GetWorkerPref<bool>(NS_LITERAL_CSTRING("strict"))) {
|
||||
commonOptions |= JSOPTION_STRICT;
|
||||
commonOptions |= JSOPTION_EXTRA_WARNINGS;
|
||||
}
|
||||
if (GetWorkerPref<bool>(NS_LITERAL_CSTRING("werror"))) {
|
||||
commonOptions |= JSOPTION_WERROR;
|
||||
|
@ -322,7 +322,7 @@ LoadJSContextOptions(const char* aPrefName, void* /* aClosure */)
|
|||
}
|
||||
#ifdef DEBUG
|
||||
if (GetWorkerPref<bool>(NS_LITERAL_CSTRING("strict.debug"))) {
|
||||
chromeOptions |= JSOPTION_STRICT;
|
||||
chromeOptions |= JSOPTION_EXTRA_WARNINGS;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1319,7 +1319,7 @@ class ObjectBox {
|
|||
enum ParseReportKind {
|
||||
ParseError,
|
||||
ParseWarning,
|
||||
ParseStrictWarning,
|
||||
ParseExtraWarning,
|
||||
ParseStrictError
|
||||
};
|
||||
|
||||
|
|
|
@ -350,7 +350,7 @@ Parser<ParseHandler>::reportHelper(ParseReportKind kind, bool strict, uint32_t o
|
|||
result =
|
||||
tokenStream.reportCompileErrorNumberVA(offset, JSREPORT_WARNING, errorNumber, args);
|
||||
break;
|
||||
case ParseStrictWarning:
|
||||
case ParseExtraWarning:
|
||||
result = tokenStream.reportStrictWarningErrorNumberVA(offset, errorNumber, args);
|
||||
break;
|
||||
case ParseStrictError:
|
||||
|
@ -424,10 +424,10 @@ Parser<ParseHandler>::Parser(JSContext *cx, const CompileOptions &options,
|
|||
|
||||
cx->runtime()->activeCompilations++;
|
||||
|
||||
// The Mozilla specific 'strict' option adds extra warnings which are not
|
||||
// generated if functions are parsed lazily. Note that the standard
|
||||
// "use strict" does not inhibit lazy parsing.
|
||||
if (context->hasStrictOption())
|
||||
// The Mozilla specific JSOPTION_EXTRA_WARNINGS option adds extra warnings
|
||||
// which are not generated if functions are parsed lazily. Note that the
|
||||
// standard "use strict" does not inhibit lazy parsing.
|
||||
if (context->hasExtraWarningsOption())
|
||||
handler.disableSyntaxParser();
|
||||
|
||||
tempPoolMark = cx->tempLifoAlloc().mark();
|
||||
|
@ -792,7 +792,7 @@ Parser<ParseHandler>::checkFinalReturn(Node pn)
|
|||
{
|
||||
JS_ASSERT(pc->sc->isFunctionBox());
|
||||
return HasFinalReturn(pn) == ENDS_IN_RETURN ||
|
||||
reportBadReturn(pn, ParseStrictWarning,
|
||||
reportBadReturn(pn, ParseExtraWarning,
|
||||
JSMSG_NO_RETURN_VALUE, JSMSG_ANON_NO_RETURN_VALUE);
|
||||
}
|
||||
|
||||
|
@ -1060,7 +1060,7 @@ Parser<ParseHandler>::functionBody(FunctionSyntaxKind kind, FunctionBodyType typ
|
|||
}
|
||||
|
||||
/* Check for falling off the end of a function that returns a value. */
|
||||
if (context->hasStrictOption() && pc->funHasReturnExpr && !checkFinalReturn(pn))
|
||||
if (context->hasExtraWarningsOption() && pc->funHasReturnExpr && !checkFinalReturn(pn))
|
||||
return null();
|
||||
|
||||
if (kind != Arrow) {
|
||||
|
@ -1716,10 +1716,10 @@ Parser<FullParseHandler>::checkFunctionDefinition(HandlePropertyName funName,
|
|||
JS_ASSERT(!dn->isUsed());
|
||||
JS_ASSERT(dn->isDefn());
|
||||
|
||||
if (context->hasStrictOption() || dn->kind() == Definition::CONST) {
|
||||
if (context->hasExtraWarningsOption() || dn->kind() == Definition::CONST) {
|
||||
JSAutoByteString name;
|
||||
ParseReportKind reporter = (dn->kind() != Definition::CONST)
|
||||
? ParseStrictWarning
|
||||
? ParseExtraWarning
|
||||
: ParseError;
|
||||
if (!js_AtomToPrintableString(context, funName, &name) ||
|
||||
!report(reporter, false, NULL, JSMSG_REDECLARED_VAR,
|
||||
|
@ -2610,7 +2610,7 @@ Parser<ParseHandler>::condition()
|
|||
|
||||
/* Check for (a = b) and warn about possible (a == b) mistype. */
|
||||
if (handler.isOperationWithoutParens(pn, PNK_ASSIGN) &&
|
||||
!report(ParseStrictWarning, false, null(), JSMSG_EQUAL_AS_ASSIGN))
|
||||
!report(ParseExtraWarning, false, null(), JSMSG_EQUAL_AS_ASSIGN))
|
||||
{
|
||||
return null();
|
||||
}
|
||||
|
@ -2884,7 +2884,7 @@ Parser<ParseHandler>::bindVarOrConst(JSContext *cx, BindData<ParseHandler> *data
|
|||
parser->report(ParseError, false, pn, JSMSG_REDECLARED_PARAM, bytes.ptr());
|
||||
return false;
|
||||
}
|
||||
if (!parser->report(ParseStrictWarning, false, pn, JSMSG_VAR_HIDES_ARG, bytes.ptr()))
|
||||
if (!parser->report(ParseExtraWarning, false, pn, JSMSG_VAR_HIDES_ARG, bytes.ptr()))
|
||||
return false;
|
||||
} else {
|
||||
bool error = (isConstDecl ||
|
||||
|
@ -2892,12 +2892,12 @@ Parser<ParseHandler>::bindVarOrConst(JSContext *cx, BindData<ParseHandler> *data
|
|||
(dn_kind == Definition::LET &&
|
||||
(stmt->type != STMT_CATCH || OuterLet(pc, stmt, name))));
|
||||
|
||||
if (cx->hasStrictOption()
|
||||
if (cx->hasExtraWarningsOption()
|
||||
? data->op != JSOP_DEFVAR || dn_kind != Definition::VAR
|
||||
: error)
|
||||
{
|
||||
JSAutoByteString bytes;
|
||||
ParseReportKind reporter = error ? ParseError : ParseStrictWarning;
|
||||
ParseReportKind reporter = error ? ParseError : ParseExtraWarning;
|
||||
if (!js_AtomToPrintableString(cx, name, &bytes) ||
|
||||
!parser->report(reporter, false, pn, JSMSG_REDECLARED_VAR,
|
||||
Definition::kindString(dn_kind), bytes.ptr()))
|
||||
|
@ -3288,8 +3288,8 @@ Parser<ParseHandler>::returnOrYield(bool useAssignExpr)
|
|||
return null();
|
||||
}
|
||||
|
||||
if (context->hasStrictOption() && pc->funHasReturnExpr && pc->funHasReturnVoid &&
|
||||
!reportBadReturn(pn, ParseStrictWarning,
|
||||
if (context->hasExtraWarningsOption() && pc->funHasReturnExpr && pc->funHasReturnVoid &&
|
||||
!reportBadReturn(pn, ParseExtraWarning,
|
||||
JSMSG_NO_RETURN_VALUE, JSMSG_ANON_NO_RETURN_VALUE))
|
||||
{
|
||||
return null();
|
||||
|
@ -4320,10 +4320,10 @@ Parser<ParseHandler>::withStatement()
|
|||
uint32_t begin = tokenStream.currentToken().pos.begin;
|
||||
|
||||
// In most cases, we want the constructs forbidden in strict mode code to be
|
||||
// a subset of those that JSOPTION_STRICT warns about, and we should use
|
||||
// reportStrictModeError. However, 'with' is the sole instance of a
|
||||
// a subset of those that JSOPTION_EXTRA_WARNINGS warns about, and we should
|
||||
// use reportStrictModeError. However, 'with' is the sole instance of a
|
||||
// construct that is forbidden in strict mode code, but doesn't even merit a
|
||||
// warning under JSOPTION_STRICT. See
|
||||
// warning under JSOPTION_EXTRA_WARNINGS. See
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=514576#c1.
|
||||
if (pc->sc->strict && !report(ParseStrictError, true, null(), JSMSG_STRICT_CODE_WITH))
|
||||
return null();
|
||||
|
@ -4571,7 +4571,7 @@ Parser<ParseHandler>::statement()
|
|||
return null();
|
||||
|
||||
if (handler.isEmptySemicolon(thenBranch) &&
|
||||
!report(ParseStrictWarning, false, null(), JSMSG_EMPTY_CONSEQUENT))
|
||||
!report(ParseExtraWarning, false, null(), JSMSG_EMPTY_CONSEQUENT))
|
||||
{
|
||||
return null();
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ SharedContext::SharedContext(JSContext *cx, bool strict)
|
|||
inline bool
|
||||
SharedContext::needStrictChecks()
|
||||
{
|
||||
return context->hasStrictOption() || strict;
|
||||
return context->hasExtraWarningsOption() || strict;
|
||||
}
|
||||
|
||||
inline GlobalSharedContext *
|
||||
|
|
|
@ -168,7 +168,7 @@ class SharedContext
|
|||
void setBindingsAccessedDynamically() { anyCxFlags.bindingsAccessedDynamically = true; }
|
||||
void setHasDebuggerStatement() { anyCxFlags.hasDebuggerStatement = true; }
|
||||
|
||||
// JSOPTION_STRICT warnings or strict mode errors.
|
||||
// JSOPTION_EXTRA_WARNINGS warnings or strict mode errors.
|
||||
inline bool needStrictChecks();
|
||||
};
|
||||
|
||||
|
|
|
@ -605,7 +605,7 @@ TokenStream::reportStrictModeErrorNumberVA(uint32_t offset, bool strictMode, uns
|
|||
unsigned flags = JSREPORT_STRICT;
|
||||
if (strictMode)
|
||||
flags |= JSREPORT_ERROR;
|
||||
else if (cx->hasStrictOption())
|
||||
else if (cx->hasExtraWarningsOption())
|
||||
flags |= JSREPORT_WARNING;
|
||||
else
|
||||
return true;
|
||||
|
@ -784,7 +784,7 @@ TokenStream::reportWarning(unsigned errorNumber, ...)
|
|||
bool
|
||||
TokenStream::reportStrictWarningErrorNumberVA(uint32_t offset, unsigned errorNumber, va_list args)
|
||||
{
|
||||
if (!cx->hasStrictOption())
|
||||
if (!cx->hasExtraWarningsOption())
|
||||
return true;
|
||||
|
||||
return reportCompileErrorNumberVA(offset, JSREPORT_STRICT|JSREPORT_WARNING, errorNumber, args);
|
||||
|
|
|
@ -6885,10 +6885,16 @@ IonBuilder::jsop_setelem_typed(int arrayType,
|
|||
|
||||
// Store the value.
|
||||
MInstruction *ins;
|
||||
if (expectOOB)
|
||||
if (expectOOB) {
|
||||
ins = MStoreTypedArrayElementHole::New(elements, length, id, toWrite, arrayType);
|
||||
else
|
||||
ins = MStoreTypedArrayElement::New(elements, id, toWrite, arrayType);
|
||||
} else {
|
||||
MStoreTypedArrayElement *store =
|
||||
MStoreTypedArrayElement::New(elements, id, toWrite, arrayType);
|
||||
if (safety == SetElem_Unsafe)
|
||||
store->setRacy();
|
||||
ins = store;
|
||||
}
|
||||
|
||||
current->add(ins);
|
||||
|
||||
if (safety == SetElem_Normal)
|
||||
|
|
|
@ -966,11 +966,12 @@ IonBuilder::inlineUnsafeSetElement(CallInfo &callInfo)
|
|||
MDefinition *id = callInfo.getArg(idxi);
|
||||
MDefinition *elem = callInfo.getArg(elemi);
|
||||
|
||||
if (PropertyWriteNeedsTypeBarrier(cx, current, &obj, NULL, &elem, /* canModify = */ false))
|
||||
return InliningStatus_NotInlined;
|
||||
|
||||
// We can only inline setelem on dense arrays that do not need type
|
||||
// barriers and on typed arrays.
|
||||
int arrayType;
|
||||
if (!ElementAccessIsDenseNative(obj, id) &&
|
||||
if ((!ElementAccessIsDenseNative(obj, id) ||
|
||||
PropertyWriteNeedsTypeBarrier(cx, current, &obj, NULL,
|
||||
&elem, /* canModify = */ false)) &&
|
||||
!ElementAccessIsTypedArray(obj, id, &arrayType))
|
||||
{
|
||||
return InliningStatus_NotInlined;
|
||||
|
@ -1012,8 +1013,7 @@ IonBuilder::inlineUnsafeSetElement(CallInfo &callInfo)
|
|||
}
|
||||
|
||||
bool
|
||||
IonBuilder::inlineUnsafeSetDenseArrayElement(
|
||||
CallInfo &callInfo, uint32_t base)
|
||||
IonBuilder::inlineUnsafeSetDenseArrayElement(CallInfo &callInfo, uint32_t base)
|
||||
{
|
||||
// Note: we do not check the conditions that are asserted as true
|
||||
// in intrinsic_UnsafeSetElement():
|
||||
|
|
|
@ -41,9 +41,7 @@ LIRGeneratorARM::useBoxFixed(LInstruction *lir, size_t n, MDefinition *mir, Regi
|
|||
bool
|
||||
LIRGeneratorARM::lowerConstantDouble(double d, MInstruction *mir)
|
||||
{
|
||||
uint32_t index;
|
||||
LDouble *lir = new LDouble(d);
|
||||
return define(lir, mir);
|
||||
return define(new LDouble(d), mir);
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
options("werror");
|
||||
|
||||
// This construct causes a strict warning, but we shouldn't get one since
|
||||
// JSOPTION_STRICT isn't enabled.
|
||||
// JSOPTION_EXTRA_WARNINGS isn't enabled.
|
||||
var x;
|
||||
eval("if (x = 3) {}");
|
||||
|
|
|
@ -1906,7 +1906,7 @@ JS_StringToVersion(const char *string);
|
|||
* JSOPTION_VAROBJFIX is recommended -- see the comments associated with the
|
||||
* prototypes for JS_ExecuteScript, JS_EvaluateScript, etc.
|
||||
*/
|
||||
#define JSOPTION_STRICT JS_BIT(0) /* warn on dubious practice */
|
||||
#define JSOPTION_EXTRA_WARNINGS JS_BIT(0) /* warn on dubious practices */
|
||||
#define JSOPTION_WERROR JS_BIT(1) /* convert warning to error */
|
||||
#define JSOPTION_VAROBJFIX JS_BIT(2) /* make JS_EvaluateScript use
|
||||
the last object on its 'obj'
|
||||
|
|
|
@ -677,7 +677,7 @@ js::WouldDefinePastNonwritableLength(JSContext *cx, HandleObject obj, uint32_t i
|
|||
}
|
||||
|
||||
*definesPast = true;
|
||||
if (!strict && !cx->hasStrictOption())
|
||||
if (!strict && !cx->hasExtraWarningsOption())
|
||||
return true;
|
||||
|
||||
// Error in strict mode code or warn with strict option.
|
||||
|
|
|
@ -540,20 +540,20 @@ checkReportFlags(JSContext *cx, unsigned *flags)
|
|||
{
|
||||
if (JSREPORT_IS_STRICT_MODE_ERROR(*flags)) {
|
||||
/*
|
||||
* Error in strict code; warning with strict option; okay otherwise.
|
||||
* We assume that if the top frame is a native, then it is strict if
|
||||
* the nearest scripted frame is strict, see bug 536306.
|
||||
* Error in strict code; warning with extra warnings option; okay
|
||||
* otherwise. We assume that if the top frame is a native, then it is
|
||||
* strict if the nearest scripted frame is strict, see bug 536306.
|
||||
*/
|
||||
JSScript *script = cx->stack.currentScript();
|
||||
if (script && script->strict)
|
||||
*flags &= ~JSREPORT_WARNING;
|
||||
else if (cx->hasStrictOption())
|
||||
else if (cx->hasExtraWarningsOption())
|
||||
*flags |= JSREPORT_WARNING;
|
||||
else
|
||||
return true;
|
||||
} else if (JSREPORT_IS_STRICT(*flags)) {
|
||||
/* Warning/error only when JSOPTION_STRICT is set. */
|
||||
if (!cx->hasStrictOption())
|
||||
if (!cx->hasExtraWarningsOption())
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -1709,7 +1709,7 @@ struct JSContext : js::ContextFriendFields,
|
|||
return !!(options_ & opt);
|
||||
}
|
||||
|
||||
bool hasStrictOption() const { return hasOption(JSOPTION_STRICT); }
|
||||
bool hasExtraWarningsOption() const { return hasOption(JSOPTION_EXTRA_WARNINGS); }
|
||||
bool hasWErrorOption() const { return hasOption(JSOPTION_WERROR); }
|
||||
|
||||
js::LifoAlloc &tempLifoAlloc() { return runtime()->tempLifoAlloc; }
|
||||
|
|
|
@ -3941,8 +3941,8 @@ GetPropertyHelperInline(JSContext *cx,
|
|||
return false;
|
||||
}
|
||||
|
||||
/* Don't warn if not strict or for random getprop operations. */
|
||||
if (!cx->hasStrictOption() || (op != JSOP_GETPROP && op != JSOP_GETELEM))
|
||||
/* Don't warn if extra warnings not enabled or for random getprop operations. */
|
||||
if (!cx->hasExtraWarningsOption() || (op != JSOP_GETPROP && op != JSOP_GETELEM))
|
||||
return true;
|
||||
|
||||
/* Don't warn repeatedly for the same script. */
|
||||
|
@ -4162,8 +4162,9 @@ MaybeReportUndeclaredVarAssignment(JSContext *cx, JSString *propname)
|
|||
if (!script)
|
||||
return true;
|
||||
|
||||
/* If neither cx nor the code is strict, then no check is needed. */
|
||||
if (!script->strict && !cx->hasStrictOption())
|
||||
// If the code is not strict and extra warnings aren't enabled, then no
|
||||
// check is needed.
|
||||
if (!script->strict && !cx->hasExtraWarningsOption())
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -4185,8 +4186,9 @@ js::ReportIfUndeclaredVarAssignment(JSContext *cx, HandleString propname)
|
|||
if (!script)
|
||||
return true;
|
||||
|
||||
/* If neither cx nor the code is strict, then no check is needed. */
|
||||
if (!script->strict && !cx->hasStrictOption())
|
||||
// If the code is not strict and extra warnings aren't enabled, then no
|
||||
// check is needed.
|
||||
if (!script->strict && !cx->hasExtraWarningsOption())
|
||||
return true;
|
||||
|
||||
/*
|
||||
|
@ -4288,7 +4290,7 @@ baseops::SetPropertyHelper(JSContext *cx, HandleObject obj, HandleObject receive
|
|||
if (pd.attrs & JSPROP_READONLY) {
|
||||
if (strict)
|
||||
return JSObject::reportReadOnly(cx, id, JSREPORT_ERROR);
|
||||
if (cx->hasStrictOption())
|
||||
if (cx->hasExtraWarningsOption())
|
||||
return JSObject::reportReadOnly(cx, id, JSREPORT_STRICT | JSREPORT_WARNING);
|
||||
return true;
|
||||
}
|
||||
|
@ -4332,10 +4334,10 @@ baseops::SetPropertyHelper(JSContext *cx, HandleObject obj, HandleObject receive
|
|||
JS_ASSERT(shape->isDataDescriptor());
|
||||
|
||||
if (!shape->writable()) {
|
||||
/* Error in strict mode code, warn with strict option, otherwise do nothing. */
|
||||
/* Error in strict mode code, warn with extra warnings options, otherwise do nothing. */
|
||||
if (strict)
|
||||
return JSObject::reportReadOnly(cx, id, JSREPORT_ERROR);
|
||||
if (cx->hasStrictOption())
|
||||
if (cx->hasExtraWarningsOption())
|
||||
return JSObject::reportReadOnly(cx, id, JSREPORT_STRICT | JSREPORT_WARNING);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
@ -4409,10 +4411,10 @@ baseops::SetPropertyHelper(JSContext *cx, HandleObject obj, HandleObject receive
|
|||
|
||||
if (!shape) {
|
||||
if (!obj->isExtensible()) {
|
||||
/* Error in strict mode code, warn with strict option, otherwise do nothing. */
|
||||
/* Error in strict mode code, warn with extra warnings option, otherwise do nothing. */
|
||||
if (strict)
|
||||
return obj->reportNotExtensible(cx);
|
||||
if (cx->hasStrictOption())
|
||||
if (cx->hasExtraWarningsOption())
|
||||
return obj->reportNotExtensible(cx, JSREPORT_STRICT | JSREPORT_WARNING);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -583,7 +583,7 @@ static const struct JSOption {
|
|||
const char *name;
|
||||
uint32_t flag;
|
||||
} js_options[] = {
|
||||
{"strict", JSOPTION_STRICT},
|
||||
{"strict", JSOPTION_EXTRA_WARNINGS},
|
||||
{"typeinfer", JSOPTION_TYPE_INFERENCE},
|
||||
{"werror", JSOPTION_WERROR},
|
||||
{"strict_mode", JSOPTION_STRICT_MODE},
|
||||
|
@ -4934,7 +4934,7 @@ ProcessArgs(JSContext *cx, JSObject *obj_, OptionParser *op)
|
|||
reportWarnings = JS_FALSE;
|
||||
|
||||
if (op->getBoolOption('s'))
|
||||
JS_ToggleOptions(cx, JSOPTION_STRICT);
|
||||
JS_ToggleOptions(cx, JSOPTION_EXTRA_WARNINGS);
|
||||
|
||||
if (op->getBoolOption('d')) {
|
||||
JS_SetRuntimeDebugMode(JS_GetRuntime(cx), true);
|
||||
|
|
|
@ -698,7 +698,7 @@ static const struct JSOption {
|
|||
const char *name;
|
||||
uint32_t flag;
|
||||
} js_options[] = {
|
||||
{"strict", JSOPTION_STRICT},
|
||||
{"strict", JSOPTION_EXTRA_WARNINGS},
|
||||
{"werror", JSOPTION_WERROR},
|
||||
{"strict_mode", JSOPTION_STRICT_MODE},
|
||||
};
|
||||
|
@ -1150,7 +1150,7 @@ ProcessArgsForCompartment(JSContext *cx, char **argv, int argc)
|
|||
case 'S':
|
||||
JS_ToggleOptions(cx, JSOPTION_WERROR);
|
||||
case 's':
|
||||
JS_ToggleOptions(cx, JSOPTION_STRICT);
|
||||
JS_ToggleOptions(cx, JSOPTION_EXTRA_WARNINGS);
|
||||
break;
|
||||
case 'I':
|
||||
JS_ToggleOptions(cx, JSOPTION_COMPILE_N_GO);
|
||||
|
|
|
@ -4453,7 +4453,7 @@ SetBoolOption(JSContext* cx, uint32_t aOption, bool aValue)
|
|||
return SetBoolOption(cx, _flag, aValue); \
|
||||
}
|
||||
|
||||
GENERATE_JSOPTION_GETTER_SETTER(Strict, JSOPTION_STRICT)
|
||||
GENERATE_JSOPTION_GETTER_SETTER(Strict, JSOPTION_EXTRA_WARNINGS)
|
||||
GENERATE_JSOPTION_GETTER_SETTER(Werror, JSOPTION_WERROR)
|
||||
GENERATE_JSOPTION_GETTER_SETTER(Strict_mode, JSOPTION_STRICT_MODE)
|
||||
GENERATE_JSOPTION_GETTER_SETTER(Ion, JSOPTION_ION)
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
== scoped-style-019.svg scoped-style-019-ref.svg
|
||||
== scoped-style-020.html scoped-style-020-ref.html
|
||||
== scoped-style-021.html scoped-style-021-ref.html
|
||||
== scoped-style-022.html scoped-style-022-ref.html
|
||||
== scoped-style-important-001.html scoped-style-important-001-ref.html
|
||||
== scoped-style-important-002.html scoped-style-important-002-ref.html
|
||||
== scoped-style-important-003.html scoped-style-important-003-ref.html
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
<!DOCTYPE html>
|
||||
<body>
|
||||
<div>
|
||||
<p style="color: green">Hello</p>
|
||||
</div>
|
||||
</body>
|
|
@ -0,0 +1,9 @@
|
|||
<!DOCTYPE html>
|
||||
<body>
|
||||
<style scoped>
|
||||
body > div p { color: green; }
|
||||
</style>
|
||||
<div>
|
||||
<p>Hello</p>
|
||||
</div>
|
||||
</body>
|
|
@ -2320,10 +2320,16 @@ static bool SelectorMatchesTree(Element* aPrevElement,
|
|||
// it tests from the top of the content tree, down. This
|
||||
// doesn't matter much for performance since most selectors
|
||||
// don't match. (If most did, it might be faster...)
|
||||
Element* styleScope = aTreeMatchContext.mCurrentStyleScope;
|
||||
if (SelectorMatchesTree(element, selector, aTreeMatchContext,
|
||||
aLookForRelevantLink)) {
|
||||
return true;
|
||||
}
|
||||
// We want to reset mCurrentStyleScope on aTreeMatchContext
|
||||
// back to its state before the SelectorMatchesTree call, in
|
||||
// case that call happens to traverse past the style scope element
|
||||
// and sets it to null.
|
||||
aTreeMatchContext.mCurrentStyleScope = styleScope;
|
||||
}
|
||||
selector = selector->mNext;
|
||||
}
|
||||
|
@ -2462,6 +2468,10 @@ static inline nsRestyleHint RestyleHintForOp(PRUnichar oper)
|
|||
nsRestyleHint
|
||||
nsCSSRuleProcessor::HasStateDependentStyle(StateRuleProcessorData* aData)
|
||||
{
|
||||
MOZ_ASSERT(!aData->mTreeMatchContext.mForScopedStyle,
|
||||
"mCurrentStyleScope will need to be saved and restored after the "
|
||||
"SelectorMatchesTree call");
|
||||
|
||||
RuleCascadeData* cascade = GetRuleCascade(aData->mPresContext);
|
||||
|
||||
// Look up the content node in the state rule list, which points to
|
||||
|
@ -3333,6 +3343,10 @@ nsCSSRuleProcessor::SelectorListMatches(Element* aElement,
|
|||
TreeMatchContext& aTreeMatchContext,
|
||||
nsCSSSelectorList* aSelectorList)
|
||||
{
|
||||
MOZ_ASSERT(!aTreeMatchContext.mForScopedStyle,
|
||||
"mCurrentStyleScope will need to be saved and restored after the "
|
||||
"SelectorMatchesTree call");
|
||||
|
||||
while (aSelectorList) {
|
||||
nsCSSSelector* sel = aSelectorList->mSelectors;
|
||||
NS_ASSERTION(sel, "Should have *some* selectors");
|
||||
|
|
|
@ -641,6 +641,8 @@ nsTransitionManager::StyleContextChanged(dom::Element *aElement,
|
|||
}
|
||||
}
|
||||
|
||||
et->mStyleRule = nullptr;
|
||||
|
||||
return coverRule.forget();
|
||||
}
|
||||
|
||||
|
@ -724,13 +726,15 @@ nsTransitionManager::ConsiderStartingTransition(nsCSSProperty aProperty,
|
|||
nsPresContext *presContext = aNewStyleContext->PresContext();
|
||||
|
||||
if (!shouldAnimate) {
|
||||
nsTArray<ElementPropertyTransition> &pts =
|
||||
aElementTransitions->mPropertyTransitions;
|
||||
if (haveCurrentTransition) {
|
||||
// We're in the middle of a transition, but just got a
|
||||
// non-transition style change changing to exactly the
|
||||
// current in-progress value. (This is quite easy to cause
|
||||
// using 'transition-delay'.)
|
||||
// We're in the middle of a transition, and just got a non-transition
|
||||
// style change to something that we can't animate. This might happen
|
||||
// because we got a non-transition style change changing to the current
|
||||
// in-progress value (which is particularly easy to cause when we're
|
||||
// currently in the 'transition-delay'). It also might happen because we
|
||||
// just got a style change to a value that can't be interpolated.
|
||||
nsTArray<ElementPropertyTransition> &pts =
|
||||
aElementTransitions->mPropertyTransitions;
|
||||
pts.RemoveElementAt(currentIndex);
|
||||
aElementTransitions->UpdateAnimationGeneration(mPresContext);
|
||||
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<script>
|
||||
<![CDATA[
|
||||
|
||||
function boom()
|
||||
{
|
||||
var svgText = document.createElementNS("http://www.w3.org/2000/svg", "text");
|
||||
document.documentElement.appendChild(svgText);
|
||||
var text1 = document.createTextNode("A");
|
||||
svgText.appendChild(text1);
|
||||
var text2 = document.createTextNode("");
|
||||
svgText.appendChild(text2);
|
||||
document.caretPositionFromPoint(0, 0);
|
||||
setTimeout(function() {
|
||||
text2.data = "B";
|
||||
document.caretPositionFromPoint(0, 0);
|
||||
}, 0);
|
||||
}
|
||||
|
||||
window.addEventListener("load", boom, false);
|
||||
|
||||
]]>
|
||||
</script>
|
||||
</svg>
|
После Ширина: | Высота: | Размер: 616 B |
|
@ -0,0 +1,15 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<script>
|
||||
|
||||
function boom()
|
||||
{
|
||||
var svgText = document.getElementById("t");
|
||||
svgText.firstChild.data = "C";
|
||||
svgText.appendChild(document.createTextNode("D"));
|
||||
document.caretPositionFromPoint(0, 0);
|
||||
}
|
||||
window.addEventListener("load", boom, false);
|
||||
|
||||
</script>
|
||||
<text id="t">A</text>
|
||||
</svg>
|
После Ширина: | Высота: | Размер: 338 B |
|
@ -166,3 +166,5 @@ load 868904-1.svg
|
|||
load 873806-1.svg
|
||||
load 876831-1.svg
|
||||
load 877029-1.svg
|
||||
load 880925-1.svg
|
||||
load 881031-1.svg
|
||||
|
|
|
@ -2863,27 +2863,6 @@ SVGTextDrawPathCallbacks::StrokeGeometry()
|
|||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// GlyphMetricsUpdater
|
||||
|
||||
NS_IMETHODIMP
|
||||
GlyphMetricsUpdater::Run()
|
||||
{
|
||||
if (mFrame) {
|
||||
Run(mFrame);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
GlyphMetricsUpdater::Run(nsSVGTextFrame2* aFrame)
|
||||
{
|
||||
aFrame->mPositioningDirty = true;
|
||||
nsSVGEffects::InvalidateRenderingObservers(aFrame);
|
||||
nsSVGUtils::ScheduleReflowSVG(aFrame);
|
||||
aFrame->mGlyphMetricsUpdater = nullptr;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
|
@ -2982,15 +2961,6 @@ nsSVGTextFrame2::Init(nsIContent* aContent,
|
|||
mMutationObserver.StartObserving(this);
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGTextFrame2::DestroyFrom(nsIFrame* aDestructRoot)
|
||||
{
|
||||
if (mGlyphMetricsUpdater) {
|
||||
mGlyphMetricsUpdater->Revoke();
|
||||
}
|
||||
nsSVGTextFrame2Base::DestroyFrom(aDestructRoot);
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGTextFrame2::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
const nsRect& aDirtyRect,
|
||||
|
@ -3141,7 +3111,7 @@ nsSVGTextFrame2::MutationObserver::ContentAppended(nsIDocument* aDocument,
|
|||
nsIContent* aFirstNewContent,
|
||||
int32_t aNewIndexInContainer)
|
||||
{
|
||||
mFrame->NotifyGlyphMetricsChange(ePositioningDirtyDueToMutation);
|
||||
mFrame->NotifyGlyphMetricsChange();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -3151,7 +3121,7 @@ nsSVGTextFrame2::MutationObserver::ContentInserted(
|
|||
nsIContent* aChild,
|
||||
int32_t aIndexInContainer)
|
||||
{
|
||||
mFrame->NotifyGlyphMetricsChange(ePositioningDirtyDueToMutation);
|
||||
mFrame->NotifyGlyphMetricsChange();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -3162,7 +3132,7 @@ nsSVGTextFrame2::MutationObserver::ContentRemoved(
|
|||
int32_t aIndexInContainer,
|
||||
nsIContent* aPreviousSibling)
|
||||
{
|
||||
mFrame->NotifyGlyphMetricsChange(ePositioningDirtyDueToMutation);
|
||||
mFrame->NotifyGlyphMetricsChange();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -4792,34 +4762,11 @@ nsSVGTextFrame2::ShouldRenderAsPath(nsRenderingContext* aContext,
|
|||
}
|
||||
|
||||
void
|
||||
nsSVGTextFrame2::NotifyGlyphMetricsChange(uint32_t aFlags)
|
||||
nsSVGTextFrame2::NotifyGlyphMetricsChange()
|
||||
{
|
||||
NS_ASSERTION(!aFlags || aFlags == ePositioningDirtyDueToMutation,
|
||||
"unexpected aFlags value");
|
||||
|
||||
if (aFlags == ePositioningDirtyDueToMutation) {
|
||||
// We need to perform the operations in GlyphMetricsUpdater in a
|
||||
// script runner since we can get called just after a DOM mutation,
|
||||
// before frames have been reconstructed, and UpdateGlyphPositioning
|
||||
// will be called with out-of-date frames. This occurs when the
|
||||
// <text> element is being filtered, as the InvalidateBounds()
|
||||
// call needs to call in to GetBBoxContribution() to determine the
|
||||
// filtered region, and that needs to iterate over the text frames.
|
||||
// We would flush frame construction, but that needs to be done
|
||||
// inside a script runner.
|
||||
//
|
||||
// Much of the time, this will perform the GlyphMetricsUpdater
|
||||
// operations immediately.
|
||||
if (mGlyphMetricsUpdater) {
|
||||
return;
|
||||
}
|
||||
mGlyphMetricsUpdater = new GlyphMetricsUpdater(this);
|
||||
nsContentUtils::AddScriptRunner(mGlyphMetricsUpdater.get());
|
||||
return;
|
||||
}
|
||||
|
||||
// Otherwise, we perform the glyph metrics update immediately.
|
||||
GlyphMetricsUpdater::Run(this);
|
||||
mPositioningDirty = true;
|
||||
nsSVGEffects::InvalidateRenderingObservers(this);
|
||||
nsSVGUtils::ScheduleReflowSVG(this);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -204,8 +204,6 @@ public:
|
|||
nsIFrame* aParent,
|
||||
nsIFrame* aPrevInFlow) MOZ_OVERRIDE;
|
||||
|
||||
virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE;
|
||||
|
||||
NS_IMETHOD AttributeChanged(int32_t aNamespaceID,
|
||||
nsIAtom* aAttribute,
|
||||
int32_t aModType) MOZ_OVERRIDE;
|
||||
|
@ -277,16 +275,9 @@ public:
|
|||
|
||||
/**
|
||||
* Schedules mPositions to be recomputed and the covered region to be
|
||||
* updated. The aFlags argument can take the ePositioningDirtyDueToMutation
|
||||
* value to indicate that glyph metrics need to be recomputed due to
|
||||
* a DOM mutation in the <text> element on one of its descendants.
|
||||
* updated.
|
||||
*/
|
||||
void NotifyGlyphMetricsChange(uint32_t aFlags = 0);
|
||||
|
||||
/**
|
||||
* Enum for NotifyGlyphMetricsChange's aFlags argument.
|
||||
*/
|
||||
enum { ePositioningDirtyDueToMutation = 1 };
|
||||
void NotifyGlyphMetricsChange();
|
||||
|
||||
/**
|
||||
* Reflows the anonymous block frame of this non-display nsSVGTextFrame2.
|
||||
|
@ -595,12 +586,6 @@ private:
|
|||
*/
|
||||
MutationObserver mMutationObserver;
|
||||
|
||||
/**
|
||||
* The runnable we have dispatched to perform the work of
|
||||
* NotifyGlyphMetricsChange.
|
||||
*/
|
||||
nsRefPtr<GlyphMetricsUpdater> mGlyphMetricsUpdater;
|
||||
|
||||
/**
|
||||
* Cached canvasTM value.
|
||||
*/
|
||||
|
|
Двоичные данные
mobile/android/base/resources/drawable-hdpi/find_close.png
До Ширина: | Высота: | Размер: 2.1 KiB После Ширина: | Высота: | Размер: 1.3 KiB |
Двоичные данные
mobile/android/base/resources/drawable-hdpi/find_next.png
До Ширина: | Высота: | Размер: 1.6 KiB После Ширина: | Высота: | Размер: 1.2 KiB |
Двоичные данные
mobile/android/base/resources/drawable-hdpi/find_prev.png
До Ширина: | Высота: | Размер: 1.4 KiB После Ширина: | Высота: | Размер: 1.2 KiB |
Двоичные данные
mobile/android/base/resources/drawable-mdpi/find_close.png
До Ширина: | Высота: | Размер: 1.7 KiB После Ширина: | Высота: | Размер: 1.2 KiB |
Двоичные данные
mobile/android/base/resources/drawable-mdpi/find_next.png
До Ширина: | Высота: | Размер: 1.3 KiB После Ширина: | Высота: | Размер: 1.1 KiB |
Двоичные данные
mobile/android/base/resources/drawable-mdpi/find_prev.png
До Ширина: | Высота: | Размер: 1.2 KiB После Ширина: | Высота: | Размер: 1.1 KiB |
Двоичные данные
mobile/android/base/resources/drawable-xhdpi/find_close.png
До Ширина: | Высота: | Размер: 2.6 KiB После Ширина: | Высота: | Размер: 1.4 KiB |
Двоичные данные
mobile/android/base/resources/drawable-xhdpi/find_next.png
До Ширина: | Высота: | Размер: 1.9 KiB После Ширина: | Высота: | Размер: 1.3 KiB |
Двоичные данные
mobile/android/base/resources/drawable-xhdpi/find_prev.png
До Ширина: | Высота: | Размер: 1.8 KiB После Ширина: | Высота: | Размер: 1.3 KiB |
|
@ -310,7 +310,7 @@
|
|||
|
||||
<!-- Find bar -->
|
||||
<style name="FindBar">
|
||||
<item name="android:background">#000000</item>
|
||||
<item name="android:background">@color/background_tabs</item>
|
||||
<item name="android:paddingLeft">3dip</item>
|
||||
<item name="android:paddingRight">3dip</item>
|
||||
<item name="android:paddingTop">6dip</item>
|
||||
|
|
|
@ -22,6 +22,10 @@
|
|||
|
||||
var gFindBar = null;
|
||||
var gBrowser;
|
||||
var gWin;
|
||||
|
||||
var noHighlightSnapshot;
|
||||
var findSnapshot;
|
||||
|
||||
var imports = ["SimpleTest", "ok", "snapshotWindow", "compareSnapshots",
|
||||
"parentFinish"];
|
||||
|
@ -60,8 +64,8 @@
|
|||
|
||||
// First, take a snapshot of the window without highlighting
|
||||
// to be used later to test the unhighlighting case
|
||||
var gWin = gBrowser.contentWindow;
|
||||
var noHighlightSnapshot = snapshotWindow(gWin);
|
||||
gWin = gBrowser.contentWindow;
|
||||
noHighlightSnapshot = snapshotWindow(gWin);
|
||||
|
||||
gFindBar.open();
|
||||
gFindBar._findField.value = SEARCH_TEXT;
|
||||
|
@ -72,15 +76,30 @@
|
|||
// Turn on highlighting
|
||||
gFindBar.toggleHighlight(true);
|
||||
gFindBar.close();
|
||||
|
||||
gFindBar.addEventListener('transitionend', part2);
|
||||
}
|
||||
|
||||
function part2(aEvent) {
|
||||
if (aEvent.propertyName != 'visibility') {
|
||||
return;
|
||||
}
|
||||
gFindBar.removeEventListener('transitionend', part2);
|
||||
// Take snapshot of highlighing
|
||||
var findSnapshot = snapshotWindow(gWin);
|
||||
findSnapshot = snapshotWindow(gWin);
|
||||
|
||||
// Now, remove the highlighting, and take a snapshot to compare
|
||||
// to our original state
|
||||
gFindBar.open();
|
||||
gFindBar.toggleHighlight(false);
|
||||
gFindBar.close();
|
||||
gFindBar.addEventListener('transitionend', part3);
|
||||
}
|
||||
|
||||
function part3(aEvent) {
|
||||
if (aEvent.propertyName != 'visibility') {
|
||||
return;
|
||||
}
|
||||
gFindBar.removeEventListener('transitionend', part3);
|
||||
var unhighlightSnapshot = snapshotWindow(gWin);
|
||||
|
||||
// Select the matches that should have been highlighted manually
|
||||
|
|