зеркало из https://github.com/mozilla/gecko-dev.git
Merge inbound to m-c. a=merge
This commit is contained in:
Коммит
01c4e8cc1b
|
@ -525,8 +525,7 @@ Accessible::ChildAtPoint(int32_t aX, int32_t aY,
|
||||||
nsIWidget* rootWidget = rootFrame->GetView()->GetNearestWidget(nullptr);
|
nsIWidget* rootWidget = rootFrame->GetView()->GetNearestWidget(nullptr);
|
||||||
NS_ENSURE_TRUE(rootWidget, nullptr);
|
NS_ENSURE_TRUE(rootWidget, nullptr);
|
||||||
|
|
||||||
LayoutDeviceIntRect rootRect;
|
LayoutDeviceIntRect rootRect = rootWidget->GetScreenBounds();
|
||||||
rootWidget->GetScreenBounds(rootRect);
|
|
||||||
|
|
||||||
WidgetMouseEvent dummyEvent(true, eMouseMove, rootWidget,
|
WidgetMouseEvent dummyEvent(true, eMouseMove, rootWidget,
|
||||||
WidgetMouseEvent::eSynthesized);
|
WidgetMouseEvent::eSynthesized);
|
||||||
|
|
|
@ -173,6 +173,40 @@ OuterDocAccessible::IsAcceptableChild(nsIContent* aEl) const
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(XP_WIN)
|
||||||
|
|
||||||
|
// On Windows e10s, since we don't cache in the chrome process, these next two
|
||||||
|
// functions must be implemented so that we properly cross the chrome-to-content
|
||||||
|
// boundary when traversing.
|
||||||
|
|
||||||
|
uint32_t
|
||||||
|
OuterDocAccessible::ChildCount() const
|
||||||
|
{
|
||||||
|
uint32_t result = mChildren.Length();
|
||||||
|
if (!result && RemoteChildDoc()) {
|
||||||
|
result = 1;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
Accessible*
|
||||||
|
OuterDocAccessible::GetChildAt(uint32_t aIndex) const
|
||||||
|
{
|
||||||
|
Accessible* result = AccessibleWrap::GetChildAt(aIndex);
|
||||||
|
if (result || aIndex) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
// If we are asking for child 0 and GetChildAt doesn't return anything, try
|
||||||
|
// to get the remote child doc and return that instead.
|
||||||
|
ProxyAccessible* remoteChild = RemoteChildDoc();
|
||||||
|
if (!remoteChild) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
return WrapperFor(remoteChild);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // defined(XP_WIN)
|
||||||
|
|
||||||
ProxyAccessible*
|
ProxyAccessible*
|
||||||
OuterDocAccessible::RemoteChildDoc() const
|
OuterDocAccessible::RemoteChildDoc() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -40,6 +40,11 @@ public:
|
||||||
virtual bool RemoveChild(Accessible* aAccessible) override;
|
virtual bool RemoveChild(Accessible* aAccessible) override;
|
||||||
virtual bool IsAcceptableChild(nsIContent* aEl) const override;
|
virtual bool IsAcceptableChild(nsIContent* aEl) const override;
|
||||||
|
|
||||||
|
#if defined(XP_WIN)
|
||||||
|
virtual uint32_t ChildCount() const override;
|
||||||
|
virtual Accessible* GetChildAt(uint32_t aIndex) const override;
|
||||||
|
#endif // defined(XP_WIN)
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~OuterDocAccessible() override;
|
virtual ~OuterDocAccessible() override;
|
||||||
};
|
};
|
||||||
|
@ -53,4 +58,4 @@ Accessible::AsOuterDoc()
|
||||||
} // namespace a11y
|
} // namespace a11y
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -9,6 +9,7 @@ support-files =
|
||||||
doc_content_text.html
|
doc_content_text.html
|
||||||
!/accessible/tests/mochitest/*.js
|
!/accessible/tests/mochitest/*.js
|
||||||
!/accessible/tests/mochitest/moz.png
|
!/accessible/tests/mochitest/moz.png
|
||||||
|
skip-if = os == 'win'
|
||||||
|
|
||||||
[test_alive.html]
|
[test_alive.html]
|
||||||
[test_content_integration.html]
|
[test_content_integration.html]
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
|
|
||||||
<script type="application/javascript"
|
<script type="application/javascript"
|
||||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||||
|
<script type="application/javascript"
|
||||||
|
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
|
||||||
|
|
||||||
<script type="application/javascript"
|
<script type="application/javascript"
|
||||||
src="../common.js"></script>
|
src="../common.js"></script>
|
||||||
|
@ -73,34 +75,45 @@
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
// 'invalid' state
|
// 'invalid' state
|
||||||
|
|
||||||
// XXX: maxlength doesn't make the element invalid until bug 613016 and
|
|
||||||
// bug 613019 are fixed. Commenting out related lines and adding a todo to
|
|
||||||
// make sure it will be uncommented as soon as possible.
|
|
||||||
var todoInput = document.createElement("input");
|
|
||||||
todoInput.maxLength = '2';
|
|
||||||
todoInput.value = 'foo';
|
|
||||||
todo(!todoInput.validity.valid,
|
|
||||||
"input should be invalid because of maxlength");
|
|
||||||
|
|
||||||
// invalid/valid state
|
|
||||||
//var invalid = ["maxlength","pattern","email","url"];
|
|
||||||
//document.getElementById("maxlength").value = "i am too long";
|
|
||||||
var invalid = ["pattern","email","url"];
|
var invalid = ["pattern","email","url"];
|
||||||
for (i in invalid) {
|
for (i in invalid) {
|
||||||
testStates(invalid[i], STATE_INVALID);
|
testStates(invalid[i], STATE_INVALID);
|
||||||
testStates(invalid[i] + "2", 0, 0, STATE_INVALID);
|
testStates(invalid[i] + "2", 0, 0, STATE_INVALID);
|
||||||
}
|
}
|
||||||
|
|
||||||
// invalid/valid state
|
////////////////////////////////////////////////////////////////////////////
|
||||||
//var invalid = ["maxlength","pattern","email","url"];
|
// not 'invalid' state
|
||||||
//document.getElementById("maxlength").value = "i am too long";
|
// (per spec, min/maxlength are always valid until interactively edited)
|
||||||
var invalid = ["pattern","email","url"];
|
var validInput = document.createElement("input");
|
||||||
for (i in invalid) {
|
validInput.maxLength = '0';
|
||||||
testStates(invalid[i], STATE_INVALID);
|
validInput.value = 'a';
|
||||||
testStates(invalid[i] + "2", 0, 0, STATE_INVALID);
|
ok(validInput.validity.valid,
|
||||||
|
"input should be valid despite maxlength (no interactive edits)");
|
||||||
|
|
||||||
|
var validInput2 = document.createElement("input");
|
||||||
|
validInput2.minLength = '1';
|
||||||
|
validInput2.value = '';
|
||||||
|
ok(validInput2.validity.valid,
|
||||||
|
"input should be valid despite minlength (no interactive edits)");
|
||||||
|
|
||||||
|
var valid = ["minlength","maxlength"];
|
||||||
|
for (i in valid) {
|
||||||
|
testStates(valid[i], 0, 0, STATE_INVALID);
|
||||||
|
testStates(valid[i] + "2", 0, 0, STATE_INVALID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
// 'invalid' state
|
||||||
|
// (per spec, min/maxlength validity is affected by interactive edits)
|
||||||
|
var mininp = document.getElementById("minlength");
|
||||||
|
mininp.focus();
|
||||||
|
synthesizeKey("VK_BACK_SPACE", {});
|
||||||
|
ok(!mininp.validity.valid,
|
||||||
|
"input should be invalid after interactive edits");
|
||||||
|
testStates(mininp, STATE_INVALID);
|
||||||
|
// inputs currently cannot be made longer than maxlength interactively,
|
||||||
|
// so we're not testing that case.
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
// autocomplete states
|
// autocomplete states
|
||||||
testStates("autocomplete-default", 0, EXT_STATE_SUPPORTS_AUTOCOMPLETION);
|
testStates("autocomplete-default", 0, EXT_STATE_SUPPORTS_AUTOCOMPLETION);
|
||||||
|
@ -214,18 +227,10 @@
|
||||||
<input id="file" type="file" required disabled>
|
<input id="file" type="file" required disabled>
|
||||||
|
|
||||||
<!-- invalid/valid -->
|
<!-- invalid/valid -->
|
||||||
<input id="maxlength" maxlength="1">
|
<input id="maxlength" maxlength="1" value="f">
|
||||||
<input id="maxlength2" maxlength="100" value="foo">
|
|
||||||
<input id="pattern" pattern="bar" value="foo">
|
|
||||||
<input id="pattern2" pattern="bar" value="bar">
|
|
||||||
<input id="email" type="email" value="foo">
|
|
||||||
<input id="email2" type="email" value="foo@bar.com">
|
|
||||||
<input id="url" type="url" value="foo">
|
|
||||||
<input id="url2" type="url" value="http://mozilla.org/">
|
|
||||||
|
|
||||||
<!-- invalid/valid -->
|
|
||||||
<input id="maxlength" maxlength="1">
|
|
||||||
<input id="maxlength2" maxlength="100" value="foo">
|
<input id="maxlength2" maxlength="100" value="foo">
|
||||||
|
<input id="minlength" minlength="2" value="fo">
|
||||||
|
<input id="minlength2" minlength="1" value="foo">
|
||||||
<input id="pattern" pattern="bar" value="foo">
|
<input id="pattern" pattern="bar" value="foo">
|
||||||
<input id="pattern2" pattern="bar" value="bar">
|
<input id="pattern2" pattern="bar" value="bar">
|
||||||
<input id="email" type="email" value="foo">
|
<input id="email" type="email" value="foo">
|
||||||
|
|
|
@ -104,13 +104,11 @@ pref("app.update.log", false);
|
||||||
// the failure.
|
// the failure.
|
||||||
pref("app.update.backgroundMaxErrors", 10);
|
pref("app.update.backgroundMaxErrors", 10);
|
||||||
|
|
||||||
// The aus update xml certificate checks for application update are disabled on
|
// When |app.update.cert.requireBuiltIn| is true or not specified the
|
||||||
// Windows, Mac OS X, and Linux since the mar signature check are implemented on
|
// final certificate and all certificates the connection is redirected to before
|
||||||
// these platforms and is sufficient to prevent us from applying a mar that is
|
// the final certificate for the url specified in the |app.update.url|
|
||||||
// not valid. Bug 1182352 will remove the update xml certificate checks and the
|
// preference must be built-in.
|
||||||
// following two preferences.
|
|
||||||
pref("app.update.cert.requireBuiltIn", false);
|
pref("app.update.cert.requireBuiltIn", false);
|
||||||
pref("app.update.cert.checkAttributes", false);
|
|
||||||
|
|
||||||
// Whether or not app updates are enabled
|
// Whether or not app updates are enabled
|
||||||
pref("app.update.enabled", true);
|
pref("app.update.enabled", true);
|
||||||
|
|
|
@ -2275,6 +2275,7 @@ function BrowserViewSourceOfDocument(aArgsOrDocument) {
|
||||||
relatedToCurrent: true,
|
relatedToCurrent: true,
|
||||||
inBackground: false,
|
inBackground: false,
|
||||||
forceNotRemote,
|
forceNotRemote,
|
||||||
|
relatedBrowser: args.browser
|
||||||
});
|
});
|
||||||
args.viewSourceBrowser = tabBrowser.getBrowserForTab(tab);
|
args.viewSourceBrowser = tabBrowser.getBrowserForTab(tab);
|
||||||
top.gViewSourceUtils.viewSourceInBrowser(args);
|
top.gViewSourceUtils.viewSourceInBrowser(args);
|
||||||
|
@ -3237,7 +3238,8 @@ var PrintPreviewListener = {
|
||||||
this._tabBeforePrintPreview = gBrowser.selectedTab;
|
this._tabBeforePrintPreview = gBrowser.selectedTab;
|
||||||
this._printPreviewTab = gBrowser.loadOneTab("about:blank",
|
this._printPreviewTab = gBrowser.loadOneTab("about:blank",
|
||||||
{ inBackground: false,
|
{ inBackground: false,
|
||||||
forceNotRemote });
|
forceNotRemote,
|
||||||
|
relatedBrowser: browser });
|
||||||
gBrowser.selectedTab = this._printPreviewTab;
|
gBrowser.selectedTab = this._printPreviewTab;
|
||||||
}
|
}
|
||||||
return gBrowser.getBrowserForTab(this._printPreviewTab);
|
return gBrowser.getBrowserForTab(this._printPreviewTab);
|
||||||
|
|
|
@ -1483,6 +1483,7 @@
|
||||||
var aForceNotRemote;
|
var aForceNotRemote;
|
||||||
var aNoReferrer;
|
var aNoReferrer;
|
||||||
var aUserContextId;
|
var aUserContextId;
|
||||||
|
var aRelatedBrowser;
|
||||||
if (arguments.length == 2 &&
|
if (arguments.length == 2 &&
|
||||||
typeof arguments[1] == "object" &&
|
typeof arguments[1] == "object" &&
|
||||||
!(arguments[1] instanceof Ci.nsIURI)) {
|
!(arguments[1] instanceof Ci.nsIURI)) {
|
||||||
|
@ -1500,6 +1501,7 @@
|
||||||
aForceNotRemote = params.forceNotRemote;
|
aForceNotRemote = params.forceNotRemote;
|
||||||
aNoReferrer = params.noReferrer;
|
aNoReferrer = params.noReferrer;
|
||||||
aUserContextId = params.userContextId;
|
aUserContextId = params.userContextId;
|
||||||
|
aRelatedBrowser = params.relatedBrowser;
|
||||||
}
|
}
|
||||||
|
|
||||||
var bgLoad = (aLoadInBackground != null) ? aLoadInBackground :
|
var bgLoad = (aLoadInBackground != null) ? aLoadInBackground :
|
||||||
|
@ -1518,7 +1520,8 @@
|
||||||
allowMixedContent: aAllowMixedContent,
|
allowMixedContent: aAllowMixedContent,
|
||||||
forceNotRemote: aForceNotRemote,
|
forceNotRemote: aForceNotRemote,
|
||||||
noReferrer: aNoReferrer,
|
noReferrer: aNoReferrer,
|
||||||
userContextId: aUserContextId });
|
userContextId: aUserContextId,
|
||||||
|
relatedBrowser: aRelatedBrowser });
|
||||||
if (!bgLoad)
|
if (!bgLoad)
|
||||||
this.selectedTab = tab;
|
this.selectedTab = tab;
|
||||||
|
|
||||||
|
@ -1811,6 +1814,10 @@
|
||||||
|
|
||||||
b.setAttribute("autoscrollpopup", this._autoScrollPopup.id);
|
b.setAttribute("autoscrollpopup", this._autoScrollPopup.id);
|
||||||
|
|
||||||
|
if (aParams.relatedBrowser) {
|
||||||
|
b.relatedBrowser = aParams.relatedBrowser;
|
||||||
|
}
|
||||||
|
|
||||||
// Create the browserStack container
|
// Create the browserStack container
|
||||||
var stack = document.createElementNS(NS_XUL, "stack");
|
var stack = document.createElementNS(NS_XUL, "stack");
|
||||||
stack.className = "browserStack";
|
stack.className = "browserStack";
|
||||||
|
@ -1889,7 +1896,8 @@
|
||||||
browser = this._createBrowser({permanentKey: aTab.permanentKey,
|
browser = this._createBrowser({permanentKey: aTab.permanentKey,
|
||||||
remote: remote,
|
remote: remote,
|
||||||
uriIsAboutBlank: uriIsAboutBlank,
|
uriIsAboutBlank: uriIsAboutBlank,
|
||||||
userContextId: aParams.userContextId});
|
userContextId: aParams.userContextId,
|
||||||
|
relatedBrowser: aParams.relatedBrowser});
|
||||||
}
|
}
|
||||||
|
|
||||||
let notificationbox = this.getNotificationBox(browser);
|
let notificationbox = this.getNotificationBox(browser);
|
||||||
|
@ -1963,6 +1971,7 @@
|
||||||
var aNoReferrer;
|
var aNoReferrer;
|
||||||
var aUserContextId;
|
var aUserContextId;
|
||||||
var aEventDetail;
|
var aEventDetail;
|
||||||
|
var aRelatedBrowser;
|
||||||
if (arguments.length == 2 &&
|
if (arguments.length == 2 &&
|
||||||
typeof arguments[1] == "object" &&
|
typeof arguments[1] == "object" &&
|
||||||
!(arguments[1] instanceof Ci.nsIURI)) {
|
!(arguments[1] instanceof Ci.nsIURI)) {
|
||||||
|
@ -1981,6 +1990,7 @@
|
||||||
aNoReferrer = params.noReferrer;
|
aNoReferrer = params.noReferrer;
|
||||||
aUserContextId = params.userContextId;
|
aUserContextId = params.userContextId;
|
||||||
aEventDetail = params.eventDetail;
|
aEventDetail = params.eventDetail;
|
||||||
|
aRelatedBrowser = params.relatedBrowser;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we're adding tabs, we're past interrupt mode, ditch the owner
|
// if we're adding tabs, we're past interrupt mode, ditch the owner
|
||||||
|
@ -2047,7 +2057,8 @@
|
||||||
// of tab.linkedBrowser.
|
// of tab.linkedBrowser.
|
||||||
let browserParams = {
|
let browserParams = {
|
||||||
forceNotRemote: aForceNotRemote,
|
forceNotRemote: aForceNotRemote,
|
||||||
userContextId: aUserContextId
|
userContextId: aUserContextId,
|
||||||
|
relatedBrowser: aRelatedBrowser
|
||||||
};
|
};
|
||||||
let { usingPreloadedContent } = this._linkBrowserToTab(t, aURI, browserParams);
|
let { usingPreloadedContent } = this._linkBrowserToTab(t, aURI, browserParams);
|
||||||
let b = t.linkedBrowser;
|
let b = t.linkedBrowser;
|
||||||
|
|
|
@ -9,6 +9,10 @@ Cu.import("resource://gre/modules/Promise.jsm");
|
||||||
Cu.import("resource://gre/modules/Task.jsm");
|
Cu.import("resource://gre/modules/Task.jsm");
|
||||||
Cu.import("resource://gre/modules/osfile.jsm");
|
Cu.import("resource://gre/modules/osfile.jsm");
|
||||||
Cu.import("resource://testing-common/AddonManagerTesting.jsm");
|
Cu.import("resource://testing-common/AddonManagerTesting.jsm");
|
||||||
|
Cu.import("resource://testing-common/AddonTestUtils.jsm");
|
||||||
|
|
||||||
|
XPCOMUtils.defineLazyModuleGetter(this, "AddonManager",
|
||||||
|
"resource://gre/modules/AddonManager.jsm");
|
||||||
|
|
||||||
const PREF_EXPERIMENTS_ENABLED = "experiments.enabled";
|
const PREF_EXPERIMENTS_ENABLED = "experiments.enabled";
|
||||||
const PREF_LOGGING_LEVEL = "experiments.logging.level";
|
const PREF_LOGGING_LEVEL = "experiments.logging.level";
|
||||||
|
@ -127,16 +131,16 @@ function dateToSeconds(date) {
|
||||||
|
|
||||||
var gGlobalScope = this;
|
var gGlobalScope = this;
|
||||||
function loadAddonManager() {
|
function loadAddonManager() {
|
||||||
let ns = {};
|
AddonTestUtils.init(gGlobalScope);
|
||||||
Cu.import("resource://gre/modules/Services.jsm", ns);
|
AddonTestUtils.overrideCertDB();
|
||||||
let head = "../../../../toolkit/mozapps/extensions/test/xpcshell/head_addons.js";
|
|
||||||
let file = do_get_file(head);
|
|
||||||
let uri = ns.Services.io.newFileURI(file);
|
|
||||||
ns.Services.scriptloader.loadSubScript(uri.spec, gGlobalScope);
|
|
||||||
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
|
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
|
||||||
startupManager();
|
return AddonTestUtils.promiseStartupManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const {
|
||||||
|
promiseRestartManager,
|
||||||
|
} = AddonTestUtils;
|
||||||
|
|
||||||
// Starts the addon manager without creating app info. We can't directly use
|
// Starts the addon manager without creating app info. We can't directly use
|
||||||
// |loadAddonManager| defined above in test_conditions.js as it would make the test fail.
|
// |loadAddonManager| defined above in test_conditions.js as it would make the test fail.
|
||||||
function startAddonManagerOnly() {
|
function startAddonManagerOnly() {
|
||||||
|
@ -162,13 +166,8 @@ function getExperimentAddons(previous=false) {
|
||||||
|
|
||||||
function createAppInfo(ID="xpcshell@tests.mozilla.org", name="XPCShell",
|
function createAppInfo(ID="xpcshell@tests.mozilla.org", name="XPCShell",
|
||||||
version="1.0", platformVersion="1.0") {
|
version="1.0", platformVersion="1.0") {
|
||||||
let tmp = {};
|
AddonTestUtils.createAppInfo(ID, name, version, platformVersion);
|
||||||
Cu.import("resource://testing-common/AppInfo.jsm", tmp);
|
gAppInfo = AddonTestUtils.appInfo;
|
||||||
tmp.updateAppInfo({
|
|
||||||
ID, name, version, platformVersion,
|
|
||||||
crashReporter: true,
|
|
||||||
});
|
|
||||||
gAppInfo = tmp.getAppInfo();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -28,7 +28,7 @@ function uninstallExperimentAddons() {
|
||||||
return Task.spawn(function* () {
|
return Task.spawn(function* () {
|
||||||
let addons = yield getExperimentAddons();
|
let addons = yield getExperimentAddons();
|
||||||
for (let a of addons) {
|
for (let a of addons) {
|
||||||
yield AddonTestUtils.uninstallAddonByID(a.id);
|
yield AddonManagerTesting.uninstallAddonByID(a.id);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -412,7 +412,7 @@ add_task(function* test_addonAlreadyInstalled() {
|
||||||
|
|
||||||
// Install conflicting addon.
|
// Install conflicting addon.
|
||||||
|
|
||||||
yield AddonTestUtils.installXPIFromURL(gDataRoot + EXPERIMENT1_XPI_NAME, EXPERIMENT1_XPI_SHA1);
|
yield AddonManagerTesting.installXPIFromURL(gDataRoot + EXPERIMENT1_XPI_NAME, EXPERIMENT1_XPI_SHA1);
|
||||||
addons = yield getExperimentAddons();
|
addons = yield getExperimentAddons();
|
||||||
Assert.equal(addons.length, 1, "1 add-on is installed.");
|
Assert.equal(addons.length, 1, "1 add-on is installed.");
|
||||||
list = yield experiments.getExperiments();
|
list = yield experiments.getExperiments();
|
||||||
|
@ -1407,7 +1407,7 @@ add_task(function* test_unexpectedUninstall() {
|
||||||
// Uninstall the addon through the addon manager instead of stopping it through
|
// Uninstall the addon through the addon manager instead of stopping it through
|
||||||
// the experiments API.
|
// the experiments API.
|
||||||
|
|
||||||
yield AddonTestUtils.uninstallAddonByID(EXPERIMENT1_ID);
|
yield AddonManagerTesting.uninstallAddonByID(EXPERIMENT1_ID);
|
||||||
yield experiments._mainTask;
|
yield experiments._mainTask;
|
||||||
|
|
||||||
yield experiments.notify();
|
yield experiments.notify();
|
||||||
|
@ -1433,7 +1433,7 @@ add_task(function* testUnknownExperimentsUninstalled() {
|
||||||
|
|
||||||
// Simulate us not listening.
|
// Simulate us not listening.
|
||||||
experiments._unregisterWithAddonManager();
|
experiments._unregisterWithAddonManager();
|
||||||
yield AddonTestUtils.installXPIFromURL(gDataRoot + EXPERIMENT1_XPI_NAME, EXPERIMENT1_XPI_SHA1);
|
yield AddonManagerTesting.installXPIFromURL(gDataRoot + EXPERIMENT1_XPI_NAME, EXPERIMENT1_XPI_SHA1);
|
||||||
experiments._registerWithAddonManager();
|
experiments._registerWithAddonManager();
|
||||||
|
|
||||||
addons = yield getExperimentAddons();
|
addons = yield getExperimentAddons();
|
||||||
|
@ -1472,7 +1472,7 @@ add_task(function* testForeignExperimentInstall() {
|
||||||
|
|
||||||
let failed = false;
|
let failed = false;
|
||||||
try {
|
try {
|
||||||
yield AddonTestUtils.installXPIFromURL(gDataRoot + EXPERIMENT1_XPI_NAME, EXPERIMENT1_XPI_SHA1);
|
yield AddonManagerTesting.installXPIFromURL(gDataRoot + EXPERIMENT1_XPI_NAME, EXPERIMENT1_XPI_SHA1);
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
failed = true;
|
failed = true;
|
||||||
}
|
}
|
||||||
|
@ -1622,7 +1622,7 @@ add_task(function* test_foreignUninstallAndRestart() {
|
||||||
Assert.equal(addons.length, 1, "A single experiment add-on is installed.");
|
Assert.equal(addons.length, 1, "A single experiment add-on is installed.");
|
||||||
Assert.ok(addons[0].isActive, "That experiment is active.");
|
Assert.ok(addons[0].isActive, "That experiment is active.");
|
||||||
|
|
||||||
yield AddonTestUtils.uninstallAddonByID(EXPERIMENT1_ID);
|
yield AddonManagerTesting.uninstallAddonByID(EXPERIMENT1_ID);
|
||||||
yield experiments._mainTask;
|
yield experiments._mainTask;
|
||||||
|
|
||||||
addons = yield getExperimentAddons();
|
addons = yield getExperimentAddons();
|
||||||
|
|
|
@ -25,18 +25,6 @@ var gManifestHandlerURI = null;
|
||||||
|
|
||||||
const TLOG = bsp.TELEMETRY_LOG;
|
const TLOG = bsp.TELEMETRY_LOG;
|
||||||
|
|
||||||
var gGlobalScope = this;
|
|
||||||
function loadAddonManager() {
|
|
||||||
let ns = {};
|
|
||||||
Cu.import("resource://gre/modules/Services.jsm", ns);
|
|
||||||
let head = "../../../../toolkit/mozapps/extensions/test/xpcshell/head_addons.js";
|
|
||||||
let file = do_get_file(head);
|
|
||||||
let uri = ns.Services.io.newFileURI(file);
|
|
||||||
ns.Services.scriptloader.loadSubScript(uri.spec, gGlobalScope);
|
|
||||||
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
|
|
||||||
startupManager();
|
|
||||||
}
|
|
||||||
|
|
||||||
function checkEvent(event, id, data)
|
function checkEvent(event, id, data)
|
||||||
{
|
{
|
||||||
do_print("Checking message " + id);
|
do_print("Checking message " + id);
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
This is the pdf.js project output, https://github.com/mozilla/pdf.js
|
This is the pdf.js project output, https://github.com/mozilla/pdf.js
|
||||||
|
|
||||||
Current extension version is: 1.5.365
|
Current extension version is: 1.5.385
|
||||||
|
|
|
@ -64,7 +64,7 @@ var PdfjsChromeUtils = {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
init: function () {
|
init: function () {
|
||||||
this._browsers = new Set();
|
this._browsers = new WeakSet();
|
||||||
if (!this._ppmm) {
|
if (!this._ppmm) {
|
||||||
// global parent process message manager (PPMM)
|
// global parent process message manager (PPMM)
|
||||||
this._ppmm = Cc['@mozilla.org/parentprocessmessagemanager;1'].
|
this._ppmm = Cc['@mozilla.org/parentprocessmessagemanager;1'].
|
||||||
|
|
|
@ -28,8 +28,8 @@ factory((root.pdfjsDistBuildPdf = {}));
|
||||||
// Use strict in our context only - users might not want it
|
// Use strict in our context only - users might not want it
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var pdfjsVersion = '1.5.365';
|
var pdfjsVersion = '1.5.385';
|
||||||
var pdfjsBuild = '19105f0';
|
var pdfjsBuild = 'a9c37c2';
|
||||||
|
|
||||||
var pdfjsFilePath =
|
var pdfjsFilePath =
|
||||||
typeof document !== 'undefined' && document.currentScript ?
|
typeof document !== 'undefined' && document.currentScript ?
|
||||||
|
|
|
@ -28,8 +28,8 @@ factory((root.pdfjsDistBuildPdfWorker = {}));
|
||||||
// Use strict in our context only - users might not want it
|
// Use strict in our context only - users might not want it
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var pdfjsVersion = '1.5.365';
|
var pdfjsVersion = '1.5.385';
|
||||||
var pdfjsBuild = '19105f0';
|
var pdfjsBuild = 'a9c37c2';
|
||||||
|
|
||||||
var pdfjsFilePath =
|
var pdfjsFilePath =
|
||||||
typeof document !== 'undefined' && document.currentScript ?
|
typeof document !== 'undefined' && document.currentScript ?
|
||||||
|
@ -16762,8 +16762,8 @@ var RefSetCache = (function RefSetCacheClosure() {
|
||||||
return RefSetCache;
|
return RefSetCache;
|
||||||
})();
|
})();
|
||||||
|
|
||||||
function isName(v) {
|
function isName(v, name) {
|
||||||
return v instanceof Name;
|
return v instanceof Name && (name === undefined || v.name === name);
|
||||||
}
|
}
|
||||||
|
|
||||||
function isCmd(v, cmd) {
|
function isCmd(v, cmd) {
|
||||||
|
@ -16771,14 +16771,8 @@ function isCmd(v, cmd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function isDict(v, type) {
|
function isDict(v, type) {
|
||||||
if (!(v instanceof Dict)) {
|
return v instanceof Dict &&
|
||||||
return false;
|
(type === undefined || isName(v.get('Type'), type));
|
||||||
}
|
|
||||||
if (!type) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
var dictType = v.get('Type');
|
|
||||||
return isName(dictType) && dictType.name === type;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function isRef(v) {
|
function isRef(v) {
|
||||||
|
@ -23148,7 +23142,7 @@ var CipherTransformFactory = (function CipherTransformFactoryClosure() {
|
||||||
|
|
||||||
function CipherTransformFactory(dict, fileId, password) {
|
function CipherTransformFactory(dict, fileId, password) {
|
||||||
var filter = dict.get('Filter');
|
var filter = dict.get('Filter');
|
||||||
if (!isName(filter) || filter.name !== 'Standard') {
|
if (!isName(filter, 'Standard')) {
|
||||||
error('unknown encryption method');
|
error('unknown encryption method');
|
||||||
}
|
}
|
||||||
this.dict = dict;
|
this.dict = dict;
|
||||||
|
@ -24105,10 +24099,11 @@ function isEOF(v) {
|
||||||
var MAX_LENGTH_TO_CACHE = 1000;
|
var MAX_LENGTH_TO_CACHE = 1000;
|
||||||
|
|
||||||
var Parser = (function ParserClosure() {
|
var Parser = (function ParserClosure() {
|
||||||
function Parser(lexer, allowStreams, xref) {
|
function Parser(lexer, allowStreams, xref, recoveryMode) {
|
||||||
this.lexer = lexer;
|
this.lexer = lexer;
|
||||||
this.allowStreams = allowStreams;
|
this.allowStreams = allowStreams;
|
||||||
this.xref = xref;
|
this.xref = xref;
|
||||||
|
this.recoveryMode = recoveryMode || false;
|
||||||
this.imageCache = Object.create(null);
|
this.imageCache = Object.create(null);
|
||||||
this.refill();
|
this.refill();
|
||||||
}
|
}
|
||||||
|
@ -24154,7 +24149,10 @@ var Parser = (function ParserClosure() {
|
||||||
array.push(this.getObj(cipherTransform));
|
array.push(this.getObj(cipherTransform));
|
||||||
}
|
}
|
||||||
if (isEOF(this.buf1)) {
|
if (isEOF(this.buf1)) {
|
||||||
error('End of file inside array');
|
if (!this.recoveryMode) {
|
||||||
|
error('End of file inside array');
|
||||||
|
}
|
||||||
|
return array;
|
||||||
}
|
}
|
||||||
this.shift();
|
this.shift();
|
||||||
return array;
|
return array;
|
||||||
|
@ -24175,7 +24173,10 @@ var Parser = (function ParserClosure() {
|
||||||
dict.set(key, this.getObj(cipherTransform));
|
dict.set(key, this.getObj(cipherTransform));
|
||||||
}
|
}
|
||||||
if (isEOF(this.buf1)) {
|
if (isEOF(this.buf1)) {
|
||||||
error('End of file inside dictionary');
|
if (!this.recoveryMode) {
|
||||||
|
error('End of file inside dictionary');
|
||||||
|
}
|
||||||
|
return dict;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stream objects are not allowed inside content streams or
|
// Stream objects are not allowed inside content streams or
|
||||||
|
@ -33540,8 +33541,7 @@ var Catalog = (function CatalogClosure() {
|
||||||
var type = stream.dict.get('Type');
|
var type = stream.dict.get('Type');
|
||||||
var subtype = stream.dict.get('Subtype');
|
var subtype = stream.dict.get('Subtype');
|
||||||
|
|
||||||
if (isName(type) && isName(subtype) &&
|
if (isName(type, 'Metadata') && isName(subtype, 'XML')) {
|
||||||
type.name === 'Metadata' && subtype.name === 'XML') {
|
|
||||||
// XXX: This should examine the charset the XML document defines,
|
// XXX: This should examine the charset the XML document defines,
|
||||||
// however since there are currently no real means to decode
|
// however since there are currently no real means to decode
|
||||||
// arbitrary charsets, let's just hope that the author of the PDF
|
// arbitrary charsets, let's just hope that the author of the PDF
|
||||||
|
@ -33750,7 +33750,7 @@ var Catalog = (function CatalogClosure() {
|
||||||
assert(isDict(labelDict), 'The PageLabel is not a dictionary.');
|
assert(isDict(labelDict), 'The PageLabel is not a dictionary.');
|
||||||
|
|
||||||
var type = labelDict.get('Type');
|
var type = labelDict.get('Type');
|
||||||
assert(!type || (isName(type) && type.name === 'PageLabel'),
|
assert(!type || isName(type, 'PageLabel'),
|
||||||
'Invalid type in PageLabel dictionary.');
|
'Invalid type in PageLabel dictionary.');
|
||||||
|
|
||||||
var s = labelDict.get('S');
|
var s = labelDict.get('S');
|
||||||
|
@ -33828,7 +33828,7 @@ var Catalog = (function CatalogClosure() {
|
||||||
var javaScript = [];
|
var javaScript = [];
|
||||||
function appendIfJavaScriptDict(jsDict) {
|
function appendIfJavaScriptDict(jsDict) {
|
||||||
var type = jsDict.get('S');
|
var type = jsDict.get('S');
|
||||||
if (!isName(type) || type.name !== 'JavaScript') {
|
if (!isName(type, 'JavaScript')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var js = jsDict.get('JS');
|
var js = jsDict.get('JS');
|
||||||
|
@ -33856,11 +33856,11 @@ var Catalog = (function CatalogClosure() {
|
||||||
var openactionDict = this.catDict.get('OpenAction');
|
var openactionDict = this.catDict.get('OpenAction');
|
||||||
if (isDict(openactionDict, 'Action')) {
|
if (isDict(openactionDict, 'Action')) {
|
||||||
var actionType = openactionDict.get('S');
|
var actionType = openactionDict.get('S');
|
||||||
if (isName(actionType) && actionType.name === 'Named') {
|
if (isName(actionType, 'Named')) {
|
||||||
// The named Print action is not a part of the PDF 1.7 specification,
|
// The named Print action is not a part of the PDF 1.7 specification,
|
||||||
// but is supported by many PDF readers/writers (including Adobe's).
|
// but is supported by many PDF readers/writers (including Adobe's).
|
||||||
var action = openactionDict.get('N');
|
var action = openactionDict.get('N');
|
||||||
if (isName(action) && action.name === 'Print') {
|
if (isName(action, 'Print')) {
|
||||||
javaScript.push('print({});');
|
javaScript.push('print({});');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -34416,13 +34416,15 @@ var XRef = (function XRefClosure() {
|
||||||
var dict;
|
var dict;
|
||||||
for (i = 0, ii = trailers.length; i < ii; ++i) {
|
for (i = 0, ii = trailers.length; i < ii; ++i) {
|
||||||
stream.pos = trailers[i];
|
stream.pos = trailers[i];
|
||||||
var parser = new Parser(new Lexer(stream), true, this);
|
var parser = new Parser(new Lexer(stream), /* allowStreams = */ true,
|
||||||
|
/* xref = */ this, /* recoveryMode = */ true);
|
||||||
var obj = parser.getObj();
|
var obj = parser.getObj();
|
||||||
if (!isCmd(obj, 'trailer')) {
|
if (!isCmd(obj, 'trailer')) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// read the trailer dictionary
|
// read the trailer dictionary
|
||||||
if (!isDict(dict = parser.getObj())) {
|
dict = parser.getObj();
|
||||||
|
if (!isDict(dict)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// taking the first one with 'ID'
|
// taking the first one with 'ID'
|
||||||
|
@ -36131,7 +36133,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
||||||
|
|
||||||
var groupSubtype = group.get('S');
|
var groupSubtype = group.get('S');
|
||||||
var colorSpace;
|
var colorSpace;
|
||||||
if (isName(groupSubtype) && groupSubtype.name === 'Transparency') {
|
if (isName(groupSubtype, 'Transparency')) {
|
||||||
groupOptions.isolated = (group.get('I') || false);
|
groupOptions.isolated = (group.get('I') || false);
|
||||||
groupOptions.knockout = (group.get('K') || false);
|
groupOptions.knockout = (group.get('K') || false);
|
||||||
colorSpace = (group.has('CS') ?
|
colorSpace = (group.has('CS') ?
|
||||||
|
@ -36426,7 +36428,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
||||||
gStateObj.push([key, value]);
|
gStateObj.push([key, value]);
|
||||||
break;
|
break;
|
||||||
case 'SMask':
|
case 'SMask':
|
||||||
if (isName(value) && value.name === 'None') {
|
if (isName(value, 'None')) {
|
||||||
gStateObj.push([key, false]);
|
gStateObj.push([key, false]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -36734,8 +36736,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
||||||
assert(isStream(xobj), 'XObject should be a stream');
|
assert(isStream(xobj), 'XObject should be a stream');
|
||||||
|
|
||||||
var type = xobj.dict.get('Subtype');
|
var type = xobj.dict.get('Subtype');
|
||||||
assert(isName(type),
|
assert(isName(type), 'XObject should have a Name subtype');
|
||||||
'XObject should have a Name subtype');
|
|
||||||
|
|
||||||
if (type.name === 'Form') {
|
if (type.name === 'Form') {
|
||||||
stateManager.save();
|
stateManager.save();
|
||||||
|
@ -37446,8 +37447,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
||||||
assert(isStream(xobj), 'XObject should be a stream');
|
assert(isStream(xobj), 'XObject should be a stream');
|
||||||
|
|
||||||
var type = xobj.dict.get('Subtype');
|
var type = xobj.dict.get('Subtype');
|
||||||
assert(isName(type),
|
assert(isName(type), 'XObject should have a Name subtype');
|
||||||
'XObject should have a Name subtype');
|
|
||||||
|
|
||||||
if ('Form' !== type.name) {
|
if ('Form' !== type.name) {
|
||||||
xobjsCache.key = name;
|
xobjsCache.key = name;
|
||||||
|
@ -39216,7 +39216,7 @@ AnnotationFactory.prototype = /** @lends AnnotationFactory.prototype */ {
|
||||||
|
|
||||||
case 'Widget':
|
case 'Widget':
|
||||||
var fieldType = Util.getInheritableProperty(dict, 'FT');
|
var fieldType = Util.getInheritableProperty(dict, 'FT');
|
||||||
if (isName(fieldType) && fieldType.name === 'Tx') {
|
if (isName(fieldType, 'Tx')) {
|
||||||
return new TextWidgetAnnotation(parameters);
|
return new TextWidgetAnnotation(parameters);
|
||||||
}
|
}
|
||||||
return new WidgetAnnotation(parameters);
|
return new WidgetAnnotation(parameters);
|
||||||
|
@ -39461,10 +39461,9 @@ var Annotation = (function AnnotationClosure() {
|
||||||
}
|
}
|
||||||
if (borderStyle.has('BS')) {
|
if (borderStyle.has('BS')) {
|
||||||
var dict = borderStyle.get('BS');
|
var dict = borderStyle.get('BS');
|
||||||
var dictType;
|
var dictType = dict.get('Type');
|
||||||
|
|
||||||
if (!dict.has('Type') || (isName(dictType = dict.get('Type')) &&
|
if (!dictType || isName(dictType, 'Border')) {
|
||||||
dictType.name === 'Border')) {
|
|
||||||
this.borderStyle.setWidth(dict.get('W'));
|
this.borderStyle.setWidth(dict.get('W'));
|
||||||
this.borderStyle.setStyle(dict.get('S'));
|
this.borderStyle.setStyle(dict.get('S'));
|
||||||
this.borderStyle.setDashArray(dict.getArray('D'));
|
this.borderStyle.setDashArray(dict.getArray('D'));
|
||||||
|
|
|
@ -4641,7 +4641,7 @@ var PDFLinkService = (function PDFLinkServiceClosure() {
|
||||||
* @returns {number}
|
* @returns {number}
|
||||||
*/
|
*/
|
||||||
get pagesCount() {
|
get pagesCount() {
|
||||||
return this.pdfDocument.numPages;
|
return this.pdfDocument ? this.pdfDocument.numPages : 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -4672,7 +4672,9 @@ var PDFLinkService = (function PDFLinkServiceClosure() {
|
||||||
(destRef + 1);
|
(destRef + 1);
|
||||||
if (pageNumber) {
|
if (pageNumber) {
|
||||||
if (pageNumber > self.pagesCount) {
|
if (pageNumber > self.pagesCount) {
|
||||||
pageNumber = self.pagesCount;
|
console.error('PDFLinkService_navigateTo: ' +
|
||||||
|
'Trying to navigate to a non-existent page.');
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
self.pdfViewer.scrollPageIntoView(pageNumber, dest);
|
self.pdfViewer.scrollPageIntoView(pageNumber, dest);
|
||||||
|
|
||||||
|
@ -4849,11 +4851,15 @@ var PDFLinkService = (function PDFLinkServiceClosure() {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'NextPage':
|
case 'NextPage':
|
||||||
this.page++;
|
if (this.page < this.pagesCount) {
|
||||||
|
this.page++;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'PrevPage':
|
case 'PrevPage':
|
||||||
this.page--;
|
if (this.page > 1) {
|
||||||
|
this.page--;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'LastPage':
|
case 'LastPage':
|
||||||
|
@ -6371,7 +6377,7 @@ var PDFViewer = (function pdfViewer() {
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_setCurrentPageNumber:
|
_setCurrentPageNumber:
|
||||||
function pdfViewer_setCurrentPageNumber(val, resetCurrentPageView) {
|
function PDFViewer_setCurrentPageNumber(val, resetCurrentPageView) {
|
||||||
if (this._currentPageNumber === val) {
|
if (this._currentPageNumber === val) {
|
||||||
if (resetCurrentPageView) {
|
if (resetCurrentPageView) {
|
||||||
this._resetCurrentPageView();
|
this._resetCurrentPageView();
|
||||||
|
@ -6380,6 +6386,8 @@ var PDFViewer = (function pdfViewer() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(0 < val && val <= this.pagesCount)) {
|
if (!(0 < val && val <= this.pagesCount)) {
|
||||||
|
console.error('PDFViewer_setCurrentPageNumber: "' + val +
|
||||||
|
'" is out of bounds.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6449,8 +6457,14 @@ var PDFViewer = (function pdfViewer() {
|
||||||
* @param {number} rotation - The rotation of the pages (0, 90, 180, 270).
|
* @param {number} rotation - The rotation of the pages (0, 90, 180, 270).
|
||||||
*/
|
*/
|
||||||
set pagesRotation(rotation) {
|
set pagesRotation(rotation) {
|
||||||
|
if (!(typeof rotation === 'number' && rotation % 90 === 0)) {
|
||||||
|
throw new Error('Invalid pages rotation angle.');
|
||||||
|
}
|
||||||
this._pagesRotation = rotation;
|
this._pagesRotation = rotation;
|
||||||
|
|
||||||
|
if (!this.pdfDocument) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
for (var i = 0, l = this._pages.length; i < l; i++) {
|
for (var i = 0, l = this._pages.length; i < l; i++) {
|
||||||
var pageView = this._pages[i];
|
var pageView = this._pages[i];
|
||||||
pageView.update(pageView.scale, rotation);
|
pageView.update(pageView.scale, rotation);
|
||||||
|
@ -6505,7 +6519,6 @@ var PDFViewer = (function pdfViewer() {
|
||||||
// rendering.
|
// rendering.
|
||||||
self._buffer.push(this);
|
self._buffer.push(this);
|
||||||
};
|
};
|
||||||
// when page is painted, using the image as thumbnail base
|
|
||||||
pageView.onAfterDraw = function pdfViewLoadOnAfterDraw() {
|
pageView.onAfterDraw = function pdfViewLoadOnAfterDraw() {
|
||||||
if (!isOnePageRenderedResolved) {
|
if (!isOnePageRenderedResolved) {
|
||||||
isOnePageRenderedResolved = true;
|
isOnePageRenderedResolved = true;
|
||||||
|
@ -6651,7 +6664,7 @@ var PDFViewer = (function pdfViewer() {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_setScale: function pdfViewer_setScale(value, noScroll) {
|
_setScale: function PDFViewer_setScale(value, noScroll) {
|
||||||
var scale = parseFloat(value);
|
var scale = parseFloat(value);
|
||||||
|
|
||||||
if (scale > 0) {
|
if (scale > 0) {
|
||||||
|
@ -6691,8 +6704,8 @@ var PDFViewer = (function pdfViewer() {
|
||||||
scale = Math.min(MAX_AUTO_SCALE, horizontalScale);
|
scale = Math.min(MAX_AUTO_SCALE, horizontalScale);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
console.error('pdfViewSetScale: \'' + value +
|
console.error('PDFViewer_setScale: "' + value +
|
||||||
'\' is an unknown zoom value.');
|
'" is an unknown zoom value.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this._setScaleUpdatePages(scale, value, noScroll, true);
|
this._setScaleUpdatePages(scale, value, noScroll, true);
|
||||||
|
@ -7365,15 +7378,15 @@ var PDFViewerApplication = {
|
||||||
},
|
},
|
||||||
|
|
||||||
get pagesCount() {
|
get pagesCount() {
|
||||||
return this.pdfDocument.numPages;
|
return this.pdfDocument ? this.pdfDocument.numPages : 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
set page(val) {
|
set page(val) {
|
||||||
this.pdfLinkService.page = val;
|
this.pdfViewer.currentPageNumber = val;
|
||||||
},
|
},
|
||||||
|
|
||||||
get page() { // TODO remove
|
get page() {
|
||||||
return this.pdfLinkService.page;
|
return this.pdfViewer.currentPageNumber;
|
||||||
},
|
},
|
||||||
|
|
||||||
get supportsPrinting() {
|
get supportsPrinting() {
|
||||||
|
@ -8299,30 +8312,25 @@ function webViewerInitialized() {
|
||||||
}
|
}
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
appConfig.sidebar.toggleButton.addEventListener('click',
|
appConfig.sidebar.toggleButton.addEventListener('click', function() {
|
||||||
function() {
|
PDFViewerApplication.pdfSidebar.toggle();
|
||||||
PDFViewerApplication.pdfSidebar.toggle();
|
});
|
||||||
});
|
|
||||||
|
|
||||||
appConfig.toolbar.previous.addEventListener('click',
|
appConfig.toolbar.previous.addEventListener('click', function() {
|
||||||
function() {
|
PDFViewerApplication.page--;
|
||||||
PDFViewerApplication.page--;
|
});
|
||||||
});
|
|
||||||
|
|
||||||
appConfig.toolbar.next.addEventListener('click',
|
appConfig.toolbar.next.addEventListener('click', function() {
|
||||||
function() {
|
PDFViewerApplication.page++;
|
||||||
PDFViewerApplication.page++;
|
});
|
||||||
});
|
|
||||||
|
|
||||||
appConfig.toolbar.zoomIn.addEventListener('click',
|
appConfig.toolbar.zoomIn.addEventListener('click', function() {
|
||||||
function() {
|
PDFViewerApplication.zoomIn();
|
||||||
PDFViewerApplication.zoomIn();
|
});
|
||||||
});
|
|
||||||
|
|
||||||
appConfig.toolbar.zoomOut.addEventListener('click',
|
appConfig.toolbar.zoomOut.addEventListener('click', function() {
|
||||||
function() {
|
PDFViewerApplication.zoomOut();
|
||||||
PDFViewerApplication.zoomOut();
|
});
|
||||||
});
|
|
||||||
|
|
||||||
appConfig.toolbar.pageNumber.addEventListener('click', function() {
|
appConfig.toolbar.pageNumber.addEventListener('click', function() {
|
||||||
this.select();
|
this.select();
|
||||||
|
@ -8894,7 +8902,9 @@ window.addEventListener('keydown', function keydown(evt) {
|
||||||
/* falls through */
|
/* falls through */
|
||||||
case 75: // 'k'
|
case 75: // 'k'
|
||||||
case 80: // 'p'
|
case 80: // 'p'
|
||||||
PDFViewerApplication.page--;
|
if (PDFViewerApplication.page > 1) {
|
||||||
|
PDFViewerApplication.page--;
|
||||||
|
}
|
||||||
handled = true;
|
handled = true;
|
||||||
break;
|
break;
|
||||||
case 27: // esc key
|
case 27: // esc key
|
||||||
|
@ -8924,7 +8934,9 @@ window.addEventListener('keydown', function keydown(evt) {
|
||||||
/* falls through */
|
/* falls through */
|
||||||
case 74: // 'j'
|
case 74: // 'j'
|
||||||
case 78: // 'n'
|
case 78: // 'n'
|
||||||
PDFViewerApplication.page++;
|
if (PDFViewerApplication.page < PDFViewerApplication.pagesCount) {
|
||||||
|
PDFViewerApplication.page++;
|
||||||
|
}
|
||||||
handled = true;
|
handled = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -8936,8 +8948,8 @@ window.addEventListener('keydown', function keydown(evt) {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 35: // end
|
case 35: // end
|
||||||
if (isViewerInPresentationMode || (PDFViewerApplication.pdfDocument &&
|
if (isViewerInPresentationMode ||
|
||||||
PDFViewerApplication.page < PDFViewerApplication.pagesCount)) {
|
PDFViewerApplication.page < PDFViewerApplication.pagesCount) {
|
||||||
PDFViewerApplication.page = PDFViewerApplication.pagesCount;
|
PDFViewerApplication.page = PDFViewerApplication.pagesCount;
|
||||||
handled = true;
|
handled = true;
|
||||||
ensureViewerFocused = true;
|
ensureViewerFocused = true;
|
||||||
|
@ -8962,7 +8974,9 @@ window.addEventListener('keydown', function keydown(evt) {
|
||||||
pdfViewer.currentScaleValue !== 'page-fit') {
|
pdfViewer.currentScaleValue !== 'page-fit') {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
PDFViewerApplication.page--;
|
if (PDFViewerApplication.page > 1) {
|
||||||
|
PDFViewerApplication.page--;
|
||||||
|
}
|
||||||
handled = true;
|
handled = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,12 @@ else
|
||||||
DEFINES += -DMOZ_MULET
|
DEFINES += -DMOZ_MULET
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# When packaging an artifact build not all xpt files expected by the
|
||||||
|
# packager will be present.
|
||||||
|
ifdef MOZ_ARTIFACT_BUILDS
|
||||||
|
MOZ_PKG_FATAL_WARNINGS =
|
||||||
|
endif
|
||||||
|
|
||||||
DEFINES += -DMOZ_APP_NAME=$(MOZ_APP_NAME) -DPREF_DIR=$(PREF_DIR)
|
DEFINES += -DMOZ_APP_NAME=$(MOZ_APP_NAME) -DPREF_DIR=$(PREF_DIR)
|
||||||
|
|
||||||
ifdef MOZ_DEBUG
|
ifdef MOZ_DEBUG
|
||||||
|
@ -43,6 +49,10 @@ ifdef NSS_DISABLE_DBM
|
||||||
DEFINES += -DNSS_DISABLE_DBM=1
|
DEFINES += -DNSS_DISABLE_DBM=1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifdef MOZ_ARTIFACT_BUILDS
|
||||||
|
DEFINES += -DMOZ_ARTIFACT_BUILDS=1
|
||||||
|
endif
|
||||||
|
|
||||||
DEFINES += -DJAREXT=
|
DEFINES += -DJAREXT=
|
||||||
|
|
||||||
ifdef MOZ_ANGLE_RENDERER
|
ifdef MOZ_ANGLE_RENDERER
|
||||||
|
|
|
@ -143,6 +143,12 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
; [Components]
|
; [Components]
|
||||||
|
#ifdef MOZ_ARTIFACT_BUILDS
|
||||||
|
@RESPATH@/components/prebuilt-interfaces.manifest
|
||||||
|
@RESPATH@/components/interfaces.xpt
|
||||||
|
@RESPATH@/browser/components/prebuilt-interfaces.manifest
|
||||||
|
@RESPATH@/browser/components/interfaces.xpt
|
||||||
|
#endif
|
||||||
@RESPATH@/browser/components/components.manifest
|
@RESPATH@/browser/components/components.manifest
|
||||||
@RESPATH@/components/alerts.xpt
|
@RESPATH@/components/alerts.xpt
|
||||||
#ifdef ACCESSIBILITY
|
#ifdef ACCESSIBILITY
|
||||||
|
|
|
@ -32,3 +32,10 @@ TEST_DIRS += [
|
||||||
|
|
||||||
DIST_SUBDIR = 'browser'
|
DIST_SUBDIR = 'browser'
|
||||||
export('DIST_SUBDIR')
|
export('DIST_SUBDIR')
|
||||||
|
|
||||||
|
if CONFIG['MOZ_ARTIFACT_BUILDS']:
|
||||||
|
# Ensure a pre-built interfaces.xpt installed to the objdir by the artifact
|
||||||
|
# code is included by the top-level chrome.manifest.
|
||||||
|
EXTRA_COMPONENTS += [
|
||||||
|
'../build/prebuilt-interfaces.manifest',
|
||||||
|
]
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
-moz-appearance: none;
|
-moz-appearance: none;
|
||||||
background: var(--panel-arrowcontent-background);
|
background: var(--panel-arrowcontent-background);
|
||||||
color: var(--panel-arrowcontent-color);
|
color: var(--panel-arrowcontent-color);
|
||||||
border: var(--panel-arrowcontent-border);
|
border: 1px solid var(--panel-arrowcontent-border-color);
|
||||||
margin-top: -6px;
|
margin-top: -6px;
|
||||||
padding-top: 1px;
|
padding-top: 1px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,7 +144,7 @@
|
||||||
.panel-subviews {
|
.panel-subviews {
|
||||||
padding: 4px;
|
padding: 4px;
|
||||||
background-clip: padding-box;
|
background-clip: padding-box;
|
||||||
border-left: 1px solid var(--panel-separator-color);
|
border-left: 1px solid var(--panel-arrowcontent-border-color);
|
||||||
box-shadow: 0 3px 5px hsla(210,4%,10%,.1),
|
box-shadow: 0 3px 5px hsla(210,4%,10%,.1),
|
||||||
0 0 7px hsla(210,4%,10%,.1);
|
0 0 7px hsla(210,4%,10%,.1);
|
||||||
margin-inline-start: var(--panel-ui-exit-subview-gutter-width);
|
margin-inline-start: var(--panel-ui-exit-subview-gutter-width);
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
/* emulating chrome://browser/content/places/menu.xml#places-popup-arrow but without the arrow */
|
/* emulating chrome://browser/content/places/menu.xml#places-popup-arrow but without the arrow */
|
||||||
box-shadow: 0 0 4px rgba(0,0,0,0.2);
|
box-shadow: 0 0 4px rgba(0,0,0,0.2);
|
||||||
background: var(--panel-arrowcontent-background);
|
background: var(--panel-arrowcontent-background);
|
||||||
border: var(--panel-arrowcontent-border);
|
border: 1px solid var(--panel-arrowcontent-border-color);
|
||||||
border-radius: 3.5px;
|
border-radius: 3.5px;
|
||||||
margin-top: -4px;
|
margin-top: -4px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -183,7 +183,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (-moz-windows-compositor) {
|
@media (-moz-windows-glass) {
|
||||||
#placesToolbox {
|
#placesToolbox {
|
||||||
border-top: none;
|
border-top: none;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,26 +2,6 @@ dnl This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
dnl License, v. 2.0. If a copy of the MPL was not distributed with this
|
dnl License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
AC_DEFUN([MOZ_CONFIG_FFI], [
|
|
||||||
|
|
||||||
MOZ_ARG_ENABLE_BOOL(system-ffi,
|
|
||||||
[ --enable-system-ffi Use system libffi (located with pkgconfig)],
|
|
||||||
MOZ_SYSTEM_FFI=1 )
|
|
||||||
|
|
||||||
if test -n "$MOZ_SYSTEM_FFI"; then
|
|
||||||
# Vanilla libffi 3.0.9 needs a few patches from upcoming version 3.0.10
|
|
||||||
# for non-GCC compilers.
|
|
||||||
if test -z "$GNU_CC"; then
|
|
||||||
PKG_CHECK_MODULES(MOZ_FFI, libffi > 3.0.9)
|
|
||||||
else
|
|
||||||
PKG_CHECK_MODULES(MOZ_FFI, libffi >= 3.0.9)
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_SUBST(MOZ_SYSTEM_FFI)
|
|
||||||
|
|
||||||
])
|
|
||||||
|
|
||||||
AC_DEFUN([MOZ_SUBCONFIGURE_FFI], [
|
AC_DEFUN([MOZ_SUBCONFIGURE_FFI], [
|
||||||
if test "$MOZ_BUILD_APP" != js -o -n "$JS_STANDALONE"; then
|
if test "$MOZ_BUILD_APP" != js -o -n "$JS_STANDALONE"; then
|
||||||
|
|
||||||
|
|
|
@ -101,3 +101,10 @@ if CONFIG['MOZ_VALGRIND']:
|
||||||
'valgrind/i386-redhat-linux-gnu.sup',
|
'valgrind/i386-redhat-linux-gnu.sup',
|
||||||
'valgrind/x86_64-redhat-linux-gnu.sup',
|
'valgrind/x86_64-redhat-linux-gnu.sup',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if CONFIG['MOZ_ARTIFACT_BUILDS']:
|
||||||
|
# Ensure a pre-built interfaces.xpt installed to the objdir by the artifact
|
||||||
|
# code is included by the top-level chrome.manifest.
|
||||||
|
EXTRA_COMPONENTS += [
|
||||||
|
'prebuilt-interfaces.manifest',
|
||||||
|
]
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||||
|
# vim: set filetype=python:
|
||||||
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
js_option('--with-system-ffi',
|
||||||
|
help='Use system libffi (located with pkgconfig)')
|
||||||
|
|
||||||
|
use_system_ffi = depends_if('--with-system-ffi')(lambda _: True)
|
||||||
|
|
||||||
|
system_ffi = pkg_check_modules('MOZ_FFI', 'libffi > 3.0.9',
|
||||||
|
when=use_system_ffi)
|
||||||
|
|
||||||
|
set_config('MOZ_SYSTEM_FFI', system_ffi)
|
||||||
|
add_old_configure_assignment('MOZ_SYSTEM_FFI', system_ffi)
|
||||||
|
|
||||||
|
@depends(building_js, '--help')
|
||||||
|
def ctypes_default(building_js, _):
|
||||||
|
return not building_js
|
||||||
|
|
||||||
|
js_option('--enable-ctypes', help='Enable js-ctypes',
|
||||||
|
default=ctypes_default)
|
||||||
|
|
||||||
|
build_ctypes = depends_if('--enable-ctypes')(lambda _: True)
|
||||||
|
|
||||||
|
set_config('BUILD_CTYPES', build_ctypes)
|
||||||
|
set_define('BUILD_CTYPES', build_ctypes)
|
||||||
|
add_old_configure_assignment('BUILD_CTYPES', build_ctypes)
|
||||||
|
|
||||||
|
@depends(build_ctypes, building_js)
|
||||||
|
def js_has_ctypes(ctypes, js):
|
||||||
|
if ctypes and js:
|
||||||
|
return True
|
||||||
|
|
||||||
|
set_config('JS_HAS_CTYPES', js_has_ctypes)
|
||||||
|
set_define('JS_HAS_CTYPES', js_has_ctypes)
|
||||||
|
add_old_configure_assignment('JS_HAS_CTYPES', js_has_ctypes)
|
|
@ -169,7 +169,6 @@ def old_configure_options(*options):
|
||||||
'--enable-cookies',
|
'--enable-cookies',
|
||||||
'--enable-cpp-rtti',
|
'--enable-cpp-rtti',
|
||||||
'--enable-crashreporter',
|
'--enable-crashreporter',
|
||||||
'--enable-ctypes',
|
|
||||||
'--enable-dbus',
|
'--enable-dbus',
|
||||||
'--enable-debug-js-modules',
|
'--enable-debug-js-modules',
|
||||||
'--enable-directshow',
|
'--enable-directshow',
|
||||||
|
@ -209,7 +208,6 @@ def old_configure_options(*options):
|
||||||
'--enable-oom-breakpoint',
|
'--enable-oom-breakpoint',
|
||||||
'--enable-optimize',
|
'--enable-optimize',
|
||||||
'--enable-parental-controls',
|
'--enable-parental-controls',
|
||||||
'--enable-permissions',
|
|
||||||
'--enable-pie',
|
'--enable-pie',
|
||||||
'--enable-png-arm-neon-support',
|
'--enable-png-arm-neon-support',
|
||||||
'--enable-posix-nspr-emulation',
|
'--enable-posix-nspr-emulation',
|
||||||
|
@ -234,7 +232,6 @@ def old_configure_options(*options):
|
||||||
'--enable-synth-pico',
|
'--enable-synth-pico',
|
||||||
'--enable-system-cairo',
|
'--enable-system-cairo',
|
||||||
'--enable-system-extension-dirs',
|
'--enable-system-extension-dirs',
|
||||||
'--enable-system-ffi',
|
|
||||||
'--enable-system-pixman',
|
'--enable-system-pixman',
|
||||||
'--enable-system-sqlite',
|
'--enable-system-sqlite',
|
||||||
'--enable-tasktracer',
|
'--enable-tasktracer',
|
||||||
|
|
|
@ -18,20 +18,20 @@ def pkg_config_version(pkg_config):
|
||||||
# - `package_desc` package name and version requirement string, list of
|
# - `package_desc` package name and version requirement string, list of
|
||||||
# strings describing packages to locate, or depends function that will
|
# strings describing packages to locate, or depends function that will
|
||||||
# resolve to such a string or list of strings.
|
# resolve to such a string or list of strings.
|
||||||
# - `condition` a depends function that will determine whether to perform
|
# - `when` a depends function that will determine whether to perform
|
||||||
# any checks (default is to always perform checks).
|
# any checks (default is to always perform checks).
|
||||||
# - `allow_missing` If set, failure to fulfill the package description
|
# - `allow_missing` If set, failure to fulfill the package description
|
||||||
# will not result in an error or logged message, and any error message
|
# will not result in an error or logged message, and any error message
|
||||||
# will be returned to the caller.
|
# will be returned to the caller.
|
||||||
# Returns `True` when the package description is fulfilled.
|
# Returns `True` when the package description is fulfilled.
|
||||||
@template
|
@template
|
||||||
def pkg_check_modules(var, package_desc, condition=always,
|
def pkg_check_modules(var, package_desc, when=always,
|
||||||
allow_missing=False):
|
allow_missing=False):
|
||||||
if isinstance(package_desc, (tuple, list)):
|
if isinstance(package_desc, (tuple, list)):
|
||||||
package_desc = ' '.join(package_desc)
|
package_desc = ' '.join(package_desc)
|
||||||
package_desc = dependable(package_desc)
|
package_desc = dependable(package_desc)
|
||||||
|
|
||||||
@depends_when(pkg_config, pkg_config_version, when=condition)
|
@depends_when(pkg_config, pkg_config_version, when=when)
|
||||||
def check_pkg_config(pkg_config, version):
|
def check_pkg_config(pkg_config, version):
|
||||||
min_version = '0.9.0'
|
min_version = '0.9.0'
|
||||||
if pkg_config is None:
|
if pkg_config is None:
|
||||||
|
@ -42,7 +42,7 @@ def pkg_check_modules(var, package_desc, condition=always,
|
||||||
die("*** Your version of pkg-config is too old. You need version %s or newer.",
|
die("*** Your version of pkg-config is too old. You need version %s or newer.",
|
||||||
min_version)
|
min_version)
|
||||||
|
|
||||||
@depends_when(pkg_config, package_desc, when=condition)
|
@depends_when(pkg_config, package_desc, when=when)
|
||||||
@imports('subprocess')
|
@imports('subprocess')
|
||||||
@imports('sys')
|
@imports('sys')
|
||||||
@imports(_from='mozbuild.configure.util', _import='LineIO')
|
@imports(_from='mozbuild.configure.util', _import='LineIO')
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
interfaces interfaces.xpt
|
|
@ -126,6 +126,12 @@ nsNullPrincipalURI::SetHostPort(const nsACString &aHost)
|
||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
return NS_ERROR_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsNullPrincipalURI::SetHostAndPort(const nsACString &aHost)
|
||||||
|
{
|
||||||
|
return NS_ERROR_NOT_IMPLEMENTED;
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsNullPrincipalURI::GetOriginCharset(nsACString &_charset)
|
nsNullPrincipalURI::GetOriginCharset(nsACString &_charset)
|
||||||
{
|
{
|
||||||
|
|
|
@ -310,7 +310,7 @@ EXTRA_CONFIG_DEPS := \
|
||||||
|
|
||||||
$(CONFIGURES): %: %.in $(EXTRA_CONFIG_DEPS)
|
$(CONFIGURES): %: %.in $(EXTRA_CONFIG_DEPS)
|
||||||
@echo Generating $@
|
@echo Generating $@
|
||||||
sed '1,/^divert/d' $< > $@
|
cp -f $< $@
|
||||||
chmod +x $@
|
chmod +x $@
|
||||||
|
|
||||||
CONFIG_STATUS_DEPS := \
|
CONFIG_STATUS_DEPS := \
|
||||||
|
|
|
@ -72,7 +72,9 @@ depends_files := $(foreach root,$(xpidl_modules),$(idl_deps_dir)/$(root).pp)
|
||||||
|
|
||||||
GARBAGE += $(xpt_files) $(depends_files)
|
GARBAGE += $(xpt_files) $(depends_files)
|
||||||
|
|
||||||
|
ifdef COMPILE_ENVIRONMENT
|
||||||
xpidl:: $(xpt_files) $(chrome_manifests) $(interfaces_manifests)
|
xpidl:: $(xpt_files) $(chrome_manifests) $(interfaces_manifests)
|
||||||
|
endif
|
||||||
|
|
||||||
$(xpt_files): $(process_py) $(call mkdir_deps,$(idl_deps_dir) $(dist_include_dir))
|
$(xpt_files): $(process_py) $(call mkdir_deps,$(idl_deps_dir) $(dist_include_dir))
|
||||||
|
|
||||||
|
|
35
configure.in
35
configure.in
|
@ -1,20 +1,21 @@
|
||||||
dnl This Source Code Form is subject to the terms of the Mozilla Public
|
#!/bin/sh
|
||||||
dnl License, v. 2.0. If a copy of the MPL was not distributed with this
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
dnl
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
dnl Welcome to the new world of configure. We're working on moving to a
|
#
|
||||||
dnl python based configure. In the meanwhile, remains of the old autoconf
|
# Welcome to the new world of configure. We're working on moving to a
|
||||||
dnl based configure is in old-configure.in.
|
# python based configure. In the meanwhile, remains of the old autoconf
|
||||||
dnl If you need to add something, please come talk to the build system
|
# based configure is in old-configure.in.
|
||||||
dnl peers for now.
|
# If you need to add something, please come talk to the build system
|
||||||
dnl
|
# peers for now.
|
||||||
dnl Because adding a configure file in the tree is going to conflict with
|
#
|
||||||
dnl existing configure files in people's (and automation) work trees, and
|
# Because adding a configure file in the tree is going to conflict with
|
||||||
dnl because some automation jobs are still running autoconf and configure
|
# existing configure files in people's (and automation) work trees, and
|
||||||
dnl "manually", this file is actually an m4 file that is processed by
|
# because some automation jobs are still running autoconf and configure
|
||||||
dnl autoconf, but doesn't call any autoconf macros. The `divert` line
|
# "manually", this file is actually an m4 file that is processed by
|
||||||
dnl below ensures the script that follows is output by autoconf.
|
# autoconf, but doesn't call any autoconf macros. The `divert` line
|
||||||
divert(0)dnl
|
# below ensures the script that follows is output by autoconf.
|
||||||
|
: "divert(0)dnl"
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
SRCDIR=$(dirname $0)
|
SRCDIR=$(dirname $0)
|
||||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -30,8 +30,8 @@
|
||||||
** the version number) and changes its name to "sqlite3.h" as
|
** the version number) and changes its name to "sqlite3.h" as
|
||||||
** part of the build process.
|
** part of the build process.
|
||||||
*/
|
*/
|
||||||
#ifndef _SQLITE3_H_
|
#ifndef SQLITE3_H
|
||||||
#define _SQLITE3_H_
|
#define SQLITE3_H
|
||||||
#include <stdarg.h> /* Needed for the definition of va_list */
|
#include <stdarg.h> /* Needed for the definition of va_list */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -54,8 +54,17 @@ extern "C" {
|
||||||
#ifndef SQLITE_CDECL
|
#ifndef SQLITE_CDECL
|
||||||
# define SQLITE_CDECL
|
# define SQLITE_CDECL
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef SQLITE_APICALL
|
||||||
|
# define SQLITE_APICALL
|
||||||
|
#endif
|
||||||
#ifndef SQLITE_STDCALL
|
#ifndef SQLITE_STDCALL
|
||||||
# define SQLITE_STDCALL
|
# define SQLITE_STDCALL SQLITE_APICALL
|
||||||
|
#endif
|
||||||
|
#ifndef SQLITE_CALLBACK
|
||||||
|
# define SQLITE_CALLBACK
|
||||||
|
#endif
|
||||||
|
#ifndef SQLITE_SYSAPI
|
||||||
|
# define SQLITE_SYSAPI
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -111,9 +120,9 @@ extern "C" {
|
||||||
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
|
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
|
||||||
** [sqlite_version()] and [sqlite_source_id()].
|
** [sqlite_version()] and [sqlite_source_id()].
|
||||||
*/
|
*/
|
||||||
#define SQLITE_VERSION "3.13.0"
|
#define SQLITE_VERSION "3.14.1"
|
||||||
#define SQLITE_VERSION_NUMBER 3013000
|
#define SQLITE_VERSION_NUMBER 3014001
|
||||||
#define SQLITE_SOURCE_ID "2016-05-18 10:57:30 fc49f556e48970561d7ab6a2f24fdd7d9eb81ff2"
|
#define SQLITE_SOURCE_ID "2016-08-11 18:53:32 a12d8059770df4bca59e321c266410344242bf7b"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** CAPI3REF: Run-Time Library Version Numbers
|
** CAPI3REF: Run-Time Library Version Numbers
|
||||||
|
@ -506,6 +515,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_exec(
|
||||||
#define SQLITE_NOTICE_RECOVER_ROLLBACK (SQLITE_NOTICE | (2<<8))
|
#define SQLITE_NOTICE_RECOVER_ROLLBACK (SQLITE_NOTICE | (2<<8))
|
||||||
#define SQLITE_WARNING_AUTOINDEX (SQLITE_WARNING | (1<<8))
|
#define SQLITE_WARNING_AUTOINDEX (SQLITE_WARNING | (1<<8))
|
||||||
#define SQLITE_AUTH_USER (SQLITE_AUTH | (1<<8))
|
#define SQLITE_AUTH_USER (SQLITE_AUTH | (1<<8))
|
||||||
|
#define SQLITE_OK_LOAD_PERMANENTLY (SQLITE_OK | (1<<8))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** CAPI3REF: Flags For File Open Operations
|
** CAPI3REF: Flags For File Open Operations
|
||||||
|
@ -1035,6 +1045,16 @@ struct sqlite3_io_methods {
|
||||||
*/
|
*/
|
||||||
typedef struct sqlite3_mutex sqlite3_mutex;
|
typedef struct sqlite3_mutex sqlite3_mutex;
|
||||||
|
|
||||||
|
/*
|
||||||
|
** CAPI3REF: Loadable Extension Thunk
|
||||||
|
**
|
||||||
|
** A pointer to the opaque sqlite3_api_routines structure is passed as
|
||||||
|
** the third parameter to entry points of [loadable extensions]. This
|
||||||
|
** structure must be typedefed in order to work around compiler warnings
|
||||||
|
** on some platforms.
|
||||||
|
*/
|
||||||
|
typedef struct sqlite3_api_routines sqlite3_api_routines;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** CAPI3REF: OS Interface Object
|
** CAPI3REF: OS Interface Object
|
||||||
**
|
**
|
||||||
|
@ -1939,7 +1959,7 @@ struct sqlite3_mem_methods {
|
||||||
** C-API [sqlite3_load_extension()] and the SQL function [load_extension()].
|
** C-API [sqlite3_load_extension()] and the SQL function [load_extension()].
|
||||||
** There should be two additional arguments.
|
** There should be two additional arguments.
|
||||||
** When the first argument to this interface is 1, then only the C-API is
|
** When the first argument to this interface is 1, then only the C-API is
|
||||||
** enabled and the SQL function remains disabled. If the first argment to
|
** enabled and the SQL function remains disabled. If the first argument to
|
||||||
** this interface is 0, then both the C-API and the SQL function are disabled.
|
** this interface is 0, then both the C-API and the SQL function are disabled.
|
||||||
** If the first argument is -1, then no changes are made to state of either the
|
** If the first argument is -1, then no changes are made to state of either the
|
||||||
** C-API or the SQL function.
|
** C-API or the SQL function.
|
||||||
|
@ -2232,7 +2252,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_complete16(const void *sql);
|
||||||
** A busy handler must not close the database connection
|
** A busy handler must not close the database connection
|
||||||
** or [prepared statement] that invoked the busy handler.
|
** or [prepared statement] that invoked the busy handler.
|
||||||
*/
|
*/
|
||||||
SQLITE_API int SQLITE_STDCALL sqlite3_busy_handler(sqlite3*, int(*)(void*,int), void*);
|
SQLITE_API int SQLITE_STDCALL sqlite3_busy_handler(sqlite3*,int(*)(void*,int),void*);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** CAPI3REF: Set A Busy Timeout
|
** CAPI3REF: Set A Busy Timeout
|
||||||
|
@ -2754,6 +2774,9 @@ SQLITE_API int SQLITE_STDCALL sqlite3_set_authorizer(
|
||||||
** CAPI3REF: Tracing And Profiling Functions
|
** CAPI3REF: Tracing And Profiling Functions
|
||||||
** METHOD: sqlite3
|
** METHOD: sqlite3
|
||||||
**
|
**
|
||||||
|
** These routines are deprecated. Use the [sqlite3_trace_v2()] interface
|
||||||
|
** instead of the routines described here.
|
||||||
|
**
|
||||||
** These routines register callback functions that can be used for
|
** These routines register callback functions that can be used for
|
||||||
** tracing and profiling the execution of SQL statements.
|
** tracing and profiling the execution of SQL statements.
|
||||||
**
|
**
|
||||||
|
@ -2779,10 +2802,104 @@ SQLITE_API int SQLITE_STDCALL sqlite3_set_authorizer(
|
||||||
** sqlite3_profile() function is considered experimental and is
|
** sqlite3_profile() function is considered experimental and is
|
||||||
** subject to change in future versions of SQLite.
|
** subject to change in future versions of SQLite.
|
||||||
*/
|
*/
|
||||||
SQLITE_API void *SQLITE_STDCALL sqlite3_trace(sqlite3*, void(*xTrace)(void*,const char*), void*);
|
SQLITE_API SQLITE_DEPRECATED void *SQLITE_STDCALL sqlite3_trace(sqlite3*,
|
||||||
SQLITE_API SQLITE_EXPERIMENTAL void *SQLITE_STDCALL sqlite3_profile(sqlite3*,
|
void(*xTrace)(void*,const char*), void*);
|
||||||
|
SQLITE_API SQLITE_DEPRECATED void *SQLITE_STDCALL sqlite3_profile(sqlite3*,
|
||||||
void(*xProfile)(void*,const char*,sqlite3_uint64), void*);
|
void(*xProfile)(void*,const char*,sqlite3_uint64), void*);
|
||||||
|
|
||||||
|
/*
|
||||||
|
** CAPI3REF: SQL Trace Event Codes
|
||||||
|
** KEYWORDS: SQLITE_TRACE
|
||||||
|
**
|
||||||
|
** These constants identify classes of events that can be monitored
|
||||||
|
** using the [sqlite3_trace_v2()] tracing logic. The third argument
|
||||||
|
** to [sqlite3_trace_v2()] is an OR-ed combination of one or more of
|
||||||
|
** the following constants. ^The first argument to the trace callback
|
||||||
|
** is one of the following constants.
|
||||||
|
**
|
||||||
|
** New tracing constants may be added in future releases.
|
||||||
|
**
|
||||||
|
** ^A trace callback has four arguments: xCallback(T,C,P,X).
|
||||||
|
** ^The T argument is one of the integer type codes above.
|
||||||
|
** ^The C argument is a copy of the context pointer passed in as the
|
||||||
|
** fourth argument to [sqlite3_trace_v2()].
|
||||||
|
** The P and X arguments are pointers whose meanings depend on T.
|
||||||
|
**
|
||||||
|
** <dl>
|
||||||
|
** [[SQLITE_TRACE_STMT]] <dt>SQLITE_TRACE_STMT</dt>
|
||||||
|
** <dd>^An SQLITE_TRACE_STMT callback is invoked when a prepared statement
|
||||||
|
** first begins running and possibly at other times during the
|
||||||
|
** execution of the prepared statement, such as at the start of each
|
||||||
|
** trigger subprogram. ^The P argument is a pointer to the
|
||||||
|
** [prepared statement]. ^The X argument is a pointer to a string which
|
||||||
|
** is the unexpanded SQL text of the prepared statement or an SQL comment
|
||||||
|
** that indicates the invocation of a trigger. ^The callback can compute
|
||||||
|
** the same text that would have been returned by the legacy [sqlite3_trace()]
|
||||||
|
** interface by using the X argument when X begins with "--" and invoking
|
||||||
|
** [sqlite3_expanded_sql(P)] otherwise.
|
||||||
|
**
|
||||||
|
** [[SQLITE_TRACE_PROFILE]] <dt>SQLITE_TRACE_PROFILE</dt>
|
||||||
|
** <dd>^An SQLITE_TRACE_PROFILE callback provides approximately the same
|
||||||
|
** information as is provided by the [sqlite3_profile()] callback.
|
||||||
|
** ^The P argument is a pointer to the [prepared statement] and the
|
||||||
|
** X argument points to a 64-bit integer which is the estimated of
|
||||||
|
** the number of nanosecond that the prepared statement took to run.
|
||||||
|
** ^The SQLITE_TRACE_PROFILE callback is invoked when the statement finishes.
|
||||||
|
**
|
||||||
|
** [[SQLITE_TRACE_ROW]] <dt>SQLITE_TRACE_ROW</dt>
|
||||||
|
** <dd>^An SQLITE_TRACE_ROW callback is invoked whenever a prepared
|
||||||
|
** statement generates a single row of result.
|
||||||
|
** ^The P argument is a pointer to the [prepared statement] and the
|
||||||
|
** X argument is unused.
|
||||||
|
**
|
||||||
|
** [[SQLITE_TRACE_CLOSE]] <dt>SQLITE_TRACE_CLOSE</dt>
|
||||||
|
** <dd>^An SQLITE_TRACE_CLOSE callback is invoked when a database
|
||||||
|
** connection closes.
|
||||||
|
** ^The P argument is a pointer to the [database connection] object
|
||||||
|
** and the X argument is unused.
|
||||||
|
** </dl>
|
||||||
|
*/
|
||||||
|
#define SQLITE_TRACE_STMT 0x01
|
||||||
|
#define SQLITE_TRACE_PROFILE 0x02
|
||||||
|
#define SQLITE_TRACE_ROW 0x04
|
||||||
|
#define SQLITE_TRACE_CLOSE 0x08
|
||||||
|
|
||||||
|
/*
|
||||||
|
** CAPI3REF: SQL Trace Hook
|
||||||
|
** METHOD: sqlite3
|
||||||
|
**
|
||||||
|
** ^The sqlite3_trace_v2(D,M,X,P) interface registers a trace callback
|
||||||
|
** function X against [database connection] D, using property mask M
|
||||||
|
** and context pointer P. ^If the X callback is
|
||||||
|
** NULL or if the M mask is zero, then tracing is disabled. The
|
||||||
|
** M argument should be the bitwise OR-ed combination of
|
||||||
|
** zero or more [SQLITE_TRACE] constants.
|
||||||
|
**
|
||||||
|
** ^Each call to either sqlite3_trace() or sqlite3_trace_v2() overrides
|
||||||
|
** (cancels) any prior calls to sqlite3_trace() or sqlite3_trace_v2().
|
||||||
|
**
|
||||||
|
** ^The X callback is invoked whenever any of the events identified by
|
||||||
|
** mask M occur. ^The integer return value from the callback is currently
|
||||||
|
** ignored, though this may change in future releases. Callback
|
||||||
|
** implementations should return zero to ensure future compatibility.
|
||||||
|
**
|
||||||
|
** ^A trace callback is invoked with four arguments: callback(T,C,P,X).
|
||||||
|
** ^The T argument is one of the [SQLITE_TRACE]
|
||||||
|
** constants to indicate why the callback was invoked.
|
||||||
|
** ^The C argument is a copy of the context pointer.
|
||||||
|
** The P and X arguments are pointers whose meanings depend on T.
|
||||||
|
**
|
||||||
|
** The sqlite3_trace_v2() interface is intended to replace the legacy
|
||||||
|
** interfaces [sqlite3_trace()] and [sqlite3_profile()], both of which
|
||||||
|
** are deprecated.
|
||||||
|
*/
|
||||||
|
SQLITE_API int SQLITE_STDCALL sqlite3_trace_v2(
|
||||||
|
sqlite3*,
|
||||||
|
unsigned uMask,
|
||||||
|
int(*xCallback)(unsigned,void*,void*,void*),
|
||||||
|
void *pCtx
|
||||||
|
);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** CAPI3REF: Query Progress Callbacks
|
** CAPI3REF: Query Progress Callbacks
|
||||||
** METHOD: sqlite3
|
** METHOD: sqlite3
|
||||||
|
@ -3401,11 +3518,35 @@ SQLITE_API int SQLITE_STDCALL sqlite3_prepare16_v2(
|
||||||
** CAPI3REF: Retrieving Statement SQL
|
** CAPI3REF: Retrieving Statement SQL
|
||||||
** METHOD: sqlite3_stmt
|
** METHOD: sqlite3_stmt
|
||||||
**
|
**
|
||||||
** ^This interface can be used to retrieve a saved copy of the original
|
** ^The sqlite3_sql(P) interface returns a pointer to a copy of the UTF-8
|
||||||
** SQL text used to create a [prepared statement] if that statement was
|
** SQL text used to create [prepared statement] P if P was
|
||||||
** compiled using either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()].
|
** created by either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()].
|
||||||
|
** ^The sqlite3_expanded_sql(P) interface returns a pointer to a UTF-8
|
||||||
|
** string containing the SQL text of prepared statement P with
|
||||||
|
** [bound parameters] expanded.
|
||||||
|
**
|
||||||
|
** ^(For example, if a prepared statement is created using the SQL
|
||||||
|
** text "SELECT $abc,:xyz" and if parameter $abc is bound to integer 2345
|
||||||
|
** and parameter :xyz is unbound, then sqlite3_sql() will return
|
||||||
|
** the original string, "SELECT $abc,:xyz" but sqlite3_expanded_sql()
|
||||||
|
** will return "SELECT 2345,NULL".)^
|
||||||
|
**
|
||||||
|
** ^The sqlite3_expanded_sql() interface returns NULL if insufficient memory
|
||||||
|
** is available to hold the result, or if the result would exceed the
|
||||||
|
** the maximum string length determined by the [SQLITE_LIMIT_LENGTH].
|
||||||
|
**
|
||||||
|
** ^The [SQLITE_TRACE_SIZE_LIMIT] compile-time option limits the size of
|
||||||
|
** bound parameter expansions. ^The [SQLITE_OMIT_TRACE] compile-time
|
||||||
|
** option causes sqlite3_expanded_sql() to always return NULL.
|
||||||
|
**
|
||||||
|
** ^The string returned by sqlite3_sql(P) is managed by SQLite and is
|
||||||
|
** automatically freed when the prepared statement is finalized.
|
||||||
|
** ^The string returned by sqlite3_expanded_sql(P), on the other hand,
|
||||||
|
** is obtained from [sqlite3_malloc()] and must be free by the application
|
||||||
|
** by passing it to [sqlite3_free()].
|
||||||
*/
|
*/
|
||||||
SQLITE_API const char *SQLITE_STDCALL sqlite3_sql(sqlite3_stmt *pStmt);
|
SQLITE_API const char *SQLITE_STDCALL sqlite3_sql(sqlite3_stmt *pStmt);
|
||||||
|
SQLITE_API char *SQLITE_STDCALL sqlite3_expanded_sql(sqlite3_stmt *pStmt);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** CAPI3REF: Determine If An SQL Statement Writes The Database
|
** CAPI3REF: Determine If An SQL Statement Writes The Database
|
||||||
|
@ -4563,12 +4704,13 @@ SQLITE_API sqlite3 *SQLITE_STDCALL sqlite3_context_db_handle(sqlite3_context*);
|
||||||
** SQLite will invoke the destructor function X with parameter P exactly
|
** SQLite will invoke the destructor function X with parameter P exactly
|
||||||
** once, when the metadata is discarded.
|
** once, when the metadata is discarded.
|
||||||
** SQLite is free to discard the metadata at any time, including: <ul>
|
** SQLite is free to discard the metadata at any time, including: <ul>
|
||||||
** <li> when the corresponding function parameter changes, or
|
** <li> ^(when the corresponding function parameter changes)^, or
|
||||||
** <li> when [sqlite3_reset()] or [sqlite3_finalize()] is called for the
|
** <li> ^(when [sqlite3_reset()] or [sqlite3_finalize()] is called for the
|
||||||
** SQL statement, or
|
** SQL statement)^, or
|
||||||
** <li> when sqlite3_set_auxdata() is invoked again on the same parameter, or
|
** <li> ^(when sqlite3_set_auxdata() is invoked again on the same
|
||||||
** <li> during the original sqlite3_set_auxdata() call when a memory
|
** parameter)^, or
|
||||||
** allocation error occurs. </ul>)^
|
** <li> ^(during the original sqlite3_set_auxdata() call when a memory
|
||||||
|
** allocation error occurs.)^ </ul>
|
||||||
**
|
**
|
||||||
** Note the last bullet in particular. The destructor X in
|
** Note the last bullet in particular. The destructor X in
|
||||||
** sqlite3_set_auxdata(C,N,P,X) might be called immediately, before the
|
** sqlite3_set_auxdata(C,N,P,X) might be called immediately, before the
|
||||||
|
@ -5395,7 +5537,7 @@ SQLITE_API SQLITE_DEPRECATED void SQLITE_STDCALL sqlite3_soft_heap_limit(int N);
|
||||||
** column exists. ^The sqlite3_table_column_metadata() interface returns
|
** column exists. ^The sqlite3_table_column_metadata() interface returns
|
||||||
** SQLITE_ERROR and if the specified column does not exist.
|
** SQLITE_ERROR and if the specified column does not exist.
|
||||||
** ^If the column-name parameter to sqlite3_table_column_metadata() is a
|
** ^If the column-name parameter to sqlite3_table_column_metadata() is a
|
||||||
** NULL pointer, then this routine simply checks for the existance of the
|
** NULL pointer, then this routine simply checks for the existence of the
|
||||||
** table and returns SQLITE_OK if the table exists and SQLITE_ERROR if it
|
** table and returns SQLITE_OK if the table exists and SQLITE_ERROR if it
|
||||||
** does not.
|
** does not.
|
||||||
**
|
**
|
||||||
|
@ -5529,8 +5671,8 @@ SQLITE_API int SQLITE_STDCALL sqlite3_load_extension(
|
||||||
**
|
**
|
||||||
** ^This interface enables or disables both the C-API
|
** ^This interface enables or disables both the C-API
|
||||||
** [sqlite3_load_extension()] and the SQL function [load_extension()].
|
** [sqlite3_load_extension()] and the SQL function [load_extension()].
|
||||||
** Use [sqlite3_db_config](db,[SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION],..)
|
** ^(Use [sqlite3_db_config](db,[SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION],..)
|
||||||
** to enable or disable only the C-API.
|
** to enable or disable only the C-API.)^
|
||||||
**
|
**
|
||||||
** <b>Security warning:</b> It is recommended that extension loading
|
** <b>Security warning:</b> It is recommended that extension loading
|
||||||
** be disabled using the [SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION] method
|
** be disabled using the [SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION] method
|
||||||
|
@ -5550,7 +5692,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_enable_load_extension(sqlite3 *db, int ono
|
||||||
**
|
**
|
||||||
** ^(Even though the function prototype shows that xEntryPoint() takes
|
** ^(Even though the function prototype shows that xEntryPoint() takes
|
||||||
** no arguments and returns void, SQLite invokes xEntryPoint() with three
|
** no arguments and returns void, SQLite invokes xEntryPoint() with three
|
||||||
** arguments and expects and integer result as if the signature of the
|
** arguments and expects an integer result as if the signature of the
|
||||||
** entry point where as follows:
|
** entry point where as follows:
|
||||||
**
|
**
|
||||||
** <blockquote><pre>
|
** <blockquote><pre>
|
||||||
|
@ -5576,7 +5718,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_enable_load_extension(sqlite3 *db, int ono
|
||||||
** See also: [sqlite3_reset_auto_extension()]
|
** See also: [sqlite3_reset_auto_extension()]
|
||||||
** and [sqlite3_cancel_auto_extension()]
|
** and [sqlite3_cancel_auto_extension()]
|
||||||
*/
|
*/
|
||||||
SQLITE_API int SQLITE_STDCALL sqlite3_auto_extension(void (*xEntryPoint)(void));
|
SQLITE_API int SQLITE_STDCALL sqlite3_auto_extension(void(*xEntryPoint)(void));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** CAPI3REF: Cancel Automatic Extension Loading
|
** CAPI3REF: Cancel Automatic Extension Loading
|
||||||
|
@ -5588,7 +5730,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_auto_extension(void (*xEntryPoint)(void));
|
||||||
** unregistered and it returns 0 if X was not on the list of initialization
|
** unregistered and it returns 0 if X was not on the list of initialization
|
||||||
** routines.
|
** routines.
|
||||||
*/
|
*/
|
||||||
SQLITE_API int SQLITE_STDCALL sqlite3_cancel_auto_extension(void (*xEntryPoint)(void));
|
SQLITE_API int SQLITE_STDCALL sqlite3_cancel_auto_extension(void(*xEntryPoint)(void));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** CAPI3REF: Reset Automatic Extension Loading
|
** CAPI3REF: Reset Automatic Extension Loading
|
||||||
|
@ -6764,6 +6906,18 @@ SQLITE_API int SQLITE_STDCALL sqlite3_db_status(sqlite3*, int op, int *pCur, int
|
||||||
** memory used by all pager caches associated with the database connection.)^
|
** memory used by all pager caches associated with the database connection.)^
|
||||||
** ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_USED is always 0.
|
** ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_USED is always 0.
|
||||||
**
|
**
|
||||||
|
** [[SQLITE_DBSTATUS_CACHE_USED_SHARED]]
|
||||||
|
** ^(<dt>SQLITE_DBSTATUS_CACHE_USED_SHARED</dt>
|
||||||
|
** <dd>This parameter is similar to DBSTATUS_CACHE_USED, except that if a
|
||||||
|
** pager cache is shared between two or more connections the bytes of heap
|
||||||
|
** memory used by that pager cache is divided evenly between the attached
|
||||||
|
** connections.)^ In other words, if none of the pager caches associated
|
||||||
|
** with the database connection are shared, this request returns the same
|
||||||
|
** value as DBSTATUS_CACHE_USED. Or, if one or more or the pager caches are
|
||||||
|
** shared, the value returned by this call will be smaller than that returned
|
||||||
|
** by DBSTATUS_CACHE_USED. ^The highwater mark associated with
|
||||||
|
** SQLITE_DBSTATUS_CACHE_USED_SHARED is always 0.
|
||||||
|
**
|
||||||
** [[SQLITE_DBSTATUS_SCHEMA_USED]] ^(<dt>SQLITE_DBSTATUS_SCHEMA_USED</dt>
|
** [[SQLITE_DBSTATUS_SCHEMA_USED]] ^(<dt>SQLITE_DBSTATUS_SCHEMA_USED</dt>
|
||||||
** <dd>This parameter returns the approximate number of bytes of heap
|
** <dd>This parameter returns the approximate number of bytes of heap
|
||||||
** memory used to store the schema for all databases associated
|
** memory used to store the schema for all databases associated
|
||||||
|
@ -6821,7 +6975,8 @@ SQLITE_API int SQLITE_STDCALL sqlite3_db_status(sqlite3*, int op, int *pCur, int
|
||||||
#define SQLITE_DBSTATUS_CACHE_MISS 8
|
#define SQLITE_DBSTATUS_CACHE_MISS 8
|
||||||
#define SQLITE_DBSTATUS_CACHE_WRITE 9
|
#define SQLITE_DBSTATUS_CACHE_WRITE 9
|
||||||
#define SQLITE_DBSTATUS_DEFERRED_FKS 10
|
#define SQLITE_DBSTATUS_DEFERRED_FKS 10
|
||||||
#define SQLITE_DBSTATUS_MAX 10 /* Largest defined DBSTATUS */
|
#define SQLITE_DBSTATUS_CACHE_USED_SHARED 11
|
||||||
|
#define SQLITE_DBSTATUS_MAX 11 /* Largest defined DBSTATUS */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -7977,7 +8132,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_db_cacheflush(sqlite3*);
|
||||||
** ^The second parameter to the preupdate callback is a pointer to
|
** ^The second parameter to the preupdate callback is a pointer to
|
||||||
** the [database connection] that registered the preupdate hook.
|
** the [database connection] that registered the preupdate hook.
|
||||||
** ^The third parameter to the preupdate callback is one of the constants
|
** ^The third parameter to the preupdate callback is one of the constants
|
||||||
** [SQLITE_INSERT], [SQLITE_DELETE], or [SQLITE_UPDATE] to indentify the
|
** [SQLITE_INSERT], [SQLITE_DELETE], or [SQLITE_UPDATE] to identify the
|
||||||
** kind of update operation that is about to occur.
|
** kind of update operation that is about to occur.
|
||||||
** ^(The fourth parameter to the preupdate callback is the name of the
|
** ^(The fourth parameter to the preupdate callback is the name of the
|
||||||
** database within the database connection that is being modified. This
|
** database within the database connection that is being modified. This
|
||||||
|
@ -8204,7 +8359,7 @@ SQLITE_API SQLITE_EXPERIMENTAL int SQLITE_STDCALL sqlite3_snapshot_cmp(
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* End of the 'extern "C"' block */
|
} /* End of the 'extern "C"' block */
|
||||||
#endif
|
#endif
|
||||||
#endif /* _SQLITE3_H_ */
|
#endif /* SQLITE3_H */
|
||||||
|
|
||||||
/******** Begin file sqlite3rtree.h *********/
|
/******** Begin file sqlite3rtree.h *********/
|
||||||
/*
|
/*
|
||||||
|
@ -9924,7 +10079,7 @@ struct Fts5ExtensionApi {
|
||||||
** behaviour. The structure methods are expected to function as follows:
|
** behaviour. The structure methods are expected to function as follows:
|
||||||
**
|
**
|
||||||
** xCreate:
|
** xCreate:
|
||||||
** This function is used to allocate and inititalize a tokenizer instance.
|
** This function is used to allocate and initialize a tokenizer instance.
|
||||||
** A tokenizer instance is required to actually tokenize text.
|
** A tokenizer instance is required to actually tokenize text.
|
||||||
**
|
**
|
||||||
** The first argument passed to this function is a copy of the (void*)
|
** The first argument passed to this function is a copy of the (void*)
|
||||||
|
@ -10184,5 +10339,4 @@ struct fts5_api {
|
||||||
|
|
||||||
#endif /* _FTS5_H */
|
#endif /* _FTS5_H */
|
||||||
|
|
||||||
|
|
||||||
/******** End of fts5.h *********/
|
/******** End of fts5.h *********/
|
||||||
|
|
|
@ -545,8 +545,12 @@ HTMLBreadcrumbs.prototype = {
|
||||||
handleFocus: function (event) {
|
handleFocus: function (event) {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
|
||||||
this.outer.setAttribute("aria-activedescendant",
|
let node = this.nodeHierarchy[this.currentIndex];
|
||||||
this.nodeHierarchy[this.currentIndex].button.id);
|
if (node) {
|
||||||
|
this.outer.setAttribute("aria-activedescendant", node.button.id);
|
||||||
|
} else {
|
||||||
|
this.outer.removeAttribute("aria-activedescendant");
|
||||||
|
}
|
||||||
|
|
||||||
this.outer.focus();
|
this.outer.focus();
|
||||||
},
|
},
|
||||||
|
@ -665,6 +669,9 @@ HTMLBreadcrumbs.prototype = {
|
||||||
if (this.hadFocus) {
|
if (this.hadFocus) {
|
||||||
this.nodeHierarchy[index].button.focus();
|
this.nodeHierarchy[index].button.focus();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// Unset active active descendant when all buttons are unselected.
|
||||||
|
this.outer.removeAttribute("aria-activedescendant");
|
||||||
}
|
}
|
||||||
this.currentIndex = index;
|
this.currentIndex = index;
|
||||||
},
|
},
|
||||||
|
|
|
@ -68,6 +68,7 @@ add_task(function* () {
|
||||||
}
|
}
|
||||||
|
|
||||||
yield testPseudoElements(inspector, container);
|
yield testPseudoElements(inspector, container);
|
||||||
|
yield testComments(inspector, container);
|
||||||
});
|
});
|
||||||
|
|
||||||
function* testPseudoElements(inspector, container) {
|
function* testPseudoElements(inspector, container) {
|
||||||
|
@ -91,3 +92,41 @@ function* testPseudoElements(inspector, container) {
|
||||||
is(container.childNodes[3].textContent, "::after",
|
is(container.childNodes[3].textContent, "::after",
|
||||||
"::before shows up in breadcrumb");
|
"::before shows up in breadcrumb");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function* testComments(inspector, container) {
|
||||||
|
info("Checking for comment elements");
|
||||||
|
|
||||||
|
let breadcrumbs = inspector.breadcrumbs;
|
||||||
|
let checkedButtonIndex = 2;
|
||||||
|
let button = container.childNodes[checkedButtonIndex];
|
||||||
|
|
||||||
|
let onBreadcrumbsUpdated = inspector.once("breadcrumbs-updated");
|
||||||
|
button.click();
|
||||||
|
yield onBreadcrumbsUpdated;
|
||||||
|
|
||||||
|
is(breadcrumbs.currentIndex, checkedButtonIndex, "New button is selected");
|
||||||
|
ok(breadcrumbs.outer.hasAttribute("aria-activedescendant"),
|
||||||
|
"Active descendant must be set");
|
||||||
|
|
||||||
|
let comment = [...inspector.markup._containers].find(([node]) =>
|
||||||
|
node.nodeType === Ci.nsIDOMNode.COMMENT_NODE)[0];
|
||||||
|
|
||||||
|
let onInspectorUpdated = inspector.once("inspector-updated");
|
||||||
|
inspector.selection.setNodeFront(comment);
|
||||||
|
yield onInspectorUpdated;
|
||||||
|
|
||||||
|
is(breadcrumbs.currentIndex, -1,
|
||||||
|
"When comment is selected no breadcrumb should be checked");
|
||||||
|
ok(!breadcrumbs.outer.hasAttribute("aria-activedescendant"),
|
||||||
|
"Active descendant must not be set");
|
||||||
|
|
||||||
|
onInspectorUpdated = inspector.once("inspector-updated");
|
||||||
|
onBreadcrumbsUpdated = inspector.once("breadcrumbs-updated");
|
||||||
|
button.click();
|
||||||
|
yield Promise.all([onInspectorUpdated, onBreadcrumbsUpdated]);
|
||||||
|
|
||||||
|
is(breadcrumbs.currentIndex, checkedButtonIndex,
|
||||||
|
"Same button is selected again");
|
||||||
|
ok(breadcrumbs.outer.hasAttribute("aria-activedescendant"),
|
||||||
|
"Active descendant must be set again");
|
||||||
|
}
|
||||||
|
|
|
@ -64,6 +64,7 @@
|
||||||
<link />
|
<link />
|
||||||
</article>
|
</article>
|
||||||
<div id='pseudo-container'></div>
|
<div id='pseudo-container'></div>
|
||||||
|
<!-- This is a comment node -->
|
||||||
<svg id="vector" viewBox="0 0 10 10">
|
<svg id="vector" viewBox="0 0 10 10">
|
||||||
<clipPath id="clip">
|
<clipPath id="clip">
|
||||||
<rect id="rectangle" x="0" y="0" width="10" height="5"></rect>
|
<rect id="rectangle" x="0" y="0" width="10" height="5"></rect>
|
||||||
|
|
|
@ -5939,8 +5939,7 @@ nsDocShell::GetPositionAndSize(int32_t* aX, int32_t* aY, int32_t* aWidth,
|
||||||
{
|
{
|
||||||
if (mParentWidget) {
|
if (mParentWidget) {
|
||||||
// ensure size is up-to-date if window has changed resolution
|
// ensure size is up-to-date if window has changed resolution
|
||||||
LayoutDeviceIntRect r;
|
LayoutDeviceIntRect r = mParentWidget->GetClientBounds();
|
||||||
mParentWidget->GetClientBounds(r);
|
|
||||||
SetPositionAndSize(mBounds.x, mBounds.y, r.width, r.height, 0);
|
SetPositionAndSize(mBounds.x, mBounds.y, r.width, r.height, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1071,6 +1071,9 @@ Animation::UpdateFinishedState(SeekFlag aSeekFlag,
|
||||||
currentTime.Value().ToMilliseconds() <= 0.0) {
|
currentTime.Value().ToMilliseconds() <= 0.0) {
|
||||||
if (aSeekFlag == SeekFlag::DidSeek) {
|
if (aSeekFlag == SeekFlag::DidSeek) {
|
||||||
mHoldTime = currentTime;
|
mHoldTime = currentTime;
|
||||||
|
} else if (!mPreviousCurrentTime.IsNull()) {
|
||||||
|
mHoldTime.SetValue(std::min(mPreviousCurrentTime.Value(),
|
||||||
|
TimeDuration(0)));
|
||||||
} else {
|
} else {
|
||||||
mHoldTime.SetValue(0);
|
mHoldTime.SetValue(0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -221,9 +221,11 @@ void
|
||||||
KeyframeEffectReadOnly::GetComputedTimingAsDict(
|
KeyframeEffectReadOnly::GetComputedTimingAsDict(
|
||||||
ComputedTimingProperties& aRetVal) const
|
ComputedTimingProperties& aRetVal) const
|
||||||
{
|
{
|
||||||
|
double playbackRate = mAnimation ? mAnimation->PlaybackRate() : 1;
|
||||||
const Nullable<TimeDuration> currentTime = GetLocalTime();
|
const Nullable<TimeDuration> currentTime = GetLocalTime();
|
||||||
GetComputedTimingDictionary(GetComputedTimingAt(currentTime,
|
GetComputedTimingDictionary(GetComputedTimingAt(currentTime,
|
||||||
SpecifiedTiming()),
|
SpecifiedTiming(),
|
||||||
|
playbackRate),
|
||||||
currentTime,
|
currentTime,
|
||||||
SpecifiedTiming(),
|
SpecifiedTiming(),
|
||||||
aRetVal);
|
aRetVal);
|
||||||
|
@ -232,7 +234,8 @@ KeyframeEffectReadOnly::GetComputedTimingAsDict(
|
||||||
ComputedTiming
|
ComputedTiming
|
||||||
KeyframeEffectReadOnly::GetComputedTimingAt(
|
KeyframeEffectReadOnly::GetComputedTimingAt(
|
||||||
const Nullable<TimeDuration>& aLocalTime,
|
const Nullable<TimeDuration>& aLocalTime,
|
||||||
const TimingParams& aTiming)
|
const TimingParams& aTiming,
|
||||||
|
double aPlaybackRate)
|
||||||
{
|
{
|
||||||
const StickyTimeDuration zeroDuration;
|
const StickyTimeDuration zeroDuration;
|
||||||
|
|
||||||
|
@ -271,9 +274,15 @@ KeyframeEffectReadOnly::GetComputedTimingAt(
|
||||||
// Calculate the time within the active interval.
|
// Calculate the time within the active interval.
|
||||||
// https://w3c.github.io/web-animations/#active-time
|
// https://w3c.github.io/web-animations/#active-time
|
||||||
StickyTimeDuration activeTime;
|
StickyTimeDuration activeTime;
|
||||||
if (localTime >=
|
|
||||||
std::min(StickyTimeDuration(aTiming.mDelay + result.mActiveDuration),
|
StickyTimeDuration beforeActiveBoundary =
|
||||||
result.mEndTime)) {
|
std::min(StickyTimeDuration(aTiming.mDelay), result.mEndTime);
|
||||||
|
StickyTimeDuration activeAfterBoundary =
|
||||||
|
std::min(StickyTimeDuration(aTiming.mDelay + result.mActiveDuration),
|
||||||
|
result.mEndTime);
|
||||||
|
|
||||||
|
if (localTime > activeAfterBoundary ||
|
||||||
|
(aPlaybackRate >= 0 && localTime == activeAfterBoundary)) {
|
||||||
result.mPhase = ComputedTiming::AnimationPhase::After;
|
result.mPhase = ComputedTiming::AnimationPhase::After;
|
||||||
if (!result.FillsForwards()) {
|
if (!result.FillsForwards()) {
|
||||||
// The animation isn't active or filling at this time.
|
// The animation isn't active or filling at this time.
|
||||||
|
@ -282,8 +291,8 @@ KeyframeEffectReadOnly::GetComputedTimingAt(
|
||||||
activeTime = std::max(std::min(result.mActiveDuration,
|
activeTime = std::max(std::min(result.mActiveDuration,
|
||||||
result.mActiveDuration + aTiming.mEndDelay),
|
result.mActiveDuration + aTiming.mEndDelay),
|
||||||
zeroDuration);
|
zeroDuration);
|
||||||
} else if (localTime <
|
} else if (localTime < beforeActiveBoundary ||
|
||||||
std::min(StickyTimeDuration(aTiming.mDelay), result.mEndTime)) {
|
(aPlaybackRate < 0 && localTime == beforeActiveBoundary)) {
|
||||||
result.mPhase = ComputedTiming::AnimationPhase::Before;
|
result.mPhase = ComputedTiming::AnimationPhase::Before;
|
||||||
if (!result.FillsBackwards()) {
|
if (!result.FillsBackwards()) {
|
||||||
// The animation isn't active or filling at this time.
|
// The animation isn't active or filling at this time.
|
||||||
|
@ -391,6 +400,15 @@ KeyframeEffectReadOnly::GetComputedTimingAt(
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ComputedTiming
|
||||||
|
KeyframeEffectReadOnly::GetComputedTiming(const TimingParams* aTiming) const
|
||||||
|
{
|
||||||
|
double playbackRate = mAnimation ? mAnimation->PlaybackRate() : 1;
|
||||||
|
return GetComputedTimingAt(GetLocalTime(),
|
||||||
|
aTiming ? *aTiming : SpecifiedTiming(),
|
||||||
|
playbackRate);
|
||||||
|
}
|
||||||
|
|
||||||
// https://w3c.github.io/web-animations/#in-play
|
// https://w3c.github.io/web-animations/#in-play
|
||||||
bool
|
bool
|
||||||
KeyframeEffectReadOnly::IsInPlay() const
|
KeyframeEffectReadOnly::IsInPlay() const
|
||||||
|
|
|
@ -264,16 +264,13 @@ public:
|
||||||
// (because it is not currently active and is not filling at this time).
|
// (because it is not currently active and is not filling at this time).
|
||||||
static ComputedTiming
|
static ComputedTiming
|
||||||
GetComputedTimingAt(const Nullable<TimeDuration>& aLocalTime,
|
GetComputedTimingAt(const Nullable<TimeDuration>& aLocalTime,
|
||||||
const TimingParams& aTiming);
|
const TimingParams& aTiming,
|
||||||
|
double aPlaybackRate);
|
||||||
|
|
||||||
// Shortcut for that gets the computed timing using the current local time as
|
// Shortcut for that gets the computed timing using the current local time as
|
||||||
// calculated from the timeline time.
|
// calculated from the timeline time.
|
||||||
ComputedTiming
|
ComputedTiming
|
||||||
GetComputedTiming(const TimingParams* aTiming = nullptr) const
|
GetComputedTiming(const TimingParams* aTiming = nullptr) const;
|
||||||
{
|
|
||||||
return GetComputedTimingAt(GetLocalTime(),
|
|
||||||
aTiming ? *aTiming : SpecifiedTiming());
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
GetComputedTimingAsDict(ComputedTimingProperties& aRetVal) const override;
|
GetComputedTimingAsDict(ComputedTimingProperties& aRetVal) const override;
|
||||||
|
|
|
@ -701,7 +701,7 @@ nsresult
|
||||||
FileReader::IncreaseBusyCounter()
|
FileReader::IncreaseBusyCounter()
|
||||||
{
|
{
|
||||||
if (mWorkerPrivate && mBusyCount++ == 0 &&
|
if (mWorkerPrivate && mBusyCount++ == 0 &&
|
||||||
!HoldWorker(mWorkerPrivate)) {
|
!HoldWorker(mWorkerPrivate, Closing)) {
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2270,7 +2270,7 @@ WebSocketImpl::RegisterWorkerHolder()
|
||||||
MOZ_ASSERT(!mWorkerHolder);
|
MOZ_ASSERT(!mWorkerHolder);
|
||||||
mWorkerHolder = new WebSocketWorkerHolder(this);
|
mWorkerHolder = new WebSocketWorkerHolder(this);
|
||||||
|
|
||||||
if (NS_WARN_IF(!mWorkerHolder->HoldWorker(mWorkerPrivate))) {
|
if (NS_WARN_IF(!mWorkerHolder->HoldWorker(mWorkerPrivate, Canceling))) {
|
||||||
mWorkerHolder = nullptr;
|
mWorkerHolder = nullptr;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2041,9 +2041,7 @@ nsDOMWindowUtils::SendQueryContentEvent(uint32_t aType,
|
||||||
nsIFrame* popupFrame =
|
nsIFrame* popupFrame =
|
||||||
nsLayoutUtils::GetPopupFrameForEventCoordinates(presContext->GetRootPresContext(), &dummyEvent);
|
nsLayoutUtils::GetPopupFrameForEventCoordinates(presContext->GetRootPresContext(), &dummyEvent);
|
||||||
|
|
||||||
LayoutDeviceIntRect widgetBounds;
|
LayoutDeviceIntRect widgetBounds = widget->GetClientBounds();
|
||||||
nsresult rv = widget->GetClientBounds(widgetBounds);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
widgetBounds.MoveTo(0, 0);
|
widgetBounds.MoveTo(0, 0);
|
||||||
|
|
||||||
// There is no popup frame at the point and the point isn't in our widget,
|
// There is no popup frame at the point and the point isn't in our widget,
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include "nsIDocShellTreeOwner.h"
|
#include "nsIDocShellTreeOwner.h"
|
||||||
#include "nsIDocShellLoadInfo.h"
|
#include "nsIDocShellLoadInfo.h"
|
||||||
#include "nsIBaseWindow.h"
|
#include "nsIBaseWindow.h"
|
||||||
|
#include "nsIBrowser.h"
|
||||||
#include "nsContentUtils.h"
|
#include "nsContentUtils.h"
|
||||||
#include "nsIXPConnect.h"
|
#include "nsIXPConnect.h"
|
||||||
#include "nsUnicharUtils.h"
|
#include "nsUnicharUtils.h"
|
||||||
|
@ -2485,6 +2486,34 @@ nsFrameLoader::SetClampScrollPosition(bool aClamp)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
ContentParent*
|
||||||
|
GetContentParent(Element* aBrowser)
|
||||||
|
{
|
||||||
|
nsCOMPtr<nsIBrowser> browser = do_QueryInterface(aBrowser);
|
||||||
|
if (!browser) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
nsCOMPtr<nsIDOMElement> related;
|
||||||
|
browser->GetRelatedBrowser(getter_AddRefs(related));
|
||||||
|
|
||||||
|
nsCOMPtr<nsIFrameLoaderOwner> otherOwner = do_QueryInterface(related);
|
||||||
|
if (!otherOwner) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
nsCOMPtr<nsIFrameLoader> otherLoader = otherOwner->GetFrameLoader();
|
||||||
|
TabParent* tabParent = TabParent::GetFrom(otherLoader);
|
||||||
|
if (tabParent &&
|
||||||
|
tabParent->Manager() &&
|
||||||
|
tabParent->Manager()->IsContentParent()) {
|
||||||
|
return tabParent->Manager()->AsContentParent();
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
nsFrameLoader::TryRemoteBrowser()
|
nsFrameLoader::TryRemoteBrowser()
|
||||||
{
|
{
|
||||||
|
@ -2543,6 +2572,9 @@ nsFrameLoader::TryRemoteBrowser()
|
||||||
nsCaseInsensitiveStringComparator())) {
|
nsCaseInsensitiveStringComparator())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Try to get the related content parent from our browser element.
|
||||||
|
openerContentParent = GetContentParent(mOwnerContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t chromeFlags = 0;
|
uint32_t chromeFlags = 0;
|
||||||
|
|
|
@ -607,6 +607,7 @@ GK_ATOM(middle, "middle")
|
||||||
GK_ATOM(min, "min")
|
GK_ATOM(min, "min")
|
||||||
GK_ATOM(minheight, "minheight")
|
GK_ATOM(minheight, "minheight")
|
||||||
GK_ATOM(minimum_scale, "minimum-scale")
|
GK_ATOM(minimum_scale, "minimum-scale")
|
||||||
|
GK_ATOM(minlength, "minlength")
|
||||||
GK_ATOM(minpos, "minpos")
|
GK_ATOM(minpos, "minpos")
|
||||||
GK_ATOM(minusSign, "minus-sign")
|
GK_ATOM(minusSign, "minus-sign")
|
||||||
GK_ATOM(minwidth, "minwidth")
|
GK_ATOM(minwidth, "minwidth")
|
||||||
|
|
|
@ -13827,11 +13827,7 @@ nsGlobalWindow::NotifyDefaultButtonLoaded(Element& aDefaultButton,
|
||||||
aError.Throw(NS_ERROR_FAILURE);
|
aError.Throw(NS_ERROR_FAILURE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
LayoutDeviceIntRect widgetRect;
|
LayoutDeviceIntRect widgetRect = widget->GetScreenBounds();
|
||||||
aError = widget->GetScreenBounds(widgetRect);
|
|
||||||
if (aError.Failed()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Convert the buttonRect coordinates from screen to the widget.
|
// Convert the buttonRect coordinates from screen to the widget.
|
||||||
buttonRect -= widgetRect.TopLeft();
|
buttonRect -= widgetRect.TopLeft();
|
||||||
|
|
|
@ -1278,16 +1278,37 @@ struct CycleCollectorStats
|
||||||
constexpr CycleCollectorStats() :
|
constexpr CycleCollectorStats() :
|
||||||
mMaxGCDuration(0), mRanSyncForgetSkippable(false), mSuspected(0),
|
mMaxGCDuration(0), mRanSyncForgetSkippable(false), mSuspected(0),
|
||||||
mMaxSkippableDuration(0), mMaxSliceTime(0), mMaxSliceTimeSinceClear(0),
|
mMaxSkippableDuration(0), mMaxSliceTime(0), mMaxSliceTimeSinceClear(0),
|
||||||
mTotalSliceTime(0), mAnyLockedOut(false), mExtraForgetSkippableCalls(0) {}
|
mTotalSliceTime(0), mAnyLockedOut(false), mExtraForgetSkippableCalls(0),
|
||||||
|
mFile(nullptr) {}
|
||||||
|
|
||||||
void Init()
|
void Init()
|
||||||
{
|
{
|
||||||
Clear();
|
Clear();
|
||||||
mMaxSliceTimeSinceClear = 0;
|
mMaxSliceTimeSinceClear = 0;
|
||||||
|
|
||||||
|
char* env = getenv("MOZ_CCTIMER");
|
||||||
|
if (!env) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (strcmp(env, "none") == 0) {
|
||||||
|
mFile = nullptr;
|
||||||
|
} else if (strcmp(env, "stdout") == 0) {
|
||||||
|
mFile = stdout;
|
||||||
|
} else if (strcmp(env, "stderr") == 0) {
|
||||||
|
mFile = stderr;
|
||||||
|
} else {
|
||||||
|
mFile = fopen(env, "a");
|
||||||
|
if (!mFile) {
|
||||||
|
MOZ_CRASH("Failed to open MOZ_CCTIMER log file.");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Clear()
|
void Clear()
|
||||||
{
|
{
|
||||||
|
if (mFile && mFile != stdout && mFile != stderr) {
|
||||||
|
fclose(mFile);
|
||||||
|
}
|
||||||
mBeginSliceTime = TimeStamp();
|
mBeginSliceTime = TimeStamp();
|
||||||
mEndSliceTime = TimeStamp();
|
mEndSliceTime = TimeStamp();
|
||||||
mBeginTime = TimeStamp();
|
mBeginTime = TimeStamp();
|
||||||
|
@ -1356,6 +1377,9 @@ struct CycleCollectorStats
|
||||||
bool mAnyLockedOut;
|
bool mAnyLockedOut;
|
||||||
|
|
||||||
int32_t mExtraForgetSkippableCalls;
|
int32_t mExtraForgetSkippableCalls;
|
||||||
|
|
||||||
|
// A file to dump CC activity to; set by MOZ_CCTIMER environment variable.
|
||||||
|
FILE* mFile;
|
||||||
};
|
};
|
||||||
|
|
||||||
CycleCollectorStats gCCStats;
|
CycleCollectorStats gCCStats;
|
||||||
|
@ -1593,7 +1617,7 @@ nsJSContext::EndCycleCollectionCallback(CycleCollectorResults &aResults)
|
||||||
uint32_t minForgetSkippableTime = (sMinForgetSkippableTime == UINT32_MAX)
|
uint32_t minForgetSkippableTime = (sMinForgetSkippableTime == UINT32_MAX)
|
||||||
? 0 : sMinForgetSkippableTime;
|
? 0 : sMinForgetSkippableTime;
|
||||||
|
|
||||||
if (sPostGCEventsToConsole) {
|
if (sPostGCEventsToConsole || gCCStats.mFile) {
|
||||||
nsCString mergeMsg;
|
nsCString mergeMsg;
|
||||||
if (aResults.mMergedZones) {
|
if (aResults.mMergedZones) {
|
||||||
mergeMsg.AssignLiteral(" merged");
|
mergeMsg.AssignLiteral(" merged");
|
||||||
|
@ -1623,10 +1647,15 @@ nsJSContext::EndCycleCollectionCallback(CycleCollectorResults &aResults)
|
||||||
PR_USEC_PER_MSEC,
|
PR_USEC_PER_MSEC,
|
||||||
sTotalForgetSkippableTime / PR_USEC_PER_MSEC,
|
sTotalForgetSkippableTime / PR_USEC_PER_MSEC,
|
||||||
gCCStats.mMaxSkippableDuration, sRemovedPurples));
|
gCCStats.mMaxSkippableDuration, sRemovedPurples));
|
||||||
nsCOMPtr<nsIConsoleService> cs =
|
if (sPostGCEventsToConsole) {
|
||||||
do_GetService(NS_CONSOLESERVICE_CONTRACTID);
|
nsCOMPtr<nsIConsoleService> cs =
|
||||||
if (cs) {
|
do_GetService(NS_CONSOLESERVICE_CONTRACTID);
|
||||||
cs->LogStringMessage(msg.get());
|
if (cs) {
|
||||||
|
cs->LogStringMessage(msg.get());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (gCCStats.mFile) {
|
||||||
|
fprintf(gCCStats.mFile, "%s\n", NS_ConvertUTF16toUTF8(msg).get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -357,7 +357,8 @@ nsPluginArray::EnsurePlugins()
|
||||||
if (pluginTag->IsClicktoplay()) {
|
if (pluginTag->IsClicktoplay()) {
|
||||||
nsCString name;
|
nsCString name;
|
||||||
pluginTag->GetName(name);
|
pluginTag->GetName(name);
|
||||||
if (NS_LITERAL_CSTRING("Shockwave Flash").Equals(name)) {
|
if (name.EqualsLiteral("Shockwave Flash") &&
|
||||||
|
Preferences::GetBool("plugins.navigator_hide_disabled_flash", false)) {
|
||||||
RefPtr<nsPluginHost> pluginHost = nsPluginHost::GetInst();
|
RefPtr<nsPluginHost> pluginHost = nsPluginHost::GetInst();
|
||||||
nsCString permString;
|
nsCString permString;
|
||||||
nsresult rv = pluginHost->GetPermissionStringForTag(pluginTag, 0, permString);
|
nsresult rv = pluginHost->GetPermissionStringForTag(pluginTag, 0, permString);
|
||||||
|
|
|
@ -1926,7 +1926,10 @@ nsScriptLoader::FillCompileOptionsForRequest(const AutoJSAPI &jsapi,
|
||||||
// aRequest ended up getting script data from, as the script filename.
|
// aRequest ended up getting script data from, as the script filename.
|
||||||
nsContentUtils::GetWrapperSafeScriptFilename(mDocument, aRequest->mURI, aRequest->mURL);
|
nsContentUtils::GetWrapperSafeScriptFilename(mDocument, aRequest->mURI, aRequest->mURL);
|
||||||
|
|
||||||
aOptions->setIntroductionType("scriptElement");
|
bool isScriptElement = !aRequest->IsModuleRequest() ||
|
||||||
|
aRequest->AsModuleRequest()->IsTopLevel();
|
||||||
|
aOptions->setIntroductionType(isScriptElement ? "scriptElement"
|
||||||
|
: "importedModule");
|
||||||
aOptions->setFileAndLine(aRequest->mURL.get(), aRequest->mLineNo);
|
aOptions->setFileAndLine(aRequest->mURL.get(), aRequest->mLineNo);
|
||||||
aOptions->setVersion(JSVersion(aRequest->mJSVersion));
|
aOptions->setVersion(JSVersion(aRequest->mJSVersion));
|
||||||
aOptions->setIsRunOnce(true);
|
aOptions->setIsRunOnce(true);
|
||||||
|
|
|
@ -203,6 +203,7 @@ nsIAtom** const kAttributesHTML[] = {
|
||||||
&nsGkAtoms::media,
|
&nsGkAtoms::media,
|
||||||
&nsGkAtoms::method,
|
&nsGkAtoms::method,
|
||||||
&nsGkAtoms::min,
|
&nsGkAtoms::min,
|
||||||
|
&nsGkAtoms::minlength,
|
||||||
&nsGkAtoms::multiple,
|
&nsGkAtoms::multiple,
|
||||||
&nsGkAtoms::muted,
|
&nsGkAtoms::muted,
|
||||||
&nsGkAtoms::name,
|
&nsGkAtoms::name,
|
||||||
|
|
|
@ -18,6 +18,8 @@ support-files =
|
||||||
module_large1.js
|
module_large1.js
|
||||||
module_large2.js
|
module_large2.js
|
||||||
module_large3.js
|
module_large3.js
|
||||||
|
module_extractIntroType.js
|
||||||
|
iframe_extractIntroType.html
|
||||||
|
|
||||||
[test_moduleScriptsRun.html]
|
[test_moduleScriptsRun.html]
|
||||||
[test_moduleParsedAsModule.html]
|
[test_moduleParsedAsModule.html]
|
||||||
|
@ -42,3 +44,5 @@ support-files =
|
||||||
[test_multiModuleLargeImports.html]
|
[test_multiModuleLargeImports.html]
|
||||||
[test_asyncInlineModules.html]
|
[test_asyncInlineModules.html]
|
||||||
[test_scriptInsertedModule.html]
|
[test_scriptInsertedModule.html]
|
||||||
|
[test_topLevelIntroType.html]
|
||||||
|
[test_importIntroType.html]
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<meta charset=utf-8>
|
||||||
|
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||||
|
<script>
|
||||||
|
// Hook up the debugger statement to extract the calling script's
|
||||||
|
// introductionType and set it in a property on the parent global.
|
||||||
|
Components.utils.import("resource://gre/modules/jsdebugger.jsm");
|
||||||
|
addDebuggerToGlobal(this);
|
||||||
|
var dbg = new Debugger;
|
||||||
|
dbg.addDebuggee(parent);
|
||||||
|
dbg.onDebuggerStatement = function (frame) {
|
||||||
|
parent.introType = frame.script.source.introductionType;
|
||||||
|
}
|
||||||
|
</script>
|
|
@ -0,0 +1,5 @@
|
||||||
|
// Extract the introductionType for this module in conjunction with
|
||||||
|
// iframe_extractIntroType.html.
|
||||||
|
extractIntroType = function() {
|
||||||
|
debugger;
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<meta charset=utf-8>
|
||||||
|
<title>Test introduction type of an imported module</title>
|
||||||
|
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||||
|
<script>
|
||||||
|
var introType;
|
||||||
|
var extractIntroType;
|
||||||
|
|
||||||
|
info('start');
|
||||||
|
SimpleTest.waitForExplicitFinish();
|
||||||
|
|
||||||
|
function testIntroductionType() {
|
||||||
|
extractIntroType();
|
||||||
|
ok(introType == "importedModule", 'Check introduction type');
|
||||||
|
SimpleTest.finish();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<iframe src="iframe_extractIntroType.html"></iframe>
|
||||||
|
<script type="module">
|
||||||
|
import "./module_extractIntroType.js";
|
||||||
|
</script>
|
||||||
|
<body onload='testIntroductionType()'></body>
|
|
@ -0,0 +1,21 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<meta charset=utf-8>
|
||||||
|
<title>Test introduction type of a top-level module</title>
|
||||||
|
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||||
|
<script>
|
||||||
|
var introType;
|
||||||
|
var extractIntroType;
|
||||||
|
|
||||||
|
info('start');
|
||||||
|
SimpleTest.waitForExplicitFinish();
|
||||||
|
|
||||||
|
function testIntroductionType() {
|
||||||
|
extractIntroType();
|
||||||
|
ok(introType == "scriptElement", 'Check introduction type');
|
||||||
|
SimpleTest.finish();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<iframe src="iframe_extractIntroType.html"></iframe>
|
||||||
|
<script type="module" src="module_extractIntroType.js">
|
||||||
|
</script>
|
||||||
|
<body onload='testIntroductionType()'></body>
|
|
@ -395,7 +395,7 @@ BroadcastChannel::Constructor(const GlobalObject& aGlobal,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
bc->mWorkerHolder = new BroadcastChannelWorkerHolder(bc);
|
bc->mWorkerHolder = new BroadcastChannelWorkerHolder(bc);
|
||||||
if (NS_WARN_IF(!bc->mWorkerHolder->HoldWorker(workerPrivate))) {
|
if (NS_WARN_IF(!bc->mWorkerHolder->HoldWorker(workerPrivate, Closing))) {
|
||||||
bc->mWorkerHolder = nullptr;
|
bc->mWorkerHolder = nullptr;
|
||||||
aRv.Throw(NS_ERROR_FAILURE);
|
aRv.Throw(NS_ERROR_FAILURE);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
|
@ -24,7 +24,7 @@ CacheWorkerHolder::Create(WorkerPrivate* aWorkerPrivate)
|
||||||
MOZ_ASSERT(aWorkerPrivate);
|
MOZ_ASSERT(aWorkerPrivate);
|
||||||
|
|
||||||
RefPtr<CacheWorkerHolder> workerHolder = new CacheWorkerHolder();
|
RefPtr<CacheWorkerHolder> workerHolder = new CacheWorkerHolder();
|
||||||
if (NS_WARN_IF(!workerHolder->HoldWorker(aWorkerPrivate))) {
|
if (NS_WARN_IF(!workerHolder->HoldWorker(aWorkerPrivate, Terminating))) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1156,7 +1156,8 @@ CanvasRenderingContext2D::Reset()
|
||||||
gCanvasAzureMemoryUsed -= mWidth * mHeight * 4;
|
gCanvasAzureMemoryUsed -= mWidth * mHeight * 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnTarget();
|
bool forceReset = true;
|
||||||
|
ReturnTarget(forceReset);
|
||||||
mTarget = nullptr;
|
mTarget = nullptr;
|
||||||
mBufferProvider = nullptr;
|
mBufferProvider = nullptr;
|
||||||
|
|
||||||
|
@ -1645,25 +1646,28 @@ CanvasRenderingContext2D::EnsureTarget(const gfx::Rect* aCoveredRect,
|
||||||
Redraw();
|
Redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restore clips and transform.
|
if (mBufferProvider != oldBufferProvider || !mBufferProvider ||
|
||||||
mTarget->SetTransform(Matrix());
|
!mBufferProvider->PreservesDrawingState()) {
|
||||||
|
// Restore clips and transform.
|
||||||
|
mTarget->SetTransform(Matrix());
|
||||||
|
|
||||||
if (mTarget->GetBackendType() == gfx::BackendType::CAIRO) {
|
if (mTarget->GetBackendType() == gfx::BackendType::CAIRO) {
|
||||||
// Cairo doesn't play well with huge clips. When given a very big clip it
|
// Cairo doesn't play well with huge clips. When given a very big clip it
|
||||||
// will try to allocate big mask surface without taking the target
|
// will try to allocate big mask surface without taking the target
|
||||||
// size into account which can cause OOM. See bug 1034593.
|
// size into account which can cause OOM. See bug 1034593.
|
||||||
// This limits the clip extents to the size of the canvas.
|
// This limits the clip extents to the size of the canvas.
|
||||||
// A fix in Cairo would probably be preferable, but requires somewhat
|
// A fix in Cairo would probably be preferable, but requires somewhat
|
||||||
// invasive changes.
|
// invasive changes.
|
||||||
mTarget->PushClipRect(canvasRect);
|
mTarget->PushClipRect(canvasRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const auto& style : mStyleStack) {
|
for (const auto& style : mStyleStack) {
|
||||||
for (const auto& clipOrTransform : style.clipsAndTransforms) {
|
for (const auto& clipOrTransform : style.clipsAndTransforms) {
|
||||||
if (clipOrTransform.IsClip()) {
|
if (clipOrTransform.IsClip()) {
|
||||||
mTarget->PushClip(clipOrTransform.clip);
|
mTarget->PushClip(clipOrTransform.clip);
|
||||||
} else {
|
} else {
|
||||||
mTarget->SetTransform(clipOrTransform.transform);
|
mTarget->SetTransform(clipOrTransform.transform);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1772,22 +1776,24 @@ CanvasRenderingContext2D::ClearTarget(bool aRetainBuffer)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CanvasRenderingContext2D::ReturnTarget()
|
CanvasRenderingContext2D::ReturnTarget(bool aForceReset)
|
||||||
{
|
{
|
||||||
if (mTarget && mBufferProvider && mTarget != sErrorTarget) {
|
if (mTarget && mBufferProvider && mTarget != sErrorTarget) {
|
||||||
CurrentState().transform = mTarget->GetTransform();
|
CurrentState().transform = mTarget->GetTransform();
|
||||||
for (const auto& style : mStyleStack) {
|
if (aForceReset || !mBufferProvider->PreservesDrawingState()) {
|
||||||
for (const auto& clipOrTransform : style.clipsAndTransforms) {
|
for (const auto& style : mStyleStack) {
|
||||||
if (clipOrTransform.IsClip()) {
|
for (const auto& clipOrTransform : style.clipsAndTransforms) {
|
||||||
mTarget->PopClip();
|
if (clipOrTransform.IsClip()) {
|
||||||
|
mTarget->PopClip();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (mTarget->GetBackendType() == gfx::BackendType::CAIRO) {
|
if (mTarget->GetBackendType() == gfx::BackendType::CAIRO) {
|
||||||
// With the cairo backend we pushed an extra clip rect which we have to
|
// With the cairo backend we pushed an extra clip rect which we have to
|
||||||
// balance out here. See the comment in EnsureDrawTarget.
|
// balance out here. See the comment in EnsureDrawTarget.
|
||||||
mTarget->PopClip();
|
mTarget->PopClip();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mBufferProvider->ReturnDrawTarget(mTarget.forget());
|
mBufferProvider->ReturnDrawTarget(mTarget.forget());
|
||||||
|
|
|
@ -665,7 +665,7 @@ protected:
|
||||||
* Returns the target to the buffer provider. i.e. this will queue a frame for
|
* Returns the target to the buffer provider. i.e. this will queue a frame for
|
||||||
* rendering.
|
* rendering.
|
||||||
*/
|
*/
|
||||||
void ReturnTarget();
|
void ReturnTarget(bool aForceReset = false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the target is valid after calling EnsureTarget.
|
* Check if the target is valid after calling EnsureTarget.
|
||||||
|
|
|
@ -40,6 +40,7 @@ const SEC_ASN1Template SGN_DigestInfoTemplate[] = {
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace dom {
|
namespace dom {
|
||||||
|
|
||||||
|
using mozilla::dom::workers::Canceling;
|
||||||
using mozilla::dom::workers::GetCurrentThreadWorkerPrivate;
|
using mozilla::dom::workers::GetCurrentThreadWorkerPrivate;
|
||||||
using mozilla::dom::workers::Status;
|
using mozilla::dom::workers::Status;
|
||||||
using mozilla::dom::workers::WorkerHolder;
|
using mozilla::dom::workers::WorkerHolder;
|
||||||
|
@ -161,7 +162,7 @@ public:
|
||||||
WorkerPrivate* workerPrivate = GetCurrentThreadWorkerPrivate();
|
WorkerPrivate* workerPrivate = GetCurrentThreadWorkerPrivate();
|
||||||
MOZ_ASSERT(workerPrivate);
|
MOZ_ASSERT(workerPrivate);
|
||||||
RefPtr<InternalWorkerHolder> ref = new InternalWorkerHolder();
|
RefPtr<InternalWorkerHolder> ref = new InternalWorkerHolder();
|
||||||
if (NS_WARN_IF(!ref->HoldWorker(workerPrivate))) {
|
if (NS_WARN_IF(!ref->HoldWorker(workerPrivate, Canceling))) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
return ref.forget();
|
return ref.forget();
|
||||||
|
|
|
@ -96,7 +96,7 @@ DataTransfer::DataTransfer(nsISupports* aParent, EventMessage aEventMessage,
|
||||||
, mDragImageX(0)
|
, mDragImageX(0)
|
||||||
, mDragImageY(0)
|
, mDragImageY(0)
|
||||||
{
|
{
|
||||||
mItems = new DataTransferItemList(this, aIsExternal, false /* aIsCrossDomainSubFrameDrop */);
|
mItems = new DataTransferItemList(this, aIsExternal);
|
||||||
// For these events, we want to be able to add data to the data transfer, so
|
// For these events, we want to be able to add data to the data transfer, so
|
||||||
// clear the readonly state. Otherwise, the data is already present. For
|
// clear the readonly state. Otherwise, the data is already present. For
|
||||||
// external usage, cache the data from the native clipboard or drag.
|
// external usage, cache the data from the native clipboard or drag.
|
||||||
|
@ -335,11 +335,19 @@ DataTransfer::GetTypes(ErrorResult& aRv) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we have any files, add the "Files" string to the list
|
for (uint32_t i = 0; i < mItems->Length(); ++i) {
|
||||||
if (mItems->Files()->Length() > 0 &&
|
ErrorResult rv;
|
||||||
NS_WARN_IF(!types->Add(NS_LITERAL_STRING("Files")))) {
|
bool found = false;
|
||||||
aRv.Throw(NS_ERROR_FAILURE);
|
DataTransferItem* item = mItems->IndexedGetter(i, found, rv);
|
||||||
return nullptr;
|
if (!found || rv.Failed() || item->Kind() != DataTransferItem::KIND_FILE) {
|
||||||
|
rv.SuppressException();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (NS_WARN_IF(!types->Add(NS_LITERAL_STRING("Files")))) {
|
||||||
|
aRv.Throw(NS_ERROR_FAILURE);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return types.forget();
|
return types.forget();
|
||||||
|
@ -608,14 +616,6 @@ DataTransfer::GetDataAtInternal(const nsAString& aFormat, uint32_t aIndex,
|
||||||
nsAutoString format;
|
nsAutoString format;
|
||||||
GetRealFormat(aFormat, format);
|
GetRealFormat(aFormat, format);
|
||||||
|
|
||||||
// Check if the caller is allowed to access the drag data. Callers with
|
|
||||||
// chrome privileges can always read the data. During the
|
|
||||||
// drop event, allow retrieving the data except in the case where the
|
|
||||||
// source of the drag is in a child frame of the caller. In that case,
|
|
||||||
// we only allow access to data of the same principal. During other events,
|
|
||||||
// only allow access to the data with the same principal.
|
|
||||||
bool checkFormatItemPrincipal = mIsCrossDomainSubFrameDrop ||
|
|
||||||
(mEventMessage != eDrop && mEventMessage != ePaste);
|
|
||||||
MOZ_ASSERT(aSubjectPrincipal);
|
MOZ_ASSERT(aSubjectPrincipal);
|
||||||
|
|
||||||
RefPtr<DataTransferItem> item = mItems->MozItemByTypeAt(format, aIndex);
|
RefPtr<DataTransferItem> item = mItems->MozItemByTypeAt(format, aIndex);
|
||||||
|
@ -630,34 +630,11 @@ DataTransfer::GetDataAtInternal(const nsAString& aFormat, uint32_t aIndex,
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item->Principal() && checkFormatItemPrincipal &&
|
// DataTransferItem::Data() handles the principal checks
|
||||||
!aSubjectPrincipal->Subsumes(item->Principal())) {
|
ErrorResult result;
|
||||||
return NS_ERROR_DOM_SECURITY_ERR;
|
nsCOMPtr<nsIVariant> data = item->Data(aSubjectPrincipal, result);
|
||||||
}
|
if (NS_WARN_IF(!data || result.Failed())) {
|
||||||
|
return result.StealNSResult();
|
||||||
nsCOMPtr<nsIVariant> data = item->Data();
|
|
||||||
if (!data) {
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsCOMPtr<nsISupports> isupportsData;
|
|
||||||
nsresult rv = data->GetAsISupports(getter_AddRefs(isupportsData));
|
|
||||||
|
|
||||||
if (NS_SUCCEEDED(rv) && isupportsData) {
|
|
||||||
// Make sure the code that is calling us is same-origin with the data.
|
|
||||||
nsCOMPtr<EventTarget> pt = do_QueryInterface(isupportsData);
|
|
||||||
if (pt) {
|
|
||||||
nsresult rv = NS_OK;
|
|
||||||
nsIScriptContext* c = pt->GetContextForEventHandlers(&rv);
|
|
||||||
NS_ENSURE_TRUE(c && NS_SUCCEEDED(rv), NS_ERROR_DOM_SECURITY_ERR);
|
|
||||||
nsIGlobalObject* go = c->GetGlobalObject();
|
|
||||||
NS_ENSURE_TRUE(go, NS_ERROR_DOM_SECURITY_ERR);
|
|
||||||
nsCOMPtr<nsIScriptObjectPrincipal> sp = do_QueryInterface(go);
|
|
||||||
MOZ_ASSERT(sp, "This cannot fail on the main thread.");
|
|
||||||
nsIPrincipal* dataPrincipal = sp->GetPrincipal();
|
|
||||||
NS_ENSURE_TRUE(dataPrincipal, NS_ERROR_DOM_SECURITY_ERR);
|
|
||||||
NS_ENSURE_TRUE(aSubjectPrincipal->Subsumes(dataPrincipal), NS_ERROR_DOM_SECURITY_ERR);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
data.forget(aData);
|
data.forget(aData);
|
||||||
|
@ -1020,7 +997,8 @@ DataTransfer::GetTransferable(uint32_t aIndex, nsILoadContext* aLoadContext)
|
||||||
do {
|
do {
|
||||||
for (uint32_t f = 0; f < count; f++) {
|
for (uint32_t f = 0; f < count; f++) {
|
||||||
RefPtr<DataTransferItem> formatitem = item[f];
|
RefPtr<DataTransferItem> formatitem = item[f];
|
||||||
if (!formatitem->Data()) { // skip empty items
|
nsCOMPtr<nsIVariant> variant = formatitem->DataNoSecurityCheck();
|
||||||
|
if (!variant) { // skip empty items
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1040,7 +1018,7 @@ DataTransfer::GetTransferable(uint32_t aIndex, nsILoadContext* aLoadContext)
|
||||||
nsCOMPtr<nsISupports> convertedData;
|
nsCOMPtr<nsISupports> convertedData;
|
||||||
|
|
||||||
if (handlingCustomFormats) {
|
if (handlingCustomFormats) {
|
||||||
if (!ConvertFromVariant(formatitem->Data(), getter_AddRefs(convertedData),
|
if (!ConvertFromVariant(variant, getter_AddRefs(convertedData),
|
||||||
&lengthInBytes)) {
|
&lengthInBytes)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1125,7 +1103,7 @@ DataTransfer::GetTransferable(uint32_t aIndex, nsILoadContext* aLoadContext)
|
||||||
} else {
|
} else {
|
||||||
// This is the second pass of the loop and a known type is encountered.
|
// This is the second pass of the loop and a known type is encountered.
|
||||||
// Add it as is.
|
// Add it as is.
|
||||||
if (!ConvertFromVariant(formatitem->Data(), getter_AddRefs(convertedData),
|
if (!ConvertFromVariant(variant, getter_AddRefs(convertedData),
|
||||||
&lengthInBytes)) {
|
&lengthInBytes)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1477,16 +1455,17 @@ void
|
||||||
DataTransfer::FillInExternalCustomTypes(uint32_t aIndex,
|
DataTransfer::FillInExternalCustomTypes(uint32_t aIndex,
|
||||||
nsIPrincipal* aPrincipal)
|
nsIPrincipal* aPrincipal)
|
||||||
{
|
{
|
||||||
RefPtr<DataTransferItem> item = new DataTransferItem(mItems,
|
RefPtr<DataTransferItem> item = new DataTransferItem(this,
|
||||||
NS_LITERAL_STRING(kCustomTypesMime));
|
NS_LITERAL_STRING(kCustomTypesMime));
|
||||||
item->SetKind(DataTransferItem::KIND_STRING);
|
item->SetKind(DataTransferItem::KIND_STRING);
|
||||||
item->SetIndex(aIndex);
|
item->SetIndex(aIndex);
|
||||||
|
|
||||||
if (!item->Data()) {
|
nsCOMPtr<nsIVariant> variant = item->DataNoSecurityCheck();
|
||||||
|
if (!variant) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
FillInExternalCustomTypes(item->Data(), aIndex, aPrincipal);
|
FillInExternalCustomTypes(variant, aIndex, aPrincipal);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -195,15 +195,28 @@ public:
|
||||||
nsresult GetDataAtNoSecurityCheck(const nsAString& aFormat, uint32_t aIndex,
|
nsresult GetDataAtNoSecurityCheck(const nsAString& aFormat, uint32_t aIndex,
|
||||||
nsIVariant** aData);
|
nsIVariant** aData);
|
||||||
|
|
||||||
|
DataTransferItemList* Items() const {
|
||||||
|
return mItems;
|
||||||
|
}
|
||||||
|
|
||||||
// a readonly dataTransfer cannot have new data added or existing data
|
// a readonly dataTransfer cannot have new data added or existing data
|
||||||
// removed. Only the dropEffect and effectAllowed may be modified.
|
// removed. Only the dropEffect and effectAllowed may be modified.
|
||||||
DataTransferItemList* Items() const { return mItems; }
|
bool IsReadOnly() const {
|
||||||
|
return mReadOnly;
|
||||||
|
}
|
||||||
|
void SetReadOnly() {
|
||||||
|
mReadOnly = true;
|
||||||
|
}
|
||||||
|
|
||||||
bool IsReadOnly() const { return mReadOnly; }
|
int32_t ClipboardType() const {
|
||||||
void SetReadOnly() { mReadOnly = true; }
|
return mClipboardType;
|
||||||
|
}
|
||||||
int32_t ClipboardType() const { return mClipboardType; }
|
EventMessage GetEventMessage() const {
|
||||||
EventMessage GetEventMessage() const { return mEventMessage; }
|
return mEventMessage;
|
||||||
|
}
|
||||||
|
bool IsCrossDomainSubFrameDrop() const {
|
||||||
|
return mIsCrossDomainSubFrameDrop;
|
||||||
|
}
|
||||||
|
|
||||||
// converts the data into an array of nsITransferable objects to be used for
|
// converts the data into an array of nsITransferable objects to be used for
|
||||||
// drag and drop or clipboard operations.
|
// drag and drop or clipboard operations.
|
||||||
|
|
|
@ -10,12 +10,13 @@
|
||||||
#include "mozilla/EventForwards.h"
|
#include "mozilla/EventForwards.h"
|
||||||
#include "mozilla/dom/DataTransferItemBinding.h"
|
#include "mozilla/dom/DataTransferItemBinding.h"
|
||||||
#include "mozilla/dom/Directory.h"
|
#include "mozilla/dom/Directory.h"
|
||||||
#include "mozilla/dom/DirectoryEntry.h"
|
|
||||||
#include "mozilla/dom/DOMFileSystem.h"
|
|
||||||
#include "mozilla/dom/Event.h"
|
#include "mozilla/dom/Event.h"
|
||||||
#include "mozilla/dom/FileEntry.h"
|
#include "mozilla/dom/FileSystem.h"
|
||||||
|
#include "mozilla/dom/FileSystemDirectoryEntry.h"
|
||||||
|
#include "mozilla/dom/FileSystemFileEntry.h"
|
||||||
#include "nsIClipboard.h"
|
#include "nsIClipboard.h"
|
||||||
#include "nsISupportsPrimitives.h"
|
#include "nsISupportsPrimitives.h"
|
||||||
|
#include "nsIScriptObjectPrincipal.h"
|
||||||
#include "nsNetUtil.h"
|
#include "nsNetUtil.h"
|
||||||
#include "nsQueryObject.h"
|
#include "nsQueryObject.h"
|
||||||
#include "nsContentUtils.h"
|
#include "nsContentUtils.h"
|
||||||
|
@ -40,7 +41,7 @@ namespace mozilla {
|
||||||
namespace dom {
|
namespace dom {
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(DataTransferItem, mData,
|
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(DataTransferItem, mData,
|
||||||
mPrincipal, mParent, mCachedFile)
|
mPrincipal, mDataTransfer, mCachedFile)
|
||||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(DataTransferItem)
|
NS_IMPL_CYCLE_COLLECTING_ADDREF(DataTransferItem)
|
||||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(DataTransferItem)
|
NS_IMPL_CYCLE_COLLECTING_RELEASE(DataTransferItem)
|
||||||
|
|
||||||
|
@ -56,11 +57,11 @@ DataTransferItem::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<DataTransferItem>
|
already_AddRefed<DataTransferItem>
|
||||||
DataTransferItem::Clone(DataTransferItemList* aParent) const
|
DataTransferItem::Clone(DataTransfer* aDataTransfer) const
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aParent);
|
MOZ_ASSERT(aDataTransfer);
|
||||||
|
|
||||||
RefPtr<DataTransferItem> it = new DataTransferItem(aParent, mType);
|
RefPtr<DataTransferItem> it = new DataTransferItem(aDataTransfer, mType);
|
||||||
|
|
||||||
// Copy over all of the fields
|
// Copy over all of the fields
|
||||||
it->mKind = mKind;
|
it->mKind = mKind;
|
||||||
|
@ -153,16 +154,16 @@ DataTransferItem::FillInExternalData()
|
||||||
trans->Init(nullptr);
|
trans->Init(nullptr);
|
||||||
trans->AddDataFlavor(format);
|
trans->AddDataFlavor(format);
|
||||||
|
|
||||||
if (mParent->GetEventMessage() == ePaste) {
|
if (mDataTransfer->GetEventMessage() == ePaste) {
|
||||||
MOZ_ASSERT(mIndex == 0, "index in clipboard must be 0");
|
MOZ_ASSERT(mIndex == 0, "index in clipboard must be 0");
|
||||||
|
|
||||||
nsCOMPtr<nsIClipboard> clipboard =
|
nsCOMPtr<nsIClipboard> clipboard =
|
||||||
do_GetService("@mozilla.org/widget/clipboard;1");
|
do_GetService("@mozilla.org/widget/clipboard;1");
|
||||||
if (!clipboard || mParent->ClipboardType() < 0) {
|
if (!clipboard || mDataTransfer->ClipboardType() < 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult rv = clipboard->GetData(trans, mParent->ClipboardType());
|
nsresult rv = clipboard->GetData(trans, mDataTransfer->ClipboardType());
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -238,8 +239,8 @@ DataTransferItem::GetAsFile(ErrorResult& aRv)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIVariant* data = Data();
|
nsCOMPtr<nsIVariant> data = Data(nsContentUtils::SubjectPrincipal(), aRv);
|
||||||
if (NS_WARN_IF(!data)) {
|
if (NS_WARN_IF(!data || aRv.Failed())) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -259,9 +260,9 @@ DataTransferItem::GetAsFile(ErrorResult& aRv)
|
||||||
mCachedFile = blob->ToFile();
|
mCachedFile = blob->ToFile();
|
||||||
} else if (nsCOMPtr<BlobImpl> blobImpl = do_QueryInterface(supports)) {
|
} else if (nsCOMPtr<BlobImpl> blobImpl = do_QueryInterface(supports)) {
|
||||||
MOZ_ASSERT(blobImpl->IsFile());
|
MOZ_ASSERT(blobImpl->IsFile());
|
||||||
mCachedFile = File::Create(GetParentObject(), blobImpl);
|
mCachedFile = File::Create(mDataTransfer, blobImpl);
|
||||||
} else if (nsCOMPtr<nsIFile> ifile = do_QueryInterface(supports)) {
|
} else if (nsCOMPtr<nsIFile> ifile = do_QueryInterface(supports)) {
|
||||||
mCachedFile = File::CreateFromFile(GetParentObject(), ifile);
|
mCachedFile = File::CreateFromFile(mDataTransfer, ifile);
|
||||||
} else {
|
} else {
|
||||||
MOZ_ASSERT(false, "One of the above code paths should be taken");
|
MOZ_ASSERT(false, "One of the above code paths should be taken");
|
||||||
}
|
}
|
||||||
|
@ -271,7 +272,7 @@ DataTransferItem::GetAsFile(ErrorResult& aRv)
|
||||||
return file.forget();
|
return file.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<Entry>
|
already_AddRefed<FileSystemEntry>
|
||||||
DataTransferItem::GetAsEntry(ErrorResult& aRv)
|
DataTransferItem::GetAsEntry(ErrorResult& aRv)
|
||||||
{
|
{
|
||||||
RefPtr<File> file = GetAsFile(aRv);
|
RefPtr<File> file = GetAsFile(aRv);
|
||||||
|
@ -280,25 +281,14 @@ DataTransferItem::GetAsEntry(ErrorResult& aRv)
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIGlobalObject> global;
|
nsCOMPtr<nsIGlobalObject> global;
|
||||||
RefPtr<DataTransfer> dataTransfer;
|
|
||||||
RefPtr<DataTransferItemList> list = GetParentObject();
|
|
||||||
if (!list) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
dataTransfer = list->GetParentObject();
|
|
||||||
if (!dataTransfer) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
// This is annoying, but DataTransfer may have various things as parent.
|
// This is annoying, but DataTransfer may have various things as parent.
|
||||||
nsCOMPtr<EventTarget> target =
|
nsCOMPtr<EventTarget> target =
|
||||||
do_QueryInterface(dataTransfer->GetParentObject());
|
do_QueryInterface(mDataTransfer->GetParentObject());
|
||||||
if (target) {
|
if (target) {
|
||||||
global = target->GetOwnerGlobal();
|
global = target->GetOwnerGlobal();
|
||||||
} else {
|
} else {
|
||||||
nsCOMPtr<nsIDOMEvent> event =
|
nsCOMPtr<nsIDOMEvent> event =
|
||||||
do_QueryInterface(dataTransfer->GetParentObject());
|
do_QueryInterface(mDataTransfer->GetParentObject());
|
||||||
if (event) {
|
if (event) {
|
||||||
global = event->InternalDOMEvent()->GetParentObject();
|
global = event->InternalDOMEvent()->GetParentObject();
|
||||||
}
|
}
|
||||||
|
@ -308,8 +298,8 @@ DataTransferItem::GetAsEntry(ErrorResult& aRv)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
RefPtr<DOMFileSystem> fs = DOMFileSystem::Create(global);
|
RefPtr<FileSystem> fs = FileSystem::Create(global);
|
||||||
RefPtr<Entry> entry;
|
RefPtr<FileSystemEntry> entry;
|
||||||
BlobImpl* impl = file->Impl();
|
BlobImpl* impl = file->Impl();
|
||||||
MOZ_ASSERT(impl);
|
MOZ_ASSERT(impl);
|
||||||
|
|
||||||
|
@ -329,12 +319,12 @@ DataTransferItem::GetAsEntry(ErrorResult& aRv)
|
||||||
}
|
}
|
||||||
|
|
||||||
RefPtr<Directory> directory = Directory::Create(global, directoryFile);
|
RefPtr<Directory> directory = Directory::Create(global, directoryFile);
|
||||||
entry = new DirectoryEntry(global, directory, fs);
|
entry = new FileSystemDirectoryEntry(global, directory, fs);
|
||||||
} else {
|
} else {
|
||||||
entry = new FileEntry(global, file, fs);
|
entry = new FileSystemFileEntry(global, file, fs);
|
||||||
}
|
}
|
||||||
|
|
||||||
Sequence<RefPtr<Entry>> entries;
|
Sequence<RefPtr<FileSystemEntry>> entries;
|
||||||
if (!entries.AppendElement(entry, fallible)) {
|
if (!entries.AppendElement(entry, fallible)) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -377,7 +367,7 @@ DataTransferItem::CreateFileFromInputStream(nsIInputStream* aStream)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return File::CreateMemoryFile(GetParentObject(), data, available, fileName,
|
return File::CreateMemoryFile(mDataTransfer, data, available, fileName,
|
||||||
mType, PR_Now());
|
mType, PR_Now());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -390,17 +380,18 @@ DataTransferItem::GetAsString(FunctionStringCallback* aCallback,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Theoretically this should be done inside of the runnable, as it might be an
|
// Theoretically this should be done inside of the runnable, as it might be an
|
||||||
// expensive operation on some systems. However, it doesn't really matter as
|
// expensive operation on some systems, however we wouldn't get access to the
|
||||||
// in order to get a DataTransferItem, we need to call
|
// NS_ERROR_DOM_SECURITY_ERROR messages which may be raised by this method.
|
||||||
// DataTransferItemList::IndexedGetter which already calls the Data method,
|
nsCOMPtr<nsIVariant> data = Data(nsContentUtils::SubjectPrincipal(), aRv);
|
||||||
// meaning that this operation is basically free.
|
if (NS_WARN_IF(!data || aRv.Failed())) {
|
||||||
nsIVariant* data = Data();
|
|
||||||
if (NS_WARN_IF(!data)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsAutoString stringData;
|
nsAutoString stringData;
|
||||||
data->GetAsAString(stringData);
|
nsresult rv = data->GetAsAString(stringData);
|
||||||
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Dispatch the callback to the main thread
|
// Dispatch the callback to the main thread
|
||||||
class GASRunnable final : public Runnable
|
class GASRunnable final : public Runnable
|
||||||
|
@ -424,12 +415,92 @@ DataTransferItem::GetAsString(FunctionStringCallback* aCallback,
|
||||||
};
|
};
|
||||||
|
|
||||||
RefPtr<GASRunnable> runnable = new GASRunnable(aCallback, stringData);
|
RefPtr<GASRunnable> runnable = new GASRunnable(aCallback, stringData);
|
||||||
nsresult rv = NS_DispatchToMainThread(runnable);
|
rv = NS_DispatchToMainThread(runnable);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
NS_WARNING("NS_DispatchToMainThread Failed in "
|
NS_WARNING("NS_DispatchToMainThread Failed in "
|
||||||
"DataTransferItem::GetAsString!");
|
"DataTransferItem::GetAsString!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
already_AddRefed<nsIVariant>
|
||||||
|
DataTransferItem::DataNoSecurityCheck()
|
||||||
|
{
|
||||||
|
if (!mData) {
|
||||||
|
FillInExternalData();
|
||||||
|
}
|
||||||
|
nsCOMPtr<nsIVariant> data = mData;
|
||||||
|
return data.forget();
|
||||||
|
}
|
||||||
|
|
||||||
|
already_AddRefed<nsIVariant>
|
||||||
|
DataTransferItem::Data(nsIPrincipal* aPrincipal, ErrorResult& aRv)
|
||||||
|
{
|
||||||
|
MOZ_ASSERT(aPrincipal);
|
||||||
|
|
||||||
|
nsCOMPtr<nsIVariant> variant = DataNoSecurityCheck();
|
||||||
|
|
||||||
|
// If the inbound principal is system, we can skip the below checks, as
|
||||||
|
// they will trivially succeed.
|
||||||
|
if (nsContentUtils::IsSystemPrincipal(aPrincipal)) {
|
||||||
|
return variant.forget();
|
||||||
|
}
|
||||||
|
|
||||||
|
MOZ_ASSERT(!ChromeOnly(), "Non-chrome code shouldn't see a ChromeOnly DataTransferItem");
|
||||||
|
if (ChromeOnly()) {
|
||||||
|
aRv.Throw(NS_ERROR_DOM_SECURITY_ERR);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool checkItemPrincipal = mDataTransfer->IsCrossDomainSubFrameDrop() ||
|
||||||
|
(mDataTransfer->GetEventMessage() != eDrop &&
|
||||||
|
mDataTransfer->GetEventMessage() != ePaste);
|
||||||
|
|
||||||
|
// Check if the caller is allowed to access the drag data. Callers with
|
||||||
|
// chrome privileges can always read the data. During the
|
||||||
|
// drop event, allow retrieving the data except in the case where the
|
||||||
|
// source of the drag is in a child frame of the caller. In that case,
|
||||||
|
// we only allow access to data of the same principal. During other events,
|
||||||
|
// only allow access to the data with the same principal.
|
||||||
|
if (Principal() && checkItemPrincipal &&
|
||||||
|
!aPrincipal->Subsumes(Principal())) {
|
||||||
|
aRv.Throw(NS_ERROR_DOM_SECURITY_ERR);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!variant) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
nsCOMPtr<nsISupports> data;
|
||||||
|
nsresult rv = variant->GetAsISupports(getter_AddRefs(data));
|
||||||
|
if (NS_SUCCEEDED(rv) && data) {
|
||||||
|
nsCOMPtr<EventTarget> pt = do_QueryInterface(data);
|
||||||
|
if (pt) {
|
||||||
|
nsIScriptContext* c = pt->GetContextForEventHandlers(&rv);
|
||||||
|
if (NS_WARN_IF(NS_FAILED(rv) || !c)) {
|
||||||
|
aRv.Throw(NS_ERROR_DOM_SECURITY_ERR);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
nsIGlobalObject* go = c->GetGlobalObject();
|
||||||
|
if (NS_WARN_IF(!go)) {
|
||||||
|
aRv.Throw(NS_ERROR_DOM_SECURITY_ERR);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
nsCOMPtr<nsIScriptObjectPrincipal> sp = do_QueryInterface(go);
|
||||||
|
MOZ_ASSERT(sp, "This cannot fail on the main thread.");
|
||||||
|
|
||||||
|
nsIPrincipal* dataPrincipal = sp->GetPrincipal();
|
||||||
|
if (NS_WARN_IF(!dataPrincipal || !aPrincipal->Equals(dataPrincipal))) {
|
||||||
|
aRv.Throw(NS_ERROR_DOM_SECURITY_ERR);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return variant.forget();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace dom
|
} // namespace dom
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace dom {
|
namespace dom {
|
||||||
|
|
||||||
class Entry;
|
class FileSystemEntry;
|
||||||
class FunctionStringCallback;
|
class FunctionStringCallback;
|
||||||
|
|
||||||
class DataTransferItem final : public nsISupports
|
class DataTransferItem final : public nsISupports
|
||||||
|
@ -35,11 +35,17 @@ public:
|
||||||
KIND_OTHER,
|
KIND_OTHER,
|
||||||
};
|
};
|
||||||
|
|
||||||
DataTransferItem(DataTransferItemList* aParent, const nsAString& aType)
|
DataTransferItem(DataTransfer* aDataTransfer, const nsAString& aType)
|
||||||
: mIndex(0), mChromeOnly(false), mKind(KIND_OTHER), mType(aType), mParent(aParent)
|
: mIndex(0)
|
||||||
{}
|
, mChromeOnly(false)
|
||||||
|
, mKind(KIND_OTHER)
|
||||||
|
, mType(aType)
|
||||||
|
, mDataTransfer(aDataTransfer)
|
||||||
|
{
|
||||||
|
MOZ_ASSERT(mDataTransfer, "Must be associated with a DataTransfer");
|
||||||
|
}
|
||||||
|
|
||||||
already_AddRefed<DataTransferItem> Clone(DataTransferItemList* aParent) const;
|
already_AddRefed<DataTransferItem> Clone(DataTransfer* aDataTransfer) const;
|
||||||
|
|
||||||
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
||||||
void GetAsString(FunctionStringCallback* aCallback, ErrorResult& aRv);
|
void GetAsString(FunctionStringCallback* aCallback, ErrorResult& aRv);
|
||||||
|
@ -75,11 +81,11 @@ public:
|
||||||
|
|
||||||
already_AddRefed<File> GetAsFile(ErrorResult& aRv);
|
already_AddRefed<File> GetAsFile(ErrorResult& aRv);
|
||||||
|
|
||||||
already_AddRefed<Entry> GetAsEntry(ErrorResult& aRv);
|
already_AddRefed<FileSystemEntry> GetAsEntry(ErrorResult& aRv);
|
||||||
|
|
||||||
DataTransferItemList* GetParentObject() const
|
DataTransfer* GetParentObject() const
|
||||||
{
|
{
|
||||||
return mParent;
|
return mDataTransfer;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIPrincipal* Principal() const
|
nsIPrincipal* Principal() const
|
||||||
|
@ -91,13 +97,8 @@ public:
|
||||||
mPrincipal = aPrincipal;
|
mPrincipal = aPrincipal;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIVariant* Data()
|
already_AddRefed<nsIVariant> DataNoSecurityCheck();
|
||||||
{
|
already_AddRefed<nsIVariant> Data(nsIPrincipal* aPrincipal, ErrorResult& aRv);
|
||||||
if (!mData) {
|
|
||||||
FillInExternalData();
|
|
||||||
}
|
|
||||||
return mData;
|
|
||||||
}
|
|
||||||
void SetData(nsIVariant* aData);
|
void SetData(nsIVariant* aData);
|
||||||
|
|
||||||
uint32_t Index() const
|
uint32_t Index() const
|
||||||
|
@ -131,7 +132,7 @@ private:
|
||||||
nsString mType;
|
nsString mType;
|
||||||
nsCOMPtr<nsIVariant> mData;
|
nsCOMPtr<nsIVariant> mData;
|
||||||
nsCOMPtr<nsIPrincipal> mPrincipal;
|
nsCOMPtr<nsIPrincipal> mPrincipal;
|
||||||
RefPtr<DataTransferItemList> mParent;
|
RefPtr<DataTransfer> mDataTransfer;
|
||||||
|
|
||||||
// File cache for nsIFile application/x-moz-file entries.
|
// File cache for nsIFile application/x-moz-file entries.
|
||||||
RefPtr<File> mCachedFile;
|
RefPtr<File> mCachedFile;
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace dom {
|
namespace dom {
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(DataTransferItemList, mParent, mItems,
|
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(DataTransferItemList, mDataTransfer, mItems,
|
||||||
mIndexedItems, mFiles)
|
mIndexedItems, mFiles)
|
||||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(DataTransferItemList)
|
NS_IMPL_CYCLE_COLLECTING_ADDREF(DataTransferItemList)
|
||||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(DataTransferItemList)
|
NS_IMPL_CYCLE_COLLECTING_RELEASE(DataTransferItemList)
|
||||||
|
@ -40,10 +40,10 @@ DataTransferItemList::WrapObject(JSContext* aCx,
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<DataTransferItemList>
|
already_AddRefed<DataTransferItemList>
|
||||||
DataTransferItemList::Clone(DataTransfer* aParent) const
|
DataTransferItemList::Clone(DataTransfer* aDataTransfer) const
|
||||||
{
|
{
|
||||||
RefPtr<DataTransferItemList> list =
|
RefPtr<DataTransferItemList> list =
|
||||||
new DataTransferItemList(aParent, mIsExternal, mIsCrossDomainSubFrameDrop);
|
new DataTransferItemList(aDataTransfer, mIsExternal);
|
||||||
|
|
||||||
// We need to clone the mItems and mIndexedItems lists while keeping the same
|
// We need to clone the mItems and mIndexedItems lists while keeping the same
|
||||||
// correspondences between the mIndexedItems and mItems lists (namely, if an
|
// correspondences between the mIndexedItems and mItems lists (namely, if an
|
||||||
|
@ -63,7 +63,7 @@ DataTransferItemList::Clone(DataTransfer* aParent) const
|
||||||
nsTArray<RefPtr<DataTransferItem>>& newItems = list->mIndexedItems[i];
|
nsTArray<RefPtr<DataTransferItem>>& newItems = list->mIndexedItems[i];
|
||||||
newItems.SetLength(items.Length());
|
newItems.SetLength(items.Length());
|
||||||
for (uint32_t j = 0; j < items.Length(); j++) {
|
for (uint32_t j = 0; j < items.Length(); j++) {
|
||||||
newItems[j] = items[j]->Clone(list);
|
newItems[j] = items[j]->Clone(aDataTransfer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ DataTransferItemList::Clone(DataTransfer* aParent) const
|
||||||
void
|
void
|
||||||
DataTransferItemList::Remove(uint32_t aIndex, ErrorResult& aRv)
|
DataTransferItemList::Remove(uint32_t aIndex, ErrorResult& aRv)
|
||||||
{
|
{
|
||||||
if (IsReadOnly()) {
|
if (mDataTransfer->IsReadOnly()) {
|
||||||
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
|
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -104,63 +104,9 @@ DataTransferItemList::IndexedGetter(uint32_t aIndex, bool& aFound, ErrorResult&
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
RefPtr<DataTransferItem> item = mItems[aIndex];
|
MOZ_ASSERT(mItems[aIndex]);
|
||||||
|
|
||||||
// Check if the caller is allowed to access the drag data. Callers with
|
|
||||||
// chrome privileges can always read the data. During the
|
|
||||||
// drop event, allow retrieving the data except in the case where the
|
|
||||||
// source of the drag is in a child frame of the caller. In that case,
|
|
||||||
// we only allow access to data of the same principal. During other events,
|
|
||||||
// only allow access to the data with the same principal.
|
|
||||||
nsIPrincipal* principal = nullptr;
|
|
||||||
if (mIsCrossDomainSubFrameDrop) {
|
|
||||||
principal = nsContentUtils::SubjectPrincipal();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item->Principal() && principal &&
|
|
||||||
!principal->Subsumes(item->Principal())) {
|
|
||||||
aRv.Throw(NS_ERROR_DOM_SECURITY_ERR);
|
|
||||||
aFound = false;
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsCOMPtr<nsIVariant> variantData = item->Data();
|
|
||||||
nsCOMPtr<nsISupports> data;
|
|
||||||
if (variantData &&
|
|
||||||
NS_SUCCEEDED(variantData->GetAsISupports(getter_AddRefs(data))) &&
|
|
||||||
data) {
|
|
||||||
// Make sure the code that is calling us is same-origin with the data.
|
|
||||||
nsCOMPtr<EventTarget> pt = do_QueryInterface(data);
|
|
||||||
if (pt) {
|
|
||||||
nsresult rv = NS_OK;
|
|
||||||
nsIScriptContext* c = pt->GetContextForEventHandlers(&rv);
|
|
||||||
if (NS_WARN_IF(NS_FAILED(rv) || !c)) {
|
|
||||||
aRv.Throw(NS_ERROR_DOM_SECURITY_ERR);
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsIGlobalObject* go = c->GetGlobalObject();
|
|
||||||
if (NS_WARN_IF(!go)) {
|
|
||||||
aRv.Throw(NS_ERROR_DOM_SECURITY_ERR);
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsCOMPtr<nsIScriptObjectPrincipal> sp = do_QueryInterface(go);
|
|
||||||
MOZ_ASSERT(sp, "This cannot fail on the main thread.");
|
|
||||||
|
|
||||||
nsIPrincipal* dataPrincipal = sp->GetPrincipal();
|
|
||||||
if (!principal) {
|
|
||||||
principal = nsContentUtils::SubjectPrincipal();
|
|
||||||
}
|
|
||||||
if (NS_WARN_IF(!dataPrincipal || !principal->Equals(dataPrincipal))) {
|
|
||||||
aRv.Throw(NS_ERROR_DOM_SECURITY_ERR);
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
aFound = true;
|
aFound = true;
|
||||||
return item;
|
return mItems[aIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t
|
uint32_t
|
||||||
|
@ -178,7 +124,7 @@ DataTransferItemList::MozItemCount() const
|
||||||
void
|
void
|
||||||
DataTransferItemList::Clear(ErrorResult& aRv)
|
DataTransferItemList::Clear(ErrorResult& aRv)
|
||||||
{
|
{
|
||||||
if (NS_WARN_IF(IsReadOnly())) {
|
if (NS_WARN_IF(mDataTransfer->IsReadOnly())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -198,14 +144,14 @@ DataTransferItemList::Add(const nsAString& aData,
|
||||||
const nsAString& aType,
|
const nsAString& aType,
|
||||||
ErrorResult& aRv)
|
ErrorResult& aRv)
|
||||||
{
|
{
|
||||||
if (NS_WARN_IF(IsReadOnly())) {
|
if (NS_WARN_IF(mDataTransfer->IsReadOnly())) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIVariant> data(new storage::TextVariant(aData));
|
nsCOMPtr<nsIVariant> data(new storage::TextVariant(aData));
|
||||||
|
|
||||||
nsAutoString format;
|
nsAutoString format;
|
||||||
mParent->GetRealFormat(aType, format);
|
mDataTransfer->GetRealFormat(aType, format);
|
||||||
|
|
||||||
// We add the textual data to index 0. We set aInsertOnly to true, as we don't
|
// We add the textual data to index 0. We set aInsertOnly to true, as we don't
|
||||||
// want to update an existing entry if it is already present, as per the spec.
|
// want to update an existing entry if it is already present, as per the spec.
|
||||||
|
@ -226,7 +172,7 @@ DataTransferItemList::Add(const nsAString& aData,
|
||||||
DataTransferItem*
|
DataTransferItem*
|
||||||
DataTransferItemList::Add(File& aData, ErrorResult& aRv)
|
DataTransferItemList::Add(File& aData, ErrorResult& aRv)
|
||||||
{
|
{
|
||||||
if (IsReadOnly()) {
|
if (mDataTransfer->IsReadOnly()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -258,7 +204,7 @@ FileList*
|
||||||
DataTransferItemList::Files()
|
DataTransferItemList::Files()
|
||||||
{
|
{
|
||||||
if (!mFiles) {
|
if (!mFiles) {
|
||||||
mFiles = new FileList(static_cast<nsIDOMDataTransfer*>(mParent));
|
mFiles = new FileList(static_cast<nsIDOMDataTransfer*>(mDataTransfer));
|
||||||
RegenerateFiles();
|
RegenerateFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -270,7 +216,7 @@ DataTransferItemList::MozRemoveByTypeAt(const nsAString& aType,
|
||||||
uint32_t aIndex,
|
uint32_t aIndex,
|
||||||
ErrorResult& aRv)
|
ErrorResult& aRv)
|
||||||
{
|
{
|
||||||
if (NS_WARN_IF(IsReadOnly() ||
|
if (NS_WARN_IF(mDataTransfer->IsReadOnly() ||
|
||||||
aIndex >= mIndexedItems.Length())) {
|
aIndex >= mIndexedItems.Length())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -414,7 +360,7 @@ DataTransferItemList::AppendNewItem(uint32_t aIndex,
|
||||||
MOZ_ASSERT(mIndexedItems.Length() == aIndex);
|
MOZ_ASSERT(mIndexedItems.Length() == aIndex);
|
||||||
mIndexedItems.AppendElement();
|
mIndexedItems.AppendElement();
|
||||||
}
|
}
|
||||||
RefPtr<DataTransferItem> item = new DataTransferItem(this, aType);
|
RefPtr<DataTransferItem> item = new DataTransferItem(mDataTransfer, aType);
|
||||||
item->SetIndex(aIndex);
|
item->SetIndex(aIndex);
|
||||||
item->SetPrincipal(aPrincipal);
|
item->SetPrincipal(aPrincipal);
|
||||||
item->SetData(aData);
|
item->SetData(aData);
|
||||||
|
@ -444,27 +390,6 @@ DataTransferItemList::MozItemsAt(uint32_t aIndex) // -- INDEXED
|
||||||
return &mIndexedItems[aIndex];
|
return &mIndexedItems[aIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
|
||||||
DataTransferItemList::IsReadOnly() const
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(mParent);
|
|
||||||
return mParent->IsReadOnly();
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t
|
|
||||||
DataTransferItemList::ClipboardType() const
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(mParent);
|
|
||||||
return mParent->ClipboardType();
|
|
||||||
}
|
|
||||||
|
|
||||||
EventMessage
|
|
||||||
DataTransferItemList::GetEventMessage() const
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(mParent);
|
|
||||||
return mParent->GetEventMessage();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
DataTransferItemList::PopIndexZero()
|
DataTransferItemList::PopIndexZero()
|
||||||
{
|
{
|
||||||
|
@ -501,7 +426,7 @@ DataTransferItemList::ClearDataHelper(DataTransferItem* aItem,
|
||||||
ErrorResult& aRv)
|
ErrorResult& aRv)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aItem);
|
MOZ_ASSERT(aItem);
|
||||||
if (NS_WARN_IF(IsReadOnly())) {
|
if (NS_WARN_IF(mDataTransfer->IsReadOnly())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,12 +22,11 @@ public:
|
||||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DataTransferItemList);
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DataTransferItemList);
|
||||||
|
|
||||||
DataTransferItemList(DataTransfer* aParent, bool aIsExternal,
|
DataTransferItemList(DataTransfer* aDataTransfer, bool aIsExternal)
|
||||||
bool aIsCrossDomainSubFrameDrop)
|
: mDataTransfer(aDataTransfer)
|
||||||
: mParent(aParent)
|
|
||||||
, mIsCrossDomainSubFrameDrop(aIsCrossDomainSubFrameDrop)
|
|
||||||
, mIsExternal(aIsExternal)
|
, mIsExternal(aIsExternal)
|
||||||
{
|
{
|
||||||
|
MOZ_ASSERT(aDataTransfer);
|
||||||
// We always allocate an index 0 in our DataTransferItemList. This is done
|
// We always allocate an index 0 in our DataTransferItemList. This is done
|
||||||
// in order to maintain the invariants according to the spec. Mainly, within
|
// in order to maintain the invariants according to the spec. Mainly, within
|
||||||
// the spec's list, there is intended to be a single copy of each mime type,
|
// the spec's list, there is intended to be a single copy of each mime type,
|
||||||
|
@ -41,7 +40,7 @@ public:
|
||||||
mIndexedItems.SetLength(1);
|
mIndexedItems.SetLength(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<DataTransferItemList> Clone(DataTransfer* aParent) const;
|
already_AddRefed<DataTransferItemList> Clone(DataTransfer* aDataTransfer) const;
|
||||||
|
|
||||||
virtual JSObject* WrapObject(JSContext* aCx,
|
virtual JSObject* WrapObject(JSContext* aCx,
|
||||||
JS::Handle<JSObject*> aGivenProto) override;
|
JS::Handle<JSObject*> aGivenProto) override;
|
||||||
|
@ -60,17 +59,12 @@ public:
|
||||||
DataTransferItem* IndexedGetter(uint32_t aIndex, bool& aFound,
|
DataTransferItem* IndexedGetter(uint32_t aIndex, bool& aFound,
|
||||||
ErrorResult& aRv) const;
|
ErrorResult& aRv) const;
|
||||||
|
|
||||||
void Clear(ErrorResult& aRv);
|
|
||||||
|
|
||||||
DataTransfer* GetParentObject() const
|
DataTransfer* GetParentObject() const
|
||||||
{
|
{
|
||||||
return mParent;
|
return mDataTransfer;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Accessors for data from ParentObject
|
void Clear(ErrorResult& aRv);
|
||||||
bool IsReadOnly() const;
|
|
||||||
int32_t ClipboardType() const;
|
|
||||||
EventMessage GetEventMessage() const;
|
|
||||||
|
|
||||||
already_AddRefed<DataTransferItem>
|
already_AddRefed<DataTransferItem>
|
||||||
SetDataWithPrincipal(const nsAString& aType, nsIVariant* aData,
|
SetDataWithPrincipal(const nsAString& aType, nsIVariant* aData,
|
||||||
|
@ -103,8 +97,7 @@ private:
|
||||||
|
|
||||||
~DataTransferItemList() {}
|
~DataTransferItemList() {}
|
||||||
|
|
||||||
RefPtr<DataTransfer> mParent;
|
RefPtr<DataTransfer> mDataTransfer;
|
||||||
bool mIsCrossDomainSubFrameDrop;
|
|
||||||
bool mIsExternal;
|
bool mIsExternal;
|
||||||
RefPtr<FileList> mFiles;
|
RefPtr<FileList> mFiles;
|
||||||
nsTArray<RefPtr<DataTransferItem>> mItems;
|
nsTArray<RefPtr<DataTransferItem>> mItems;
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include "nsIContent.h"
|
#include "nsIContent.h"
|
||||||
#include "nsIDocument.h"
|
#include "nsIDocument.h"
|
||||||
#include "nsIPresShell.h"
|
#include "nsIPresShell.h"
|
||||||
|
#include "nsIScreen.h"
|
||||||
#include "nsIScrollableFrame.h"
|
#include "nsIScrollableFrame.h"
|
||||||
#include "nsJSEnvironment.h"
|
#include "nsJSEnvironment.h"
|
||||||
#include "nsLayoutUtils.h"
|
#include "nsLayoutUtils.h"
|
||||||
|
@ -597,6 +598,8 @@ Event::InitEvent(const nsAString& aEventTypeArg,
|
||||||
mEvent->mFlags.mDefaultPrevented = false;
|
mEvent->mFlags.mDefaultPrevented = false;
|
||||||
mEvent->mFlags.mDefaultPreventedByContent = false;
|
mEvent->mFlags.mDefaultPreventedByContent = false;
|
||||||
mEvent->mFlags.mDefaultPreventedByChrome = false;
|
mEvent->mFlags.mDefaultPreventedByChrome = false;
|
||||||
|
mEvent->mFlags.mPropagationStopped = false;
|
||||||
|
mEvent->mFlags.mImmediatePropagationStopped = false;
|
||||||
|
|
||||||
// Clearing the old targets, so that the event is targeted correctly when
|
// Clearing the old targets, so that the event is targeted correctly when
|
||||||
// re-dispatching it.
|
// re-dispatching it.
|
||||||
|
@ -925,17 +928,46 @@ Event::GetScreenCoords(nsPresContext* aPresContext,
|
||||||
return CSSIntPoint(aPoint.x, aPoint.y);
|
return CSSIntPoint(aPoint.x, aPoint.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsPoint pt =
|
|
||||||
LayoutDevicePixel::ToAppUnits(aPoint, aPresContext->DeviceContext()->AppUnitsPerDevPixelAtUnitFullZoom());
|
|
||||||
|
|
||||||
|
int32_t appPerDevFullZoom =
|
||||||
|
aPresContext->DeviceContext()->AppUnitsPerDevPixelAtUnitFullZoom();
|
||||||
|
|
||||||
|
LayoutDevicePoint devPt = aPoint;
|
||||||
if (nsIPresShell* ps = aPresContext->GetPresShell()) {
|
if (nsIPresShell* ps = aPresContext->GetPresShell()) {
|
||||||
|
// convert to appUnits in order to use RemoveResolution, then back to
|
||||||
|
// device pixels
|
||||||
|
nsPoint pt =
|
||||||
|
LayoutDevicePixel::ToAppUnits(aPoint, appPerDevFullZoom);
|
||||||
pt = pt.RemoveResolution(nsLayoutUtils::GetCurrentAPZResolutionScale(ps));
|
pt = pt.RemoveResolution(nsLayoutUtils::GetCurrentAPZResolutionScale(ps));
|
||||||
|
devPt = LayoutDevicePixel::FromAppUnits(pt, appPerDevFullZoom);
|
||||||
}
|
}
|
||||||
|
|
||||||
pt += LayoutDevicePixel::ToAppUnits(guiEvent->mWidget->WidgetToScreenOffset(),
|
devPt += guiEvent->mWidget->WidgetToScreenOffset();
|
||||||
aPresContext->DeviceContext()->AppUnitsPerDevPixelAtUnitFullZoom());
|
|
||||||
|
|
||||||
return CSSPixel::FromAppUnitsRounded(pt);
|
nsCOMPtr<nsIScreen> screen = guiEvent->mWidget->GetWidgetScreen();
|
||||||
|
if (screen) {
|
||||||
|
// subtract device-pixel origin of current screen
|
||||||
|
int32_t x, y, w, h;
|
||||||
|
screen->GetRect(&x, &y, &w, &h);
|
||||||
|
devPt.x -= x;
|
||||||
|
devPt.y -= y;
|
||||||
|
// then convert position *within the current screen* to unscaled CSS px
|
||||||
|
double cssToDevScale;
|
||||||
|
screen->GetDefaultCSSScaleFactor(&cssToDevScale);
|
||||||
|
CSSIntPoint cssPt(NSToIntRound(devPt.x / cssToDevScale),
|
||||||
|
NSToIntRound(devPt.y / cssToDevScale));
|
||||||
|
// finally, add the desktop-pixel origin of the screen, to get a global
|
||||||
|
// CSS pixel value that is compatible with window.screenX/Y positions
|
||||||
|
screen->GetRectDisplayPix(&x, &y, &w, &h);
|
||||||
|
cssPt.x += x;
|
||||||
|
cssPt.y += y;
|
||||||
|
return cssPt;
|
||||||
|
}
|
||||||
|
|
||||||
|
// this shouldn't happen, but just in case...
|
||||||
|
NS_WARNING("failed to find screen, using default CSS px conversion");
|
||||||
|
return CSSPixel::FromAppUnitsRounded(
|
||||||
|
LayoutDevicePixel::ToAppUnits(aPoint, appPerDevFullZoom));
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
|
|
|
@ -4157,8 +4157,7 @@ GetWindowClientRectCenter(nsIWidget* aWidget)
|
||||||
{
|
{
|
||||||
NS_ENSURE_TRUE(aWidget, LayoutDeviceIntPoint(0, 0));
|
NS_ENSURE_TRUE(aWidget, LayoutDeviceIntPoint(0, 0));
|
||||||
|
|
||||||
LayoutDeviceIntRect rect;
|
LayoutDeviceIntRect rect = aWidget->GetClientBounds();
|
||||||
aWidget->GetClientBounds(rect);
|
|
||||||
LayoutDeviceIntPoint point(rect.x + rect.width / 2,
|
LayoutDeviceIntPoint point(rect.x + rect.width / 2,
|
||||||
rect.y + rect.height / 2);
|
rect.y + rect.height / 2);
|
||||||
int32_t round = aWidget->RoundsWidgetCoordinatesTo();
|
int32_t round = aWidget->RoundsWidgetCoordinatesTo();
|
||||||
|
|
|
@ -413,12 +413,6 @@ WheelTransaction::OverrideSystemScrollSpeed(WidgetWheelEvent* aEvent)
|
||||||
return DeltaValues(aEvent);
|
return DeltaValues(aEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
// We shouldn't override the scrolling speed on non root scroll frame.
|
|
||||||
if (sTargetFrame !=
|
|
||||||
sTargetFrame->PresContext()->PresShell()->GetRootScrollFrame()) {
|
|
||||||
return DeltaValues(aEvent);
|
|
||||||
}
|
|
||||||
|
|
||||||
return DeltaValues(aEvent->OverriddenDeltaX(),
|
return DeltaValues(aEvent->OverriddenDeltaX(),
|
||||||
aEvent->OverriddenDeltaY());
|
aEvent->OverriddenDeltaY());
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,6 +88,8 @@ UNIFIED_SOURCES += [
|
||||||
'CustomEvent.cpp',
|
'CustomEvent.cpp',
|
||||||
'DataContainerEvent.cpp',
|
'DataContainerEvent.cpp',
|
||||||
'DataTransfer.cpp',
|
'DataTransfer.cpp',
|
||||||
|
'DataTransferItem.cpp',
|
||||||
|
'DataTransferItemList.cpp',
|
||||||
'DeviceMotionEvent.cpp',
|
'DeviceMotionEvent.cpp',
|
||||||
'DOMEventTargetHelper.cpp',
|
'DOMEventTargetHelper.cpp',
|
||||||
'DragEvent.cpp',
|
'DragEvent.cpp',
|
||||||
|
@ -126,8 +128,6 @@ UNIFIED_SOURCES += [
|
||||||
|
|
||||||
# nsEventStateManager.cpp should be built separately because of Mac OS X headers.
|
# nsEventStateManager.cpp should be built separately because of Mac OS X headers.
|
||||||
SOURCES += [
|
SOURCES += [
|
||||||
'DataTransferItem.cpp',
|
|
||||||
'DataTransferItemList.cpp',
|
|
||||||
'EventStateManager.cpp',
|
'EventStateManager.cpp',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -16,9 +16,16 @@
|
||||||
|
|
||||||
SimpleTest.waitForExplicitFinish();
|
SimpleTest.waitForExplicitFinish();
|
||||||
SimpleTest.requestFlakyTimeout("untriaged");
|
SimpleTest.requestFlakyTimeout("untriaged");
|
||||||
|
SpecialPowers.pushPrefEnv({"set": [
|
||||||
|
["mousewheel.system_scroll_override_on_root_content.enabled", false]
|
||||||
|
]}, runTest);
|
||||||
|
|
||||||
var subWin = window.open("window_wheel_default_action.html", "_blank",
|
var subWin = null;
|
||||||
"width=500,height=500,scrollbars=yes");
|
|
||||||
|
function runTest() {
|
||||||
|
subWin = window.open("window_wheel_default_action.html", "_blank",
|
||||||
|
"width=500,height=500,scrollbars=yes");
|
||||||
|
}
|
||||||
|
|
||||||
function finish()
|
function finish()
|
||||||
{
|
{
|
||||||
|
|
|
@ -918,7 +918,7 @@ FetchBody<Derived>::RegisterWorkerHolder()
|
||||||
MOZ_ASSERT(!mWorkerHolder);
|
MOZ_ASSERT(!mWorkerHolder);
|
||||||
mWorkerHolder = new FetchBodyWorkerHolder<Derived>(this);
|
mWorkerHolder = new FetchBodyWorkerHolder<Derived>(this);
|
||||||
|
|
||||||
if (!mWorkerHolder->HoldWorker(mWorkerPrivate)) {
|
if (!mWorkerHolder->HoldWorker(mWorkerPrivate, Closing)) {
|
||||||
NS_WARNING("Failed to add workerHolder");
|
NS_WARNING("Failed to add workerHolder");
|
||||||
mWorkerHolder = nullptr;
|
mWorkerHolder = nullptr;
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -9,7 +9,8 @@
|
||||||
#include "mozilla/dom/DOMError.h"
|
#include "mozilla/dom/DOMError.h"
|
||||||
#include "mozilla/dom/File.h"
|
#include "mozilla/dom/File.h"
|
||||||
#include "mozilla/dom/FileBinding.h"
|
#include "mozilla/dom/FileBinding.h"
|
||||||
#include "mozilla/dom/FileEntry.h"
|
#include "mozilla/dom/FileSystemDirectoryReaderBinding.h"
|
||||||
|
#include "mozilla/dom/FileSystemFileEntry.h"
|
||||||
#include "mozilla/dom/Promise.h"
|
#include "mozilla/dom/Promise.h"
|
||||||
#include "nsIGlobalObject.h"
|
#include "nsIGlobalObject.h"
|
||||||
#include "nsPIDOMWindow.h"
|
#include "nsPIDOMWindow.h"
|
||||||
|
@ -17,8 +18,8 @@
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace dom {
|
namespace dom {
|
||||||
|
|
||||||
EntryCallbackRunnable::EntryCallbackRunnable(EntryCallback* aCallback,
|
EntryCallbackRunnable::EntryCallbackRunnable(FileSystemEntryCallback* aCallback,
|
||||||
Entry* aEntry)
|
FileSystemEntry* aEntry)
|
||||||
: mCallback(aCallback)
|
: mCallback(aCallback)
|
||||||
, mEntry(aEntry)
|
, mEntry(aEntry)
|
||||||
{
|
{
|
||||||
|
@ -58,7 +59,7 @@ ErrorCallbackRunnable::Run()
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
EmptyEntriesCallbackRunnable::EmptyEntriesCallbackRunnable(EntriesCallback* aCallback)
|
EmptyEntriesCallbackRunnable::EmptyEntriesCallbackRunnable(FileSystemEntriesCallback* aCallback)
|
||||||
: mCallback(aCallback)
|
: mCallback(aCallback)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aCallback);
|
MOZ_ASSERT(aCallback);
|
||||||
|
@ -67,16 +68,16 @@ EmptyEntriesCallbackRunnable::EmptyEntriesCallbackRunnable(EntriesCallback* aCal
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
EmptyEntriesCallbackRunnable::Run()
|
EmptyEntriesCallbackRunnable::Run()
|
||||||
{
|
{
|
||||||
Sequence<OwningNonNull<Entry>> sequence;
|
Sequence<OwningNonNull<FileSystemEntry>> sequence;
|
||||||
mCallback->HandleEvent(sequence);
|
mCallback->HandleEvent(sequence);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetEntryHelper::GetEntryHelper(nsIGlobalObject* aGlobalObject,
|
GetEntryHelper::GetEntryHelper(nsIGlobalObject* aGlobalObject,
|
||||||
DOMFileSystem* aFileSystem,
|
FileSystem* aFileSystem,
|
||||||
EntryCallback* aSuccessCallback,
|
FileSystemEntryCallback* aSuccessCallback,
|
||||||
ErrorCallback* aErrorCallback,
|
ErrorCallback* aErrorCallback,
|
||||||
DirectoryEntry::GetInternalType aType)
|
FileSystemDirectoryEntry::GetInternalType aType)
|
||||||
: mGlobal(aGlobalObject)
|
: mGlobal(aGlobalObject)
|
||||||
, mFileSystem(aFileSystem)
|
, mFileSystem(aFileSystem)
|
||||||
, mSuccessCallback(aSuccessCallback)
|
, mSuccessCallback(aSuccessCallback)
|
||||||
|
@ -100,19 +101,20 @@ GetEntryHelper::ResolvedCallback(JSContext* aCx, JS::Handle<JS::Value> aValue)
|
||||||
|
|
||||||
JS::Rooted<JSObject*> obj(aCx, &aValue.toObject());
|
JS::Rooted<JSObject*> obj(aCx, &aValue.toObject());
|
||||||
|
|
||||||
if (mType == DirectoryEntry::eGetFile) {
|
if (mType == FileSystemDirectoryEntry::eGetFile) {
|
||||||
RefPtr<File> file;
|
RefPtr<File> file;
|
||||||
if (NS_FAILED(UNWRAP_OBJECT(File, obj, file))) {
|
if (NS_FAILED(UNWRAP_OBJECT(File, obj, file))) {
|
||||||
Error(NS_ERROR_DOM_TYPE_MISMATCH_ERR);
|
Error(NS_ERROR_DOM_TYPE_MISMATCH_ERR);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
RefPtr<FileEntry> entry = new FileEntry(mGlobal, file, mFileSystem);
|
RefPtr<FileSystemFileEntry> entry =
|
||||||
|
new FileSystemFileEntry(mGlobal, file, mFileSystem);
|
||||||
mSuccessCallback->HandleEvent(*entry);
|
mSuccessCallback->HandleEvent(*entry);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MOZ_ASSERT(mType == DirectoryEntry::eGetDirectory);
|
MOZ_ASSERT(mType == FileSystemDirectoryEntry::eGetDirectory);
|
||||||
|
|
||||||
RefPtr<Directory> directory;
|
RefPtr<Directory> directory;
|
||||||
if (NS_FAILED(UNWRAP_OBJECT(Directory, obj, directory))) {
|
if (NS_FAILED(UNWRAP_OBJECT(Directory, obj, directory))) {
|
||||||
|
@ -120,8 +122,8 @@ GetEntryHelper::ResolvedCallback(JSContext* aCx, JS::Handle<JS::Value> aValue)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
RefPtr<DirectoryEntry> entry =
|
RefPtr<FileSystemDirectoryEntry> entry =
|
||||||
new DirectoryEntry(mGlobal, directory, mFileSystem);
|
new FileSystemDirectoryEntry(mGlobal, directory, mFileSystem);
|
||||||
mSuccessCallback->HandleEvent(*entry);
|
mSuccessCallback->HandleEvent(*entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#ifndef mozilla_dom_ErrorCallbackRunnable_h
|
#ifndef mozilla_dom_ErrorCallbackRunnable_h
|
||||||
#define mozilla_dom_ErrorCallbackRunnable_h
|
#define mozilla_dom_ErrorCallbackRunnable_h
|
||||||
|
|
||||||
#include "DirectoryEntry.h"
|
#include "FileSystemDirectoryEntry.h"
|
||||||
#include "mozilla/dom/BindingDeclarations.h"
|
#include "mozilla/dom/BindingDeclarations.h"
|
||||||
#include "mozilla/dom/PromiseNativeHandler.h"
|
#include "mozilla/dom/PromiseNativeHandler.h"
|
||||||
|
|
||||||
|
@ -16,18 +16,20 @@ class nsIGlobalObject;
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace dom {
|
namespace dom {
|
||||||
|
|
||||||
|
class FileSystemEntriesCallback;
|
||||||
|
|
||||||
class EntryCallbackRunnable final : public Runnable
|
class EntryCallbackRunnable final : public Runnable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
EntryCallbackRunnable(EntryCallback* aCallback,
|
EntryCallbackRunnable(FileSystemEntryCallback* aCallback,
|
||||||
Entry* aEntry);
|
FileSystemEntry* aEntry);
|
||||||
|
|
||||||
NS_IMETHOD
|
NS_IMETHOD
|
||||||
Run() override;
|
Run() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RefPtr<EntryCallback> mCallback;
|
RefPtr<FileSystemEntryCallback> mCallback;
|
||||||
RefPtr<Entry> mEntry;
|
RefPtr<FileSystemEntry> mEntry;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ErrorCallbackRunnable final : public Runnable
|
class ErrorCallbackRunnable final : public Runnable
|
||||||
|
@ -49,13 +51,13 @@ private:
|
||||||
class EmptyEntriesCallbackRunnable final : public Runnable
|
class EmptyEntriesCallbackRunnable final : public Runnable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit EmptyEntriesCallbackRunnable(EntriesCallback* aCallback);
|
explicit EmptyEntriesCallbackRunnable(FileSystemEntriesCallback* aCallback);
|
||||||
|
|
||||||
NS_IMETHOD
|
NS_IMETHOD
|
||||||
Run() override;
|
Run() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RefPtr<EntriesCallback> mCallback;
|
RefPtr<FileSystemEntriesCallback> mCallback;
|
||||||
};
|
};
|
||||||
|
|
||||||
class GetEntryHelper final : public PromiseNativeHandler
|
class GetEntryHelper final : public PromiseNativeHandler
|
||||||
|
@ -64,10 +66,10 @@ public:
|
||||||
NS_DECL_ISUPPORTS
|
NS_DECL_ISUPPORTS
|
||||||
|
|
||||||
GetEntryHelper(nsIGlobalObject* aGlobalObject,
|
GetEntryHelper(nsIGlobalObject* aGlobalObject,
|
||||||
DOMFileSystem* aFileSystem,
|
FileSystem* aFileSystem,
|
||||||
EntryCallback* aSuccessCallback,
|
FileSystemEntryCallback* aSuccessCallback,
|
||||||
ErrorCallback* aErrorCallback,
|
ErrorCallback* aErrorCallback,
|
||||||
DirectoryEntry::GetInternalType aType);
|
FileSystemDirectoryEntry::GetInternalType aType);
|
||||||
|
|
||||||
virtual void
|
virtual void
|
||||||
ResolvedCallback(JSContext* aCx, JS::Handle<JS::Value> aValue) override;
|
ResolvedCallback(JSContext* aCx, JS::Handle<JS::Value> aValue) override;
|
||||||
|
@ -82,10 +84,10 @@ private:
|
||||||
Error(nsresult aError);
|
Error(nsresult aError);
|
||||||
|
|
||||||
nsCOMPtr<nsIGlobalObject> mGlobal;
|
nsCOMPtr<nsIGlobalObject> mGlobal;
|
||||||
RefPtr<DOMFileSystem> mFileSystem;
|
RefPtr<FileSystem> mFileSystem;
|
||||||
RefPtr<EntryCallback> mSuccessCallback;
|
RefPtr<FileSystemEntryCallback> mSuccessCallback;
|
||||||
RefPtr<ErrorCallback> mErrorCallback;
|
RefPtr<ErrorCallback> mErrorCallback;
|
||||||
DirectoryEntry::GetInternalType mType;
|
FileSystemDirectoryEntry::GetInternalType mType;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ErrorCallbackHelper
|
class ErrorCallbackHelper
|
||||||
|
|
|
@ -1,66 +0,0 @@
|
||||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
||||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
||||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
||||||
|
|
||||||
#include "Entry.h"
|
|
||||||
#include "DirectoryEntry.h"
|
|
||||||
#include "FileEntry.h"
|
|
||||||
#include "mozilla/dom/UnionTypes.h"
|
|
||||||
|
|
||||||
namespace mozilla {
|
|
||||||
namespace dom {
|
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(Entry, mParent, mFileSystem)
|
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(Entry)
|
|
||||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(Entry)
|
|
||||||
|
|
||||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(Entry)
|
|
||||||
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
|
||||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
|
||||||
NS_INTERFACE_MAP_END
|
|
||||||
|
|
||||||
/* static */ already_AddRefed<Entry>
|
|
||||||
Entry::Create(nsIGlobalObject* aGlobalObject,
|
|
||||||
const OwningFileOrDirectory& aFileOrDirectory,
|
|
||||||
DOMFileSystem* aFileSystem)
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(aGlobalObject);
|
|
||||||
MOZ_ASSERT(aFileSystem);
|
|
||||||
|
|
||||||
RefPtr<Entry> entry;
|
|
||||||
if (aFileOrDirectory.IsFile()) {
|
|
||||||
entry = new FileEntry(aGlobalObject,
|
|
||||||
aFileOrDirectory.GetAsFile(),
|
|
||||||
aFileSystem);
|
|
||||||
} else {
|
|
||||||
MOZ_ASSERT(aFileOrDirectory.IsDirectory());
|
|
||||||
entry = new DirectoryEntry(aGlobalObject,
|
|
||||||
aFileOrDirectory.GetAsDirectory(),
|
|
||||||
aFileSystem);
|
|
||||||
}
|
|
||||||
|
|
||||||
return entry.forget();
|
|
||||||
}
|
|
||||||
|
|
||||||
Entry::Entry(nsIGlobalObject* aGlobal, DOMFileSystem* aFileSystem)
|
|
||||||
: mParent(aGlobal)
|
|
||||||
, mFileSystem(aFileSystem)
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(aGlobal);
|
|
||||||
MOZ_ASSERT(aFileSystem);
|
|
||||||
}
|
|
||||||
|
|
||||||
Entry::~Entry()
|
|
||||||
{}
|
|
||||||
|
|
||||||
JSObject*
|
|
||||||
Entry::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
|
||||||
{
|
|
||||||
return EntryBinding::Wrap(aCx, this, aGivenProto);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // dom namespace
|
|
||||||
} // mozilla namespace
|
|
|
@ -4,26 +4,26 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
* 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/. */
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#include "DOMFileSystem.h"
|
#include "FileSystem.h"
|
||||||
#include "RootDirectoryEntry.h"
|
#include "FileSystemRootDirectoryEntry.h"
|
||||||
#include "mozilla/dom/DOMFileSystemBinding.h"
|
#include "mozilla/dom/FileSystemBinding.h"
|
||||||
#include "nsContentUtils.h"
|
#include "nsContentUtils.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace dom {
|
namespace dom {
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(DOMFileSystem, mParent, mRoot)
|
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(FileSystem, mParent, mRoot)
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(DOMFileSystem)
|
NS_IMPL_CYCLE_COLLECTING_ADDREF(FileSystem)
|
||||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(DOMFileSystem)
|
NS_IMPL_CYCLE_COLLECTING_RELEASE(FileSystem)
|
||||||
|
|
||||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(DOMFileSystem)
|
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(FileSystem)
|
||||||
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
||||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||||
NS_INTERFACE_MAP_END
|
NS_INTERFACE_MAP_END
|
||||||
|
|
||||||
/* static */ already_AddRefed<DOMFileSystem>
|
/* static */ already_AddRefed<FileSystem>
|
||||||
DOMFileSystem::Create(nsIGlobalObject* aGlobalObject)
|
FileSystem::Create(nsIGlobalObject* aGlobalObject)
|
||||||
|
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aGlobalObject);
|
MOZ_ASSERT(aGlobalObject);
|
||||||
|
@ -42,34 +42,33 @@ DOMFileSystem::Create(nsIGlobalObject* aGlobalObject)
|
||||||
// UUID in this format '{' + UUID + '}'. We remove them with these +1 and -2.
|
// UUID in this format '{' + UUID + '}'. We remove them with these +1 and -2.
|
||||||
nsAutoCString name(Substring(chars + 1, chars + NSID_LENGTH - 2));
|
nsAutoCString name(Substring(chars + 1, chars + NSID_LENGTH - 2));
|
||||||
|
|
||||||
RefPtr<DOMFileSystem> fs =
|
RefPtr<FileSystem> fs =
|
||||||
new DOMFileSystem(aGlobalObject, NS_ConvertUTF8toUTF16(name));
|
new FileSystem(aGlobalObject, NS_ConvertUTF8toUTF16(name));
|
||||||
|
|
||||||
return fs.forget();
|
return fs.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
DOMFileSystem::DOMFileSystem(nsIGlobalObject* aGlobal,
|
FileSystem::FileSystem(nsIGlobalObject* aGlobal, const nsAString& aName)
|
||||||
const nsAString& aName)
|
|
||||||
: mParent(aGlobal)
|
: mParent(aGlobal)
|
||||||
, mName(aName)
|
, mName(aName)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aGlobal);
|
MOZ_ASSERT(aGlobal);
|
||||||
}
|
}
|
||||||
|
|
||||||
DOMFileSystem::~DOMFileSystem()
|
FileSystem::~FileSystem()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
JSObject*
|
JSObject*
|
||||||
DOMFileSystem::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
FileSystem::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
||||||
{
|
{
|
||||||
return DOMFileSystemBinding::Wrap(aCx, this, aGivenProto);
|
return FileSystemBinding::Wrap(aCx, this, aGivenProto);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
DOMFileSystem::CreateRoot(const Sequence<RefPtr<Entry>>& aEntries)
|
FileSystem::CreateRoot(const Sequence<RefPtr<FileSystemEntry>>& aEntries)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(!mRoot);
|
MOZ_ASSERT(!mRoot);
|
||||||
mRoot = new RootDirectoryEntry(mParent, aEntries, this);
|
mRoot = new FileSystemRootDirectoryEntry(mParent, aEntries, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // dom namespace
|
} // dom namespace
|
|
@ -4,8 +4,8 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
* 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/. */
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#ifndef mozilla_dom_DOMFileSystem_h
|
#ifndef mozilla_dom_FileSystem_h
|
||||||
#define mozilla_dom_DOMFileSystem_h
|
#define mozilla_dom_FileSystem_h
|
||||||
|
|
||||||
#include "mozilla/Attributes.h"
|
#include "mozilla/Attributes.h"
|
||||||
#include "mozilla/ErrorResult.h"
|
#include "mozilla/ErrorResult.h"
|
||||||
|
@ -18,19 +18,19 @@ class nsIGlobalObject;
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace dom {
|
namespace dom {
|
||||||
|
|
||||||
class DirectoryEntry;
|
class FileSystemDirectoryEntry;
|
||||||
class Entry;
|
class FileSystemEntry;
|
||||||
class OwningFileOrDirectory;
|
class OwningFileOrDirectory;
|
||||||
|
|
||||||
class DOMFileSystem final
|
class FileSystem final
|
||||||
: public nsISupports
|
: public nsISupports
|
||||||
, public nsWrapperCache
|
, public nsWrapperCache
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMFileSystem)
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(FileSystem)
|
||||||
|
|
||||||
static already_AddRefed<DOMFileSystem>
|
static already_AddRefed<FileSystem>
|
||||||
Create(nsIGlobalObject* aGlobalObject);
|
Create(nsIGlobalObject* aGlobalObject);
|
||||||
|
|
||||||
nsIGlobalObject*
|
nsIGlobalObject*
|
||||||
|
@ -48,26 +48,26 @@ public:
|
||||||
aName = mName;
|
aName = mName;
|
||||||
}
|
}
|
||||||
|
|
||||||
DirectoryEntry*
|
FileSystemDirectoryEntry*
|
||||||
Root() const
|
Root() const
|
||||||
{
|
{
|
||||||
return mRoot;
|
return mRoot;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CreateRoot(const Sequence<RefPtr<Entry>>& aEntries);
|
CreateRoot(const Sequence<RefPtr<FileSystemEntry>>& aEntries);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
explicit DOMFileSystem(nsIGlobalObject* aGlobalObject,
|
explicit FileSystem(nsIGlobalObject* aGlobalObject,
|
||||||
const nsAString& aName);
|
const nsAString& aName);
|
||||||
~DOMFileSystem();
|
~FileSystem();
|
||||||
|
|
||||||
nsCOMPtr<nsIGlobalObject> mParent;
|
nsCOMPtr<nsIGlobalObject> mParent;
|
||||||
RefPtr<DirectoryEntry> mRoot;
|
RefPtr<FileSystemDirectoryEntry> mRoot;
|
||||||
nsString mName;
|
nsString mName;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace dom
|
} // namespace dom
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
||||||
#endif // mozilla_dom_DOMFileSystem_h
|
#endif // mozilla_dom_FileSystem_h
|
|
@ -4,70 +4,74 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
* 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/. */
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#include "DirectoryEntry.h"
|
#include "FileSystemDirectoryEntry.h"
|
||||||
#include "CallbackRunnables.h"
|
#include "CallbackRunnables.h"
|
||||||
#include "DirectoryReader.h"
|
#include "FileSystemDirectoryReader.h"
|
||||||
#include "mozilla/dom/Directory.h"
|
#include "mozilla/dom/Directory.h"
|
||||||
|
#include "mozilla/dom/FileSystemDirectoryEntryBinding.h"
|
||||||
#include "mozilla/dom/FileSystemUtils.h"
|
#include "mozilla/dom/FileSystemUtils.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace dom {
|
namespace dom {
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_INHERITED(DirectoryEntry, Entry, mDirectory)
|
NS_IMPL_CYCLE_COLLECTION_INHERITED(FileSystemDirectoryEntry, FileSystemEntry,
|
||||||
|
mDirectory)
|
||||||
|
|
||||||
NS_IMPL_ADDREF_INHERITED(DirectoryEntry, Entry)
|
NS_IMPL_ADDREF_INHERITED(FileSystemDirectoryEntry, FileSystemEntry)
|
||||||
NS_IMPL_RELEASE_INHERITED(DirectoryEntry, Entry)
|
NS_IMPL_RELEASE_INHERITED(FileSystemDirectoryEntry, FileSystemEntry)
|
||||||
|
|
||||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(DirectoryEntry)
|
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(FileSystemDirectoryEntry)
|
||||||
NS_INTERFACE_MAP_END_INHERITING(Entry)
|
NS_INTERFACE_MAP_END_INHERITING(FileSystemEntry)
|
||||||
|
|
||||||
DirectoryEntry::DirectoryEntry(nsIGlobalObject* aGlobal,
|
FileSystemDirectoryEntry::FileSystemDirectoryEntry(nsIGlobalObject* aGlobal,
|
||||||
Directory* aDirectory,
|
Directory* aDirectory,
|
||||||
DOMFileSystem* aFileSystem)
|
FileSystem* aFileSystem)
|
||||||
: Entry(aGlobal, aFileSystem)
|
: FileSystemEntry(aGlobal, aFileSystem)
|
||||||
, mDirectory(aDirectory)
|
, mDirectory(aDirectory)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aGlobal);
|
MOZ_ASSERT(aGlobal);
|
||||||
}
|
}
|
||||||
|
|
||||||
DirectoryEntry::~DirectoryEntry()
|
FileSystemDirectoryEntry::~FileSystemDirectoryEntry()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
JSObject*
|
JSObject*
|
||||||
DirectoryEntry::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
FileSystemDirectoryEntry::WrapObject(JSContext* aCx,
|
||||||
|
JS::Handle<JSObject*> aGivenProto)
|
||||||
{
|
{
|
||||||
return DirectoryEntryBinding::Wrap(aCx, this, aGivenProto);
|
return FileSystemDirectoryEntryBinding::Wrap(aCx, this, aGivenProto);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
DirectoryEntry::GetName(nsAString& aName, ErrorResult& aRv) const
|
FileSystemDirectoryEntry::GetName(nsAString& aName, ErrorResult& aRv) const
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(mDirectory);
|
MOZ_ASSERT(mDirectory);
|
||||||
mDirectory->GetName(aName, aRv);
|
mDirectory->GetName(aName, aRv);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
DirectoryEntry::GetFullPath(nsAString& aPath, ErrorResult& aRv) const
|
FileSystemDirectoryEntry::GetFullPath(nsAString& aPath, ErrorResult& aRv) const
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(mDirectory);
|
MOZ_ASSERT(mDirectory);
|
||||||
mDirectory->GetPath(aPath, aRv);
|
mDirectory->GetPath(aPath, aRv);
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<DirectoryReader>
|
already_AddRefed<FileSystemDirectoryReader>
|
||||||
DirectoryEntry::CreateReader() const
|
FileSystemDirectoryEntry::CreateReader() const
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(mDirectory);
|
MOZ_ASSERT(mDirectory);
|
||||||
|
|
||||||
RefPtr<DirectoryReader> reader =
|
RefPtr<FileSystemDirectoryReader> reader =
|
||||||
new DirectoryReader(GetParentObject(), Filesystem(), mDirectory);
|
new FileSystemDirectoryReader(GetParentObject(), Filesystem(), mDirectory);
|
||||||
return reader.forget();
|
return reader.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
DirectoryEntry::GetInternal(const nsAString& aPath, const FileSystemFlags& aFlag,
|
FileSystemDirectoryEntry::GetInternal(const nsAString& aPath,
|
||||||
const Optional<OwningNonNull<EntryCallback>>& aSuccessCallback,
|
const FileSystemFlags& aFlag,
|
||||||
const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback,
|
const Optional<OwningNonNull<FileSystemEntryCallback>>& aSuccessCallback,
|
||||||
GetInternalType aType) const
|
const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback,
|
||||||
|
GetInternalType aType) const
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(mDirectory);
|
MOZ_ASSERT(mDirectory);
|
||||||
|
|
||||||
|
@ -107,8 +111,8 @@ DirectoryEntry::GetInternal(const nsAString& aPath, const FileSystemFlags& aFlag
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
DirectoryEntry::RemoveRecursively(VoidCallback& aSuccessCallback,
|
FileSystemDirectoryEntry::RemoveRecursively(VoidCallback& aSuccessCallback,
|
||||||
const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback) const
|
const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback) const
|
||||||
{
|
{
|
||||||
ErrorCallbackHelper::Call(GetParentObject(), aErrorCallback,
|
ErrorCallbackHelper::Call(GetParentObject(), aErrorCallback,
|
||||||
NS_ERROR_DOM_SECURITY_ERR);
|
NS_ERROR_DOM_SECURITY_ERR);
|
|
@ -4,25 +4,28 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
* 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/. */
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#ifndef mozilla_dom_DirectoryEntry_h
|
#ifndef mozilla_dom_FileSystemDirectoryEntry_h
|
||||||
#define mozilla_dom_DirectoryEntry_h
|
#define mozilla_dom_FileSystemDirectoryEntry_h
|
||||||
|
|
||||||
#include "mozilla/dom/Entry.h"
|
#include "mozilla/dom/FileSystemBinding.h"
|
||||||
#include "mozilla/dom/DOMFileSystemBinding.h"
|
#include "mozilla/dom/FileSystemEntry.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace dom {
|
namespace dom {
|
||||||
|
|
||||||
class Directory;
|
class Directory;
|
||||||
|
class FileSystemDirectoryReader;
|
||||||
|
|
||||||
class DirectoryEntry : public Entry
|
class FileSystemDirectoryEntry : public FileSystemEntry
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NS_DECL_ISUPPORTS_INHERITED
|
NS_DECL_ISUPPORTS_INHERITED
|
||||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(DirectoryEntry, Entry)
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(FileSystemDirectoryEntry,
|
||||||
|
FileSystemEntry)
|
||||||
|
|
||||||
DirectoryEntry(nsIGlobalObject* aGlobalObject, Directory* aDirectory,
|
FileSystemDirectoryEntry(nsIGlobalObject* aGlobalObject,
|
||||||
DOMFileSystem* aFileSystem);
|
Directory* aDirectory,
|
||||||
|
FileSystem* aFileSystem);
|
||||||
|
|
||||||
virtual JSObject*
|
virtual JSObject*
|
||||||
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
||||||
|
@ -39,12 +42,12 @@ public:
|
||||||
virtual void
|
virtual void
|
||||||
GetFullPath(nsAString& aFullPath, ErrorResult& aRv) const override;
|
GetFullPath(nsAString& aFullPath, ErrorResult& aRv) const override;
|
||||||
|
|
||||||
virtual already_AddRefed<DirectoryReader>
|
virtual already_AddRefed<FileSystemDirectoryReader>
|
||||||
CreateReader() const;
|
CreateReader() const;
|
||||||
|
|
||||||
void
|
void
|
||||||
GetFile(const nsAString& aPath, const FileSystemFlags& aFlag,
|
GetFile(const nsAString& aPath, const FileSystemFlags& aFlag,
|
||||||
const Optional<OwningNonNull<EntryCallback>>& aSuccessCallback,
|
const Optional<OwningNonNull<FileSystemEntryCallback>>& aSuccessCallback,
|
||||||
const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback) const
|
const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback) const
|
||||||
{
|
{
|
||||||
GetInternal(aPath, aFlag, aSuccessCallback, aErrorCallback, eGetFile);
|
GetInternal(aPath, aFlag, aSuccessCallback, aErrorCallback, eGetFile);
|
||||||
|
@ -52,7 +55,7 @@ public:
|
||||||
|
|
||||||
void
|
void
|
||||||
GetDirectory(const nsAString& aPath, const FileSystemFlags& aFlag,
|
GetDirectory(const nsAString& aPath, const FileSystemFlags& aFlag,
|
||||||
const Optional<OwningNonNull<EntryCallback>>& aSuccessCallback,
|
const Optional<OwningNonNull<FileSystemEntryCallback>>& aSuccessCallback,
|
||||||
const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback) const
|
const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback) const
|
||||||
{
|
{
|
||||||
GetInternal(aPath, aFlag, aSuccessCallback, aErrorCallback, eGetDirectory);
|
GetInternal(aPath, aFlag, aSuccessCallback, aErrorCallback, eGetDirectory);
|
||||||
|
@ -66,12 +69,12 @@ public:
|
||||||
|
|
||||||
virtual void
|
virtual void
|
||||||
GetInternal(const nsAString& aPath, const FileSystemFlags& aFlag,
|
GetInternal(const nsAString& aPath, const FileSystemFlags& aFlag,
|
||||||
const Optional<OwningNonNull<EntryCallback>>& aSuccessCallback,
|
const Optional<OwningNonNull<FileSystemEntryCallback>>& aSuccessCallback,
|
||||||
const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback,
|
const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback,
|
||||||
GetInternalType aType) const;
|
GetInternalType aType) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~DirectoryEntry();
|
virtual ~FileSystemDirectoryEntry();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RefPtr<Directory> mDirectory;
|
RefPtr<Directory> mDirectory;
|
||||||
|
@ -80,4 +83,4 @@ private:
|
||||||
} // namespace dom
|
} // namespace dom
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
||||||
#endif // mozilla_dom_DirectoryEntry_h
|
#endif // mozilla_dom_FileSystemDirectoryEntry_h
|
|
@ -4,9 +4,9 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
* 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/. */
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#include "DirectoryReader.h"
|
#include "FileSystemDirectoryReader.h"
|
||||||
#include "CallbackRunnables.h"
|
#include "CallbackRunnables.h"
|
||||||
#include "FileEntry.h"
|
#include "FileSystemFileEntry.h"
|
||||||
#include "mozilla/dom/FileBinding.h"
|
#include "mozilla/dom/FileBinding.h"
|
||||||
#include "mozilla/dom/Directory.h"
|
#include "mozilla/dom/Directory.h"
|
||||||
#include "mozilla/dom/DirectoryBinding.h"
|
#include "mozilla/dom/DirectoryBinding.h"
|
||||||
|
@ -25,8 +25,8 @@ public:
|
||||||
NS_DECL_ISUPPORTS
|
NS_DECL_ISUPPORTS
|
||||||
|
|
||||||
PromiseHandler(nsIGlobalObject* aGlobalObject,
|
PromiseHandler(nsIGlobalObject* aGlobalObject,
|
||||||
DOMFileSystem* aFileSystem,
|
FileSystem* aFileSystem,
|
||||||
EntriesCallback* aSuccessCallback,
|
FileSystemEntriesCallback* aSuccessCallback,
|
||||||
ErrorCallback* aErrorCallback)
|
ErrorCallback* aErrorCallback)
|
||||||
: mGlobal(aGlobalObject)
|
: mGlobal(aGlobalObject)
|
||||||
, mFileSystem(aFileSystem)
|
, mFileSystem(aFileSystem)
|
||||||
|
@ -52,7 +52,7 @@ public:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Sequence<OwningNonNull<Entry>> sequence;
|
Sequence<OwningNonNull<FileSystemEntry>> sequence;
|
||||||
if (NS_WARN_IF(!sequence.SetLength(length, fallible))) {
|
if (NS_WARN_IF(!sequence.SetLength(length, fallible))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,8 @@ public:
|
||||||
|
|
||||||
RefPtr<File> file;
|
RefPtr<File> file;
|
||||||
if (NS_SUCCEEDED(UNWRAP_OBJECT(File, valueObj, file))) {
|
if (NS_SUCCEEDED(UNWRAP_OBJECT(File, valueObj, file))) {
|
||||||
RefPtr<FileEntry> entry = new FileEntry(mGlobal, file, mFileSystem);
|
RefPtr<FileSystemFileEntry> entry =
|
||||||
|
new FileSystemFileEntry(mGlobal, file, mFileSystem);
|
||||||
sequence[i] = entry;
|
sequence[i] = entry;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -82,8 +83,8 @@ public:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
RefPtr<DirectoryEntry> entry =
|
RefPtr<FileSystemDirectoryEntry> entry =
|
||||||
new DirectoryEntry(mGlobal, directory, mFileSystem);
|
new FileSystemDirectoryEntry(mGlobal, directory, mFileSystem);
|
||||||
sequence[i] = entry;
|
sequence[i] = entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,8 +107,8 @@ private:
|
||||||
~PromiseHandler() {}
|
~PromiseHandler() {}
|
||||||
|
|
||||||
nsCOMPtr<nsIGlobalObject> mGlobal;
|
nsCOMPtr<nsIGlobalObject> mGlobal;
|
||||||
RefPtr<DOMFileSystem> mFileSystem;
|
RefPtr<FileSystem> mFileSystem;
|
||||||
RefPtr<EntriesCallback> mSuccessCallback;
|
RefPtr<FileSystemEntriesCallback> mSuccessCallback;
|
||||||
RefPtr<ErrorCallback> mErrorCallback;
|
RefPtr<ErrorCallback> mErrorCallback;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -115,20 +116,20 @@ NS_IMPL_ISUPPORTS0(PromiseHandler);
|
||||||
|
|
||||||
} // anonymous namespace
|
} // anonymous namespace
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(DirectoryReader, mParent, mDirectory,
|
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(FileSystemDirectoryReader, mParent,
|
||||||
mFileSystem)
|
mDirectory, mFileSystem)
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(DirectoryReader)
|
NS_IMPL_CYCLE_COLLECTING_ADDREF(FileSystemDirectoryReader)
|
||||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(DirectoryReader)
|
NS_IMPL_CYCLE_COLLECTING_RELEASE(FileSystemDirectoryReader)
|
||||||
|
|
||||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(DirectoryReader)
|
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(FileSystemDirectoryReader)
|
||||||
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
||||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||||
NS_INTERFACE_MAP_END
|
NS_INTERFACE_MAP_END
|
||||||
|
|
||||||
DirectoryReader::DirectoryReader(nsIGlobalObject* aGlobal,
|
FileSystemDirectoryReader::FileSystemDirectoryReader(nsIGlobalObject* aGlobal,
|
||||||
DOMFileSystem* aFileSystem,
|
FileSystem* aFileSystem,
|
||||||
Directory* aDirectory)
|
Directory* aDirectory)
|
||||||
: mParent(aGlobal)
|
: mParent(aGlobal)
|
||||||
, mFileSystem(aFileSystem)
|
, mFileSystem(aFileSystem)
|
||||||
, mDirectory(aDirectory)
|
, mDirectory(aDirectory)
|
||||||
|
@ -138,19 +139,20 @@ DirectoryReader::DirectoryReader(nsIGlobalObject* aGlobal,
|
||||||
MOZ_ASSERT(aFileSystem);
|
MOZ_ASSERT(aFileSystem);
|
||||||
}
|
}
|
||||||
|
|
||||||
DirectoryReader::~DirectoryReader()
|
FileSystemDirectoryReader::~FileSystemDirectoryReader()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
JSObject*
|
JSObject*
|
||||||
DirectoryReader::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
FileSystemDirectoryReader::WrapObject(JSContext* aCx,
|
||||||
|
JS::Handle<JSObject*> aGivenProto)
|
||||||
{
|
{
|
||||||
return DirectoryReaderBinding::Wrap(aCx, this, aGivenProto);
|
return FileSystemDirectoryReaderBinding::Wrap(aCx, this, aGivenProto);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
DirectoryReader::ReadEntries(EntriesCallback& aSuccessCallback,
|
FileSystemDirectoryReader::ReadEntries(FileSystemEntriesCallback& aSuccessCallback,
|
||||||
const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback,
|
const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback,
|
||||||
ErrorResult& aRv)
|
ErrorResult& aRv)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(mDirectory);
|
MOZ_ASSERT(mDirectory);
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
* 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/. */
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#ifndef mozilla_dom_DirectoryReader_h
|
#ifndef mozilla_dom_FileSystemDirectoryReader_h
|
||||||
#define mozilla_dom_DirectoryReader_h
|
#define mozilla_dom_FileSystemDirectoryReader_h
|
||||||
|
|
||||||
#include "mozilla/Attributes.h"
|
#include "mozilla/Attributes.h"
|
||||||
#include "mozilla/ErrorResult.h"
|
#include "mozilla/ErrorResult.h"
|
||||||
|
@ -19,19 +19,20 @@ namespace mozilla {
|
||||||
namespace dom {
|
namespace dom {
|
||||||
|
|
||||||
class Directory;
|
class Directory;
|
||||||
class DOMFileSystem;
|
class FileSystem;
|
||||||
|
class FileSystemEntriesCallback;
|
||||||
|
|
||||||
class DirectoryReader
|
class FileSystemDirectoryReader
|
||||||
: public nsISupports
|
: public nsISupports
|
||||||
, public nsWrapperCache
|
, public nsWrapperCache
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DirectoryReader)
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(FileSystemDirectoryReader)
|
||||||
|
|
||||||
explicit DirectoryReader(nsIGlobalObject* aGlobalObject,
|
explicit FileSystemDirectoryReader(nsIGlobalObject* aGlobalObject,
|
||||||
DOMFileSystem* aFileSystem,
|
FileSystem* aFileSystem,
|
||||||
Directory* aDirectory);
|
Directory* aDirectory);
|
||||||
|
|
||||||
nsIGlobalObject*
|
nsIGlobalObject*
|
||||||
GetParentObject() const
|
GetParentObject() const
|
||||||
|
@ -43,16 +44,16 @@ public:
|
||||||
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
||||||
|
|
||||||
virtual void
|
virtual void
|
||||||
ReadEntries(EntriesCallback& aSuccessCallback,
|
ReadEntries(FileSystemEntriesCallback& aSuccessCallback,
|
||||||
const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback,
|
const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback,
|
||||||
ErrorResult& aRv);
|
ErrorResult& aRv);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~DirectoryReader();
|
virtual ~FileSystemDirectoryReader();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
nsCOMPtr<nsIGlobalObject> mParent;
|
nsCOMPtr<nsIGlobalObject> mParent;
|
||||||
RefPtr<DOMFileSystem> mFileSystem;
|
RefPtr<FileSystem> mFileSystem;
|
||||||
RefPtr<Directory> mDirectory;
|
RefPtr<Directory> mDirectory;
|
||||||
|
|
||||||
bool mAlreadyRead;
|
bool mAlreadyRead;
|
||||||
|
@ -61,4 +62,4 @@ private:
|
||||||
} // namespace dom
|
} // namespace dom
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
||||||
#endif // mozilla_dom_DirectoryReader_h
|
#endif // mozilla_dom_FileSystemDirectoryReader_h
|
|
@ -0,0 +1,68 @@
|
||||||
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||||
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||||
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
#include "FileSystemEntry.h"
|
||||||
|
#include "FileSystemDirectoryEntry.h"
|
||||||
|
#include "FileSystemFileEntry.h"
|
||||||
|
#include "mozilla/dom/FileSystemEntryBinding.h"
|
||||||
|
#include "mozilla/dom/UnionTypes.h"
|
||||||
|
|
||||||
|
namespace mozilla {
|
||||||
|
namespace dom {
|
||||||
|
|
||||||
|
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(FileSystemEntry, mParent, mFileSystem)
|
||||||
|
|
||||||
|
NS_IMPL_CYCLE_COLLECTING_ADDREF(FileSystemEntry)
|
||||||
|
NS_IMPL_CYCLE_COLLECTING_RELEASE(FileSystemEntry)
|
||||||
|
|
||||||
|
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(FileSystemEntry)
|
||||||
|
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||||
|
NS_INTERFACE_MAP_END
|
||||||
|
|
||||||
|
/* static */ already_AddRefed<FileSystemEntry>
|
||||||
|
FileSystemEntry::Create(nsIGlobalObject* aGlobalObject,
|
||||||
|
const OwningFileOrDirectory& aFileOrDirectory,
|
||||||
|
FileSystem* aFileSystem)
|
||||||
|
{
|
||||||
|
MOZ_ASSERT(aGlobalObject);
|
||||||
|
MOZ_ASSERT(aFileSystem);
|
||||||
|
|
||||||
|
RefPtr<FileSystemEntry> entry;
|
||||||
|
if (aFileOrDirectory.IsFile()) {
|
||||||
|
entry = new FileSystemFileEntry(aGlobalObject,
|
||||||
|
aFileOrDirectory.GetAsFile(),
|
||||||
|
aFileSystem);
|
||||||
|
} else {
|
||||||
|
MOZ_ASSERT(aFileOrDirectory.IsDirectory());
|
||||||
|
entry = new FileSystemDirectoryEntry(aGlobalObject,
|
||||||
|
aFileOrDirectory.GetAsDirectory(),
|
||||||
|
aFileSystem);
|
||||||
|
}
|
||||||
|
|
||||||
|
return entry.forget();
|
||||||
|
}
|
||||||
|
|
||||||
|
FileSystemEntry::FileSystemEntry(nsIGlobalObject* aGlobal,
|
||||||
|
FileSystem* aFileSystem)
|
||||||
|
: mParent(aGlobal)
|
||||||
|
, mFileSystem(aFileSystem)
|
||||||
|
{
|
||||||
|
MOZ_ASSERT(aGlobal);
|
||||||
|
MOZ_ASSERT(aFileSystem);
|
||||||
|
}
|
||||||
|
|
||||||
|
FileSystemEntry::~FileSystemEntry()
|
||||||
|
{}
|
||||||
|
|
||||||
|
JSObject*
|
||||||
|
FileSystemEntry::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
||||||
|
{
|
||||||
|
return FileSystemEntryBinding::Wrap(aCx, this, aGivenProto);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // dom namespace
|
||||||
|
} // mozilla namespace
|
|
@ -4,8 +4,8 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
* 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/. */
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#ifndef mozilla_dom_Entry_h
|
#ifndef mozilla_dom_FileSystemEntry_h
|
||||||
#define mozilla_dom_Entry_h
|
#define mozilla_dom_FileSystemEntry_h
|
||||||
|
|
||||||
#include "mozilla/Attributes.h"
|
#include "mozilla/Attributes.h"
|
||||||
#include "mozilla/ErrorResult.h"
|
#include "mozilla/ErrorResult.h"
|
||||||
|
@ -17,21 +17,21 @@
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace dom {
|
namespace dom {
|
||||||
|
|
||||||
class DOMFileSystem;
|
class FileSystem;
|
||||||
class OwningFileOrDirectory;
|
class OwningFileOrDirectory;
|
||||||
|
|
||||||
class Entry
|
class FileSystemEntry
|
||||||
: public nsISupports
|
: public nsISupports
|
||||||
, public nsWrapperCache
|
, public nsWrapperCache
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(Entry)
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(FileSystemEntry)
|
||||||
|
|
||||||
static already_AddRefed<Entry>
|
static already_AddRefed<FileSystemEntry>
|
||||||
Create(nsIGlobalObject* aGlobalObject,
|
Create(nsIGlobalObject* aGlobalObject,
|
||||||
const OwningFileOrDirectory& aFileOrDirectory,
|
const OwningFileOrDirectory& aFileOrDirectory,
|
||||||
DOMFileSystem* aFileSystem);
|
FileSystem* aFileSystem);
|
||||||
|
|
||||||
nsIGlobalObject*
|
nsIGlobalObject*
|
||||||
GetParentObject() const
|
GetParentObject() const
|
||||||
|
@ -60,23 +60,23 @@ public:
|
||||||
virtual void
|
virtual void
|
||||||
GetFullPath(nsAString& aFullPath, ErrorResult& aRv) const = 0;
|
GetFullPath(nsAString& aFullPath, ErrorResult& aRv) const = 0;
|
||||||
|
|
||||||
DOMFileSystem*
|
FileSystem*
|
||||||
Filesystem() const
|
Filesystem() const
|
||||||
{
|
{
|
||||||
return mFileSystem;
|
return mFileSystem;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Entry(nsIGlobalObject* aGlobalObject,
|
FileSystemEntry(nsIGlobalObject* aGlobalObject,
|
||||||
DOMFileSystem* aFileSystem);
|
FileSystem* aFileSystem);
|
||||||
virtual ~Entry();
|
virtual ~FileSystemEntry();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
nsCOMPtr<nsIGlobalObject> mParent;
|
nsCOMPtr<nsIGlobalObject> mParent;
|
||||||
RefPtr<DOMFileSystem> mFileSystem;
|
RefPtr<FileSystem> mFileSystem;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace dom
|
} // namespace dom
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
||||||
#endif // mozilla_dom_Entry_h
|
#endif // mozilla_dom_FileSystemEntry_h
|
|
@ -4,9 +4,10 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
* 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/. */
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#include "FileEntry.h"
|
#include "FileSystemFileEntry.h"
|
||||||
#include "CallbackRunnables.h"
|
#include "CallbackRunnables.h"
|
||||||
#include "mozilla/dom/File.h"
|
#include "mozilla/dom/File.h"
|
||||||
|
#include "mozilla/dom/FileSystemFileEntryBinding.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace dom {
|
namespace dom {
|
||||||
|
@ -38,41 +39,42 @@ private:
|
||||||
|
|
||||||
} // anonymous namespace
|
} // anonymous namespace
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_INHERITED(FileEntry, Entry, mFile)
|
NS_IMPL_CYCLE_COLLECTION_INHERITED(FileSystemFileEntry, FileSystemEntry, mFile)
|
||||||
|
|
||||||
NS_IMPL_ADDREF_INHERITED(FileEntry, Entry)
|
NS_IMPL_ADDREF_INHERITED(FileSystemFileEntry, FileSystemEntry)
|
||||||
NS_IMPL_RELEASE_INHERITED(FileEntry, Entry)
|
NS_IMPL_RELEASE_INHERITED(FileSystemFileEntry, FileSystemEntry)
|
||||||
|
|
||||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(FileEntry)
|
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(FileSystemFileEntry)
|
||||||
NS_INTERFACE_MAP_END_INHERITING(Entry)
|
NS_INTERFACE_MAP_END_INHERITING(FileSystemEntry)
|
||||||
|
|
||||||
FileEntry::FileEntry(nsIGlobalObject* aGlobal,
|
FileSystemFileEntry::FileSystemFileEntry(nsIGlobalObject* aGlobal,
|
||||||
File* aFile,
|
File* aFile,
|
||||||
DOMFileSystem* aFileSystem)
|
FileSystem* aFileSystem)
|
||||||
: Entry(aGlobal, aFileSystem)
|
: FileSystemEntry(aGlobal, aFileSystem)
|
||||||
, mFile(aFile)
|
, mFile(aFile)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aGlobal);
|
MOZ_ASSERT(aGlobal);
|
||||||
MOZ_ASSERT(mFile);
|
MOZ_ASSERT(mFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
FileEntry::~FileEntry()
|
FileSystemFileEntry::~FileSystemFileEntry()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
JSObject*
|
JSObject*
|
||||||
FileEntry::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
FileSystemFileEntry::WrapObject(JSContext* aCx,
|
||||||
|
JS::Handle<JSObject*> aGivenProto)
|
||||||
{
|
{
|
||||||
return FileEntryBinding::Wrap(aCx, this, aGivenProto);
|
return FileSystemFileEntryBinding::Wrap(aCx, this, aGivenProto);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
FileEntry::GetName(nsAString& aName, ErrorResult& aRv) const
|
FileSystemFileEntry::GetName(nsAString& aName, ErrorResult& aRv) const
|
||||||
{
|
{
|
||||||
mFile->GetName(aName);
|
mFile->GetName(aName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
FileEntry::GetFullPath(nsAString& aPath, ErrorResult& aRv) const
|
FileSystemFileEntry::GetFullPath(nsAString& aPath, ErrorResult& aRv) const
|
||||||
{
|
{
|
||||||
mFile->GetPath(aPath);
|
mFile->GetPath(aPath);
|
||||||
if (aPath.IsEmpty()) {
|
if (aPath.IsEmpty()) {
|
||||||
|
@ -88,16 +90,16 @@ FileEntry::GetFullPath(nsAString& aPath, ErrorResult& aRv) const
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
FileEntry::CreateWriter(VoidCallback& aSuccessCallback,
|
FileSystemFileEntry::CreateWriter(VoidCallback& aSuccessCallback,
|
||||||
const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback) const
|
const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback) const
|
||||||
{
|
{
|
||||||
ErrorCallbackHelper::Call(GetParentObject(), aErrorCallback,
|
ErrorCallbackHelper::Call(GetParentObject(), aErrorCallback,
|
||||||
NS_ERROR_DOM_SECURITY_ERR);
|
NS_ERROR_DOM_SECURITY_ERR);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
FileEntry::GetFile(BlobCallback& aSuccessCallback,
|
FileSystemFileEntry::GetFile(BlobCallback& aSuccessCallback,
|
||||||
const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback) const
|
const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback) const
|
||||||
{
|
{
|
||||||
RefPtr<BlobCallbackRunnable> runnable =
|
RefPtr<BlobCallbackRunnable> runnable =
|
||||||
new BlobCallbackRunnable(&aSuccessCallback, mFile);
|
new BlobCallbackRunnable(&aSuccessCallback, mFile);
|
|
@ -4,24 +4,25 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
* 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/. */
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#ifndef mozilla_dom_FileEntry_h
|
#ifndef mozilla_dom_FileSystemFileEntry_h
|
||||||
#define mozilla_dom_FileEntry_h
|
#define mozilla_dom_FileSystemFileEntry_h
|
||||||
|
|
||||||
#include "mozilla/dom/Entry.h"
|
#include "mozilla/dom/FileSystemEntry.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace dom {
|
namespace dom {
|
||||||
|
|
||||||
class File;
|
class File;
|
||||||
|
class BlobCallback;
|
||||||
|
|
||||||
class FileEntry final : public Entry
|
class FileSystemFileEntry final : public FileSystemEntry
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NS_DECL_ISUPPORTS_INHERITED
|
NS_DECL_ISUPPORTS_INHERITED
|
||||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(FileEntry, Entry)
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(FileSystemFileEntry, FileSystemEntry)
|
||||||
|
|
||||||
FileEntry(nsIGlobalObject* aGlobalObject, File* aFile,
|
FileSystemFileEntry(nsIGlobalObject* aGlobalObject, File* aFile,
|
||||||
DOMFileSystem* aFileSystem);
|
FileSystem* aFileSystem);
|
||||||
|
|
||||||
virtual JSObject*
|
virtual JSObject*
|
||||||
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
||||||
|
@ -47,7 +48,7 @@ public:
|
||||||
const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback) const;
|
const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
~FileEntry();
|
~FileSystemFileEntry();
|
||||||
|
|
||||||
RefPtr<File> mFile;
|
RefPtr<File> mFile;
|
||||||
};
|
};
|
||||||
|
@ -55,4 +56,4 @@ private:
|
||||||
} // namespace dom
|
} // namespace dom
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
||||||
#endif // mozilla_dom_FileEntry_h
|
#endif // mozilla_dom_FileSystemFileEntry_h
|
|
@ -4,58 +4,61 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
* 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/. */
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#include "RootDirectoryEntry.h"
|
#include "FileSystemRootDirectoryEntry.h"
|
||||||
#include "RootDirectoryReader.h"
|
#include "FileSystemRootDirectoryReader.h"
|
||||||
#include "mozilla/dom/FileSystemUtils.h"
|
#include "mozilla/dom/FileSystemUtils.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace dom {
|
namespace dom {
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_INHERITED(RootDirectoryEntry, DirectoryEntry, mEntries)
|
NS_IMPL_CYCLE_COLLECTION_INHERITED(FileSystemRootDirectoryEntry,
|
||||||
|
FileSystemDirectoryEntry, mEntries)
|
||||||
|
|
||||||
NS_IMPL_ADDREF_INHERITED(RootDirectoryEntry, DirectoryEntry)
|
NS_IMPL_ADDREF_INHERITED(FileSystemRootDirectoryEntry, FileSystemDirectoryEntry)
|
||||||
NS_IMPL_RELEASE_INHERITED(RootDirectoryEntry, DirectoryEntry)
|
NS_IMPL_RELEASE_INHERITED(FileSystemRootDirectoryEntry, FileSystemDirectoryEntry)
|
||||||
|
|
||||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(RootDirectoryEntry)
|
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(FileSystemRootDirectoryEntry)
|
||||||
NS_INTERFACE_MAP_END_INHERITING(DirectoryEntry)
|
NS_INTERFACE_MAP_END_INHERITING(FileSystemDirectoryEntry)
|
||||||
|
|
||||||
RootDirectoryEntry::RootDirectoryEntry(nsIGlobalObject* aGlobal,
|
FileSystemRootDirectoryEntry::FileSystemRootDirectoryEntry(nsIGlobalObject* aGlobal,
|
||||||
const Sequence<RefPtr<Entry>>& aEntries,
|
const Sequence<RefPtr<FileSystemEntry>>& aEntries,
|
||||||
DOMFileSystem* aFileSystem)
|
FileSystem* aFileSystem)
|
||||||
: DirectoryEntry(aGlobal, nullptr, aFileSystem)
|
: FileSystemDirectoryEntry(aGlobal, nullptr, aFileSystem)
|
||||||
, mEntries(aEntries)
|
, mEntries(aEntries)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aGlobal);
|
MOZ_ASSERT(aGlobal);
|
||||||
}
|
}
|
||||||
|
|
||||||
RootDirectoryEntry::~RootDirectoryEntry()
|
FileSystemRootDirectoryEntry::~FileSystemRootDirectoryEntry()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void
|
void
|
||||||
RootDirectoryEntry::GetName(nsAString& aName, ErrorResult& aRv) const
|
FileSystemRootDirectoryEntry::GetName(nsAString& aName, ErrorResult& aRv) const
|
||||||
{
|
{
|
||||||
aName.Truncate();
|
aName.Truncate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
RootDirectoryEntry::GetFullPath(nsAString& aPath, ErrorResult& aRv) const
|
FileSystemRootDirectoryEntry::GetFullPath(nsAString& aPath, ErrorResult& aRv) const
|
||||||
{
|
{
|
||||||
aPath.AssignLiteral(FILESYSTEM_DOM_PATH_SEPARATOR_LITERAL);
|
aPath.AssignLiteral(FILESYSTEM_DOM_PATH_SEPARATOR_LITERAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<DirectoryReader>
|
already_AddRefed<FileSystemDirectoryReader>
|
||||||
RootDirectoryEntry::CreateReader() const
|
FileSystemRootDirectoryEntry::CreateReader() const
|
||||||
{
|
{
|
||||||
RefPtr<DirectoryReader> reader =
|
RefPtr<FileSystemDirectoryReader> reader =
|
||||||
new RootDirectoryReader(GetParentObject(), Filesystem(), mEntries);
|
new FileSystemRootDirectoryReader(GetParentObject(), Filesystem(),
|
||||||
|
mEntries);
|
||||||
return reader.forget();
|
return reader.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
RootDirectoryEntry::GetInternal(const nsAString& aPath, const FileSystemFlags& aFlag,
|
FileSystemRootDirectoryEntry::GetInternal(const nsAString& aPath,
|
||||||
const Optional<OwningNonNull<EntryCallback>>& aSuccessCallback,
|
const FileSystemFlags& aFlag,
|
||||||
const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback,
|
const Optional<OwningNonNull<FileSystemEntryCallback>>& aSuccessCallback,
|
||||||
GetInternalType aType) const
|
const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback,
|
||||||
|
GetInternalType aType) const
|
||||||
{
|
{
|
||||||
if (!aSuccessCallback.WasPassed() && !aErrorCallback.WasPassed()) {
|
if (!aSuccessCallback.WasPassed() && !aErrorCallback.WasPassed()) {
|
||||||
return;
|
return;
|
||||||
|
@ -76,7 +79,7 @@ RootDirectoryEntry::GetInternal(const nsAString& aPath, const FileSystemFlags& a
|
||||||
|
|
||||||
MOZ_ASSERT(!parts.IsEmpty());
|
MOZ_ASSERT(!parts.IsEmpty());
|
||||||
|
|
||||||
RefPtr<Entry> entry;
|
RefPtr<FileSystemEntry> entry;
|
||||||
for (uint32_t i = 0; i < mEntries.Length(); ++i) {
|
for (uint32_t i = 0; i < mEntries.Length(); ++i) {
|
||||||
ErrorResult rv;
|
ErrorResult rv;
|
||||||
nsAutoString name;
|
nsAutoString name;
|
||||||
|
@ -135,7 +138,7 @@ RootDirectoryEntry::GetInternal(const nsAString& aPath, const FileSystemFlags& a
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto* directoryEntry = static_cast<DirectoryEntry*>(entry.get());
|
auto* directoryEntry = static_cast<FileSystemDirectoryEntry*>(entry.get());
|
||||||
directoryEntry->GetInternal(path, aFlag, aSuccessCallback, aErrorCallback,
|
directoryEntry->GetInternal(path, aFlag, aSuccessCallback, aErrorCallback,
|
||||||
aType);
|
aType);
|
||||||
}
|
}
|
|
@ -4,23 +4,23 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
* 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/. */
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#ifndef mozilla_dom_RootDirectoryEntry_h
|
#ifndef mozilla_dom_FileSystemRootDirectoryEntry_h
|
||||||
#define mozilla_dom_RootDirectoryEntry_h
|
#define mozilla_dom_FileSystemRootDirectoryEntry_h
|
||||||
|
|
||||||
#include "mozilla/dom/DirectoryEntry.h"
|
#include "mozilla/dom/FileSystemDirectoryEntry.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace dom {
|
namespace dom {
|
||||||
|
|
||||||
class RootDirectoryEntry final : public DirectoryEntry
|
class FileSystemRootDirectoryEntry final : public FileSystemDirectoryEntry
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NS_DECL_ISUPPORTS_INHERITED
|
NS_DECL_ISUPPORTS_INHERITED
|
||||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(RootDirectoryEntry, DirectoryEntry)
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(FileSystemRootDirectoryEntry, FileSystemDirectoryEntry)
|
||||||
|
|
||||||
RootDirectoryEntry(nsIGlobalObject* aGlobalObject,
|
FileSystemRootDirectoryEntry(nsIGlobalObject* aGlobalObject,
|
||||||
const Sequence<RefPtr<Entry>>& aEntries,
|
const Sequence<RefPtr<FileSystemEntry>>& aEntries,
|
||||||
DOMFileSystem* aFileSystem);
|
FileSystem* aFileSystem);
|
||||||
|
|
||||||
virtual void
|
virtual void
|
||||||
GetName(nsAString& aName, ErrorResult& aRv) const override;
|
GetName(nsAString& aName, ErrorResult& aRv) const override;
|
||||||
|
@ -28,15 +28,15 @@ public:
|
||||||
virtual void
|
virtual void
|
||||||
GetFullPath(nsAString& aFullPath, ErrorResult& aRv) const override;
|
GetFullPath(nsAString& aFullPath, ErrorResult& aRv) const override;
|
||||||
|
|
||||||
virtual already_AddRefed<DirectoryReader>
|
virtual already_AddRefed<FileSystemDirectoryReader>
|
||||||
CreateReader() const override;
|
CreateReader() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
~RootDirectoryEntry();
|
~FileSystemRootDirectoryEntry();
|
||||||
|
|
||||||
virtual void
|
virtual void
|
||||||
GetInternal(const nsAString& aPath, const FileSystemFlags& aFlag,
|
GetInternal(const nsAString& aPath, const FileSystemFlags& aFlag,
|
||||||
const Optional<OwningNonNull<EntryCallback>>& aSuccessCallback,
|
const Optional<OwningNonNull<FileSystemEntryCallback>>& aSuccessCallback,
|
||||||
const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback,
|
const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback,
|
||||||
GetInternalType aType) const override;
|
GetInternalType aType) const override;
|
||||||
|
|
||||||
|
@ -44,10 +44,10 @@ private:
|
||||||
Error(const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback,
|
Error(const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback,
|
||||||
nsresult aError) const;
|
nsresult aError) const;
|
||||||
|
|
||||||
Sequence<RefPtr<Entry>> mEntries;
|
Sequence<RefPtr<FileSystemEntry>> mEntries;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace dom
|
} // namespace dom
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
||||||
#endif // mozilla_dom_RootDirectoryEntry_h
|
#endif // mozilla_dom_FileSystemRootDirectoryEntry_h
|
|
@ -4,7 +4,7 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
* 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/. */
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#include "RootDirectoryReader.h"
|
#include "FileSystemRootDirectoryReader.h"
|
||||||
#include "CallbackRunnables.h"
|
#include "CallbackRunnables.h"
|
||||||
#include "nsIGlobalObject.h"
|
#include "nsIGlobalObject.h"
|
||||||
|
|
||||||
|
@ -16,8 +16,8 @@ namespace {
|
||||||
class EntriesCallbackRunnable final : public Runnable
|
class EntriesCallbackRunnable final : public Runnable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
EntriesCallbackRunnable(EntriesCallback* aCallback,
|
EntriesCallbackRunnable(FileSystemEntriesCallback* aCallback,
|
||||||
const Sequence<RefPtr<Entry>>& aEntries)
|
const Sequence<RefPtr<FileSystemEntry>>& aEntries)
|
||||||
: mCallback(aCallback)
|
: mCallback(aCallback)
|
||||||
, mEntries(aEntries)
|
, mEntries(aEntries)
|
||||||
{
|
{
|
||||||
|
@ -27,7 +27,7 @@ public:
|
||||||
NS_IMETHOD
|
NS_IMETHOD
|
||||||
Run() override
|
Run() override
|
||||||
{
|
{
|
||||||
Sequence<OwningNonNull<Entry>> entries;
|
Sequence<OwningNonNull<FileSystemEntry>> entries;
|
||||||
for (uint32_t i = 0; i < mEntries.Length(); ++i) {
|
for (uint32_t i = 0; i < mEntries.Length(); ++i) {
|
||||||
if (!entries.AppendElement(mEntries[i].forget(), fallible)) {
|
if (!entries.AppendElement(mEntries[i].forget(), fallible)) {
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
|
@ -39,24 +39,27 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RefPtr<EntriesCallback> mCallback;
|
RefPtr<FileSystemEntriesCallback> mCallback;
|
||||||
Sequence<RefPtr<Entry>> mEntries;
|
Sequence<RefPtr<FileSystemEntry>> mEntries;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // anonymous namespace
|
} // anonymous namespace
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_INHERITED(RootDirectoryReader, DirectoryReader, mEntries)
|
NS_IMPL_CYCLE_COLLECTION_INHERITED(FileSystemRootDirectoryReader,
|
||||||
|
FileSystemDirectoryReader, mEntries)
|
||||||
|
|
||||||
NS_IMPL_ADDREF_INHERITED(RootDirectoryReader, DirectoryReader)
|
NS_IMPL_ADDREF_INHERITED(FileSystemRootDirectoryReader,
|
||||||
NS_IMPL_RELEASE_INHERITED(RootDirectoryReader, DirectoryReader)
|
FileSystemDirectoryReader)
|
||||||
|
NS_IMPL_RELEASE_INHERITED(FileSystemRootDirectoryReader,
|
||||||
|
FileSystemDirectoryReader)
|
||||||
|
|
||||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(RootDirectoryReader)
|
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(FileSystemRootDirectoryReader)
|
||||||
NS_INTERFACE_MAP_END_INHERITING(DirectoryReader)
|
NS_INTERFACE_MAP_END_INHERITING(FileSystemDirectoryReader)
|
||||||
|
|
||||||
RootDirectoryReader::RootDirectoryReader(nsIGlobalObject* aGlobal,
|
FileSystemRootDirectoryReader::FileSystemRootDirectoryReader(nsIGlobalObject* aGlobal,
|
||||||
DOMFileSystem* aFileSystem,
|
FileSystem* aFileSystem,
|
||||||
const Sequence<RefPtr<Entry>>& aEntries)
|
const Sequence<RefPtr<FileSystemEntry>>& aEntries)
|
||||||
: DirectoryReader(aGlobal, aFileSystem, nullptr)
|
: FileSystemDirectoryReader(aGlobal, aFileSystem, nullptr)
|
||||||
, mEntries(aEntries)
|
, mEntries(aEntries)
|
||||||
, mAlreadyRead(false)
|
, mAlreadyRead(false)
|
||||||
{
|
{
|
||||||
|
@ -64,13 +67,13 @@ RootDirectoryReader::RootDirectoryReader(nsIGlobalObject* aGlobal,
|
||||||
MOZ_ASSERT(aFileSystem);
|
MOZ_ASSERT(aFileSystem);
|
||||||
}
|
}
|
||||||
|
|
||||||
RootDirectoryReader::~RootDirectoryReader()
|
FileSystemRootDirectoryReader::~FileSystemRootDirectoryReader()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void
|
void
|
||||||
RootDirectoryReader::ReadEntries(EntriesCallback& aSuccessCallback,
|
FileSystemRootDirectoryReader::ReadEntries(FileSystemEntriesCallback& aSuccessCallback,
|
||||||
const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback,
|
const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback,
|
||||||
ErrorResult& aRv)
|
ErrorResult& aRv)
|
||||||
{
|
{
|
||||||
if (mAlreadyRead) {
|
if (mAlreadyRead) {
|
||||||
RefPtr<EmptyEntriesCallbackRunnable> runnable =
|
RefPtr<EmptyEntriesCallbackRunnable> runnable =
|
|
@ -0,0 +1,41 @@
|
||||||
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||||
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||||
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
#ifndef mozilla_dom_FileSystemRootDirectoryReader_h
|
||||||
|
#define mozilla_dom_FileSystemRootDirectoryReader_h
|
||||||
|
|
||||||
|
#include "FileSystemDirectoryReader.h"
|
||||||
|
|
||||||
|
namespace mozilla {
|
||||||
|
namespace dom {
|
||||||
|
|
||||||
|
class FileSystemRootDirectoryReader final : public FileSystemDirectoryReader
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
NS_DECL_ISUPPORTS_INHERITED
|
||||||
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(FileSystemRootDirectoryReader,
|
||||||
|
FileSystemDirectoryReader)
|
||||||
|
|
||||||
|
explicit FileSystemRootDirectoryReader(nsIGlobalObject* aGlobalObject,
|
||||||
|
FileSystem* aFileSystem,
|
||||||
|
const Sequence<RefPtr<FileSystemEntry>>& aEntries);
|
||||||
|
|
||||||
|
virtual void
|
||||||
|
ReadEntries(FileSystemEntriesCallback& aSuccessCallback,
|
||||||
|
const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback,
|
||||||
|
ErrorResult& aRv) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
~FileSystemRootDirectoryReader();
|
||||||
|
|
||||||
|
Sequence<RefPtr<FileSystemEntry>> mEntries;
|
||||||
|
bool mAlreadyRead;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace dom
|
||||||
|
} // namespace mozilla
|
||||||
|
|
||||||
|
#endif // mozilla_dom_FileSystemRootDirectoryReader_h
|
|
@ -1,40 +0,0 @@
|
||||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
||||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
||||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
||||||
|
|
||||||
#ifndef mozilla_dom_RootDirectoryReader_h
|
|
||||||
#define mozilla_dom_RootDirectoryReader_h
|
|
||||||
|
|
||||||
#include "DirectoryReader.h"
|
|
||||||
|
|
||||||
namespace mozilla {
|
|
||||||
namespace dom {
|
|
||||||
|
|
||||||
class RootDirectoryReader final : public DirectoryReader
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
NS_DECL_ISUPPORTS_INHERITED
|
|
||||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(RootDirectoryReader, DirectoryReader)
|
|
||||||
|
|
||||||
explicit RootDirectoryReader(nsIGlobalObject* aGlobalObject,
|
|
||||||
DOMFileSystem* aFileSystem,
|
|
||||||
const Sequence<RefPtr<Entry>>& aEntries);
|
|
||||||
|
|
||||||
virtual void
|
|
||||||
ReadEntries(EntriesCallback& aSuccessCallback,
|
|
||||||
const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback,
|
|
||||||
ErrorResult& aRv) override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
~RootDirectoryReader();
|
|
||||||
|
|
||||||
Sequence<RefPtr<Entry>> mEntries;
|
|
||||||
bool mAlreadyRead;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace dom
|
|
||||||
} // namespace mozilla
|
|
||||||
|
|
||||||
#endif // mozilla_dom_RootDirectoryReader_h
|
|
|
@ -7,22 +7,22 @@
|
||||||
TEST_DIRS += ['tests']
|
TEST_DIRS += ['tests']
|
||||||
|
|
||||||
EXPORTS.mozilla.dom += [
|
EXPORTS.mozilla.dom += [
|
||||||
'DirectoryEntry.h',
|
'FileSystem.h',
|
||||||
'DirectoryReader.h',
|
'FileSystemDirectoryEntry.h',
|
||||||
'DOMFileSystem.h',
|
'FileSystemDirectoryReader.h',
|
||||||
'Entry.h',
|
'FileSystemEntry.h',
|
||||||
'FileEntry.h',
|
'FileSystemFileEntry.h',
|
||||||
]
|
]
|
||||||
|
|
||||||
UNIFIED_SOURCES += [
|
UNIFIED_SOURCES += [
|
||||||
'CallbackRunnables.cpp',
|
'CallbackRunnables.cpp',
|
||||||
'DirectoryEntry.cpp',
|
'FileSystem.cpp',
|
||||||
'DirectoryReader.cpp',
|
'FileSystemDirectoryEntry.cpp',
|
||||||
'DOMFileSystem.cpp',
|
'FileSystemDirectoryReader.cpp',
|
||||||
'Entry.cpp',
|
'FileSystemEntry.cpp',
|
||||||
'FileEntry.cpp',
|
'FileSystemFileEntry.cpp',
|
||||||
'RootDirectoryEntry.cpp',
|
'FileSystemRootDirectoryEntry.cpp',
|
||||||
'RootDirectoryReader.cpp',
|
'FileSystemRootDirectoryReader.cpp',
|
||||||
]
|
]
|
||||||
|
|
||||||
FINAL_LIBRARY = 'xul'
|
FINAL_LIBRARY = 'xul'
|
||||||
|
|
|
@ -79,8 +79,8 @@
|
||||||
#include "nsIRadioGroupContainer.h"
|
#include "nsIRadioGroupContainer.h"
|
||||||
|
|
||||||
// input type=file
|
// input type=file
|
||||||
#include "mozilla/dom/Entry.h"
|
#include "mozilla/dom/FileSystemEntry.h"
|
||||||
#include "mozilla/dom/DOMFileSystem.h"
|
#include "mozilla/dom/FileSystem.h"
|
||||||
#include "mozilla/dom/File.h"
|
#include "mozilla/dom/File.h"
|
||||||
#include "mozilla/dom/FileList.h"
|
#include "mozilla/dom/FileList.h"
|
||||||
#include "nsIFile.h"
|
#include "nsIFile.h"
|
||||||
|
@ -1467,8 +1467,10 @@ HTMLInputElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
||||||
if (aName == nsGkAtoms::readonly || aName == nsGkAtoms::disabled) {
|
if (aName == nsGkAtoms::readonly || aName == nsGkAtoms::disabled) {
|
||||||
UpdateBarredFromConstraintValidation();
|
UpdateBarredFromConstraintValidation();
|
||||||
}
|
}
|
||||||
} else if (MaxLengthApplies() && aName == nsGkAtoms::maxlength) {
|
} else if (MinOrMaxLengthApplies() && aName == nsGkAtoms::maxlength) {
|
||||||
UpdateTooLongValidityState();
|
UpdateTooLongValidityState();
|
||||||
|
} else if (MinOrMaxLengthApplies() && aName == nsGkAtoms::minlength) {
|
||||||
|
UpdateTooShortValidityState();
|
||||||
} else if (aName == nsGkAtoms::pattern && !mParserCreating) {
|
} else if (aName == nsGkAtoms::pattern && !mParserCreating) {
|
||||||
UpdatePatternMismatchValidityState();
|
UpdatePatternMismatchValidityState();
|
||||||
} else if (aName == nsGkAtoms::multiple) {
|
} else if (aName == nsGkAtoms::multiple) {
|
||||||
|
@ -1589,6 +1591,7 @@ NS_IMPL_ENUM_ATTR_DEFAULT_VALUE(HTMLInputElement, InputMode, inputmode,
|
||||||
kInputDefaultInputmode->tag)
|
kInputDefaultInputmode->tag)
|
||||||
NS_IMPL_BOOL_ATTR(HTMLInputElement, Multiple, multiple)
|
NS_IMPL_BOOL_ATTR(HTMLInputElement, Multiple, multiple)
|
||||||
NS_IMPL_NON_NEGATIVE_INT_ATTR(HTMLInputElement, MaxLength, maxlength)
|
NS_IMPL_NON_NEGATIVE_INT_ATTR(HTMLInputElement, MaxLength, maxlength)
|
||||||
|
NS_IMPL_NON_NEGATIVE_INT_ATTR(HTMLInputElement, MinLength, minlength)
|
||||||
NS_IMPL_STRING_ATTR(HTMLInputElement, Name, name)
|
NS_IMPL_STRING_ATTR(HTMLInputElement, Name, name)
|
||||||
NS_IMPL_BOOL_ATTR(HTMLInputElement, ReadOnly, readonly)
|
NS_IMPL_BOOL_ATTR(HTMLInputElement, ReadOnly, readonly)
|
||||||
NS_IMPL_BOOL_ATTR(HTMLInputElement, Required, required)
|
NS_IMPL_BOOL_ATTR(HTMLInputElement, Required, required)
|
||||||
|
@ -4089,8 +4092,7 @@ HTMLInputElement::MaybeInitPickers(EventChainPostVisitor& aVisitor)
|
||||||
nsCOMPtr<nsIContent> target =
|
nsCOMPtr<nsIContent> target =
|
||||||
do_QueryInterface(aVisitor.mEvent->mOriginalTarget);
|
do_QueryInterface(aVisitor.mEvent->mOriginalTarget);
|
||||||
if (target &&
|
if (target &&
|
||||||
target->GetParent() == this &&
|
target->FindFirstNonChromeOnlyAccessContent() == this &&
|
||||||
target->IsRootOfNativeAnonymousSubtree() &&
|
|
||||||
((Preferences::GetBool("dom.input.dirpicker", false) && Allowdirs()) ||
|
((Preferences::GetBool("dom.input.dirpicker", false) && Allowdirs()) ||
|
||||||
(Preferences::GetBool("dom.webkitBlink.dirPicker.enabled", false) &&
|
(Preferences::GetBool("dom.webkitBlink.dirPicker.enabled", false) &&
|
||||||
HasAttr(kNameSpaceID_None, nsGkAtoms::webkitdirectory)))) {
|
HasAttr(kNameSpaceID_None, nsGkAtoms::webkitdirectory)))) {
|
||||||
|
@ -5333,6 +5335,9 @@ HTMLInputElement::ParseAttribute(int32_t aNamespaceID,
|
||||||
if (aAttribute == nsGkAtoms::maxlength) {
|
if (aAttribute == nsGkAtoms::maxlength) {
|
||||||
return aResult.ParseNonNegativeIntValue(aValue);
|
return aResult.ParseNonNegativeIntValue(aValue);
|
||||||
}
|
}
|
||||||
|
if (aAttribute == nsGkAtoms::minlength) {
|
||||||
|
return aResult.ParseNonNegativeIntValue(aValue);
|
||||||
|
}
|
||||||
if (aAttribute == nsGkAtoms::size) {
|
if (aAttribute == nsGkAtoms::size) {
|
||||||
return aResult.ParsePositiveIntValue(aValue);
|
return aResult.ParsePositiveIntValue(aValue);
|
||||||
}
|
}
|
||||||
|
@ -7005,7 +7010,7 @@ HTMLInputElement::IsTooLong()
|
||||||
{
|
{
|
||||||
if (!mValueChanged ||
|
if (!mValueChanged ||
|
||||||
!mLastValueChangeWasInteractive ||
|
!mLastValueChangeWasInteractive ||
|
||||||
!MaxLengthApplies() ||
|
!MinOrMaxLengthApplies() ||
|
||||||
!HasAttr(kNameSpaceID_None, nsGkAtoms::maxlength)) {
|
!HasAttr(kNameSpaceID_None, nsGkAtoms::maxlength)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -7023,6 +7028,29 @@ HTMLInputElement::IsTooLong()
|
||||||
return textLength > maxLength;
|
return textLength > maxLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
HTMLInputElement::IsTooShort()
|
||||||
|
{
|
||||||
|
if (!mValueChanged ||
|
||||||
|
!mLastValueChangeWasInteractive ||
|
||||||
|
!MinOrMaxLengthApplies() ||
|
||||||
|
!HasAttr(kNameSpaceID_None, nsGkAtoms::minlength)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t minLength = MinLength();
|
||||||
|
|
||||||
|
// Minlength of -1 means parsing error.
|
||||||
|
if (minLength == -1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t textLength = -1;
|
||||||
|
GetTextLength(&textLength);
|
||||||
|
|
||||||
|
return textLength && textLength < minLength;
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
HTMLInputElement::IsValueMissing() const
|
HTMLInputElement::IsValueMissing() const
|
||||||
{
|
{
|
||||||
|
@ -7284,6 +7312,12 @@ HTMLInputElement::UpdateTooLongValidityState()
|
||||||
SetValidityState(VALIDITY_STATE_TOO_LONG, IsTooLong());
|
SetValidityState(VALIDITY_STATE_TOO_LONG, IsTooLong());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
HTMLInputElement::UpdateTooShortValidityState()
|
||||||
|
{
|
||||||
|
SetValidityState(VALIDITY_STATE_TOO_SHORT, IsTooShort());
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
HTMLInputElement::UpdateValueMissingValidityStateForRadio(bool aIgnoreSelf)
|
HTMLInputElement::UpdateValueMissingValidityStateForRadio(bool aIgnoreSelf)
|
||||||
{
|
{
|
||||||
|
@ -7384,6 +7418,7 @@ HTMLInputElement::UpdateAllValidityStates(bool aNotify)
|
||||||
{
|
{
|
||||||
bool validBefore = IsValid();
|
bool validBefore = IsValid();
|
||||||
UpdateTooLongValidityState();
|
UpdateTooLongValidityState();
|
||||||
|
UpdateTooShortValidityState();
|
||||||
UpdateValueMissingValidityState();
|
UpdateValueMissingValidityState();
|
||||||
UpdateTypeMismatchValidityState();
|
UpdateTypeMismatchValidityState();
|
||||||
UpdatePatternMismatchValidityState();
|
UpdatePatternMismatchValidityState();
|
||||||
|
@ -7442,6 +7477,26 @@ HTMLInputElement::GetValidationMessage(nsAString& aValidationMessage,
|
||||||
aValidationMessage = message;
|
aValidationMessage = message;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case VALIDITY_STATE_TOO_SHORT:
|
||||||
|
{
|
||||||
|
nsXPIDLString message;
|
||||||
|
int32_t minLength = MinLength();
|
||||||
|
int32_t textLength = -1;
|
||||||
|
nsAutoString strMinLength;
|
||||||
|
nsAutoString strTextLength;
|
||||||
|
|
||||||
|
GetTextLength(&textLength);
|
||||||
|
|
||||||
|
strMinLength.AppendInt(minLength);
|
||||||
|
strTextLength.AppendInt(textLength);
|
||||||
|
|
||||||
|
const char16_t* params[] = { strMinLength.get(), strTextLength.get() };
|
||||||
|
rv = nsContentUtils::FormatLocalizedString(nsContentUtils::eDOM_PROPERTIES,
|
||||||
|
"FormValidationTextTooShort",
|
||||||
|
params, message);
|
||||||
|
aValidationMessage = message;
|
||||||
|
break;
|
||||||
|
}
|
||||||
case VALIDITY_STATE_VALUE_MISSING:
|
case VALIDITY_STATE_VALUE_MISSING:
|
||||||
{
|
{
|
||||||
nsXPIDLString message;
|
nsXPIDLString message;
|
||||||
|
@ -8204,14 +8259,15 @@ HTMLInputElement::UpdateEntries(const nsTArray<OwningFileOrDirectory>& aFilesOrD
|
||||||
nsCOMPtr<nsIGlobalObject> global = OwnerDoc()->GetScopeObject();
|
nsCOMPtr<nsIGlobalObject> global = OwnerDoc()->GetScopeObject();
|
||||||
MOZ_ASSERT(global);
|
MOZ_ASSERT(global);
|
||||||
|
|
||||||
RefPtr<DOMFileSystem> fs = DOMFileSystem::Create(global);
|
RefPtr<FileSystem> fs = FileSystem::Create(global);
|
||||||
if (NS_WARN_IF(!fs)) {
|
if (NS_WARN_IF(!fs)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Sequence<RefPtr<Entry>> entries;
|
Sequence<RefPtr<FileSystemEntry>> entries;
|
||||||
for (uint32_t i = 0; i < aFilesOrDirectories.Length(); ++i) {
|
for (uint32_t i = 0; i < aFilesOrDirectories.Length(); ++i) {
|
||||||
RefPtr<Entry> entry = Entry::Create(global, aFilesOrDirectories[i], fs);
|
RefPtr<FileSystemEntry> entry =
|
||||||
|
FileSystemEntry::Create(global, aFilesOrDirectories[i], fs);
|
||||||
MOZ_ASSERT(entry);
|
MOZ_ASSERT(entry);
|
||||||
|
|
||||||
if (!entries.AppendElement(entry, fallible)) {
|
if (!entries.AppendElement(entry, fallible)) {
|
||||||
|
@ -8227,7 +8283,7 @@ HTMLInputElement::UpdateEntries(const nsTArray<OwningFileOrDirectory>& aFilesOrD
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
HTMLInputElement::GetWebkitEntries(nsTArray<RefPtr<Entry>>& aSequence)
|
HTMLInputElement::GetWebkitEntries(nsTArray<RefPtr<FileSystemEntry>>& aSequence)
|
||||||
{
|
{
|
||||||
Telemetry::Accumulate(Telemetry::BLINK_FILESYSTEM_USED, true);
|
Telemetry::Accumulate(Telemetry::BLINK_FILESYSTEM_USED, true);
|
||||||
aSequence.AppendElements(mEntries);
|
aSequence.AppendElements(mEntries);
|
||||||
|
|
|
@ -40,9 +40,9 @@ namespace dom {
|
||||||
class AfterSetFilesOrDirectoriesRunnable;
|
class AfterSetFilesOrDirectoriesRunnable;
|
||||||
class Date;
|
class Date;
|
||||||
class DispatchChangeEventCallback;
|
class DispatchChangeEventCallback;
|
||||||
class Entry;
|
|
||||||
class File;
|
class File;
|
||||||
class FileList;
|
class FileList;
|
||||||
|
class FileSystemEntry;
|
||||||
class GetFilesHelper;
|
class GetFilesHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -306,6 +306,7 @@ public:
|
||||||
|
|
||||||
// nsIConstraintValidation
|
// nsIConstraintValidation
|
||||||
bool IsTooLong();
|
bool IsTooLong();
|
||||||
|
bool IsTooShort();
|
||||||
bool IsValueMissing() const;
|
bool IsValueMissing() const;
|
||||||
bool HasTypeMismatch() const;
|
bool HasTypeMismatch() const;
|
||||||
bool HasPatternMismatch() const;
|
bool HasPatternMismatch() const;
|
||||||
|
@ -314,6 +315,7 @@ public:
|
||||||
bool HasStepMismatch(bool aUseZeroIfValueNaN = false) const;
|
bool HasStepMismatch(bool aUseZeroIfValueNaN = false) const;
|
||||||
bool HasBadInput() const;
|
bool HasBadInput() const;
|
||||||
void UpdateTooLongValidityState();
|
void UpdateTooLongValidityState();
|
||||||
|
void UpdateTooShortValidityState();
|
||||||
void UpdateValueMissingValidityState();
|
void UpdateValueMissingValidityState();
|
||||||
void UpdateTypeMismatchValidityState();
|
void UpdateTypeMismatchValidityState();
|
||||||
void UpdatePatternMismatchValidityState();
|
void UpdatePatternMismatchValidityState();
|
||||||
|
@ -534,7 +536,8 @@ public:
|
||||||
|
|
||||||
void SetMaxLength(int32_t aValue, ErrorResult& aRv)
|
void SetMaxLength(int32_t aValue, ErrorResult& aRv)
|
||||||
{
|
{
|
||||||
if (aValue < 0) {
|
int32_t minLength = MinLength();
|
||||||
|
if (aValue < 0 || (minLength >= 0 && aValue < minLength)) {
|
||||||
aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
|
aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -542,6 +545,22 @@ public:
|
||||||
SetHTMLIntAttr(nsGkAtoms::maxlength, aValue, aRv);
|
SetHTMLIntAttr(nsGkAtoms::maxlength, aValue, aRv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t MinLength() const
|
||||||
|
{
|
||||||
|
return GetIntAttr(nsGkAtoms::minlength, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetMinLength(int32_t aValue, ErrorResult& aRv)
|
||||||
|
{
|
||||||
|
int32_t maxLength = MaxLength();
|
||||||
|
if (aValue < 0 || (maxLength >= 0 && aValue > maxLength)) {
|
||||||
|
aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetHTMLIntAttr(nsGkAtoms::minlength, aValue, aRv);
|
||||||
|
}
|
||||||
|
|
||||||
// XPCOM GetMin() is OK
|
// XPCOM GetMin() is OK
|
||||||
void SetMin(const nsAString& aValue, ErrorResult& aRv)
|
void SetMin(const nsAString& aValue, ErrorResult& aRv)
|
||||||
{
|
{
|
||||||
|
@ -728,7 +747,7 @@ public:
|
||||||
SetHTMLBoolAttr(nsGkAtoms::webkitdirectory, aValue, aRv);
|
SetHTMLBoolAttr(nsGkAtoms::webkitdirectory, aValue, aRv);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetWebkitEntries(nsTArray<RefPtr<Entry>>& aSequence);
|
void GetWebkitEntries(nsTArray<RefPtr<FileSystemEntry>>& aSequence);
|
||||||
|
|
||||||
bool IsFilesAndDirectoriesSupported() const;
|
bool IsFilesAndDirectoriesSupported() const;
|
||||||
|
|
||||||
|
@ -1049,9 +1068,9 @@ protected:
|
||||||
bool DoesAutocompleteApply() const;
|
bool DoesAutocompleteApply() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns if the maxlength attribute applies for the current type.
|
* Returns if the minlength or maxlength attributes apply for the current type.
|
||||||
*/
|
*/
|
||||||
bool MaxLengthApplies() const { return IsSingleLineTextControl(false, mType); }
|
bool MinOrMaxLengthApplies() const { return IsSingleLineTextControl(false, mType); }
|
||||||
|
|
||||||
void FreeData();
|
void FreeData();
|
||||||
nsTextEditorState *GetEditorState() const;
|
nsTextEditorState *GetEditorState() const;
|
||||||
|
@ -1401,7 +1420,7 @@ protected:
|
||||||
nsString mFirstFilePath;
|
nsString mFirstFilePath;
|
||||||
|
|
||||||
RefPtr<FileList> mFileList;
|
RefPtr<FileList> mFileList;
|
||||||
Sequence<RefPtr<Entry>> mEntries;
|
Sequence<RefPtr<FileSystemEntry>> mEntries;
|
||||||
|
|
||||||
nsString mStaticDocFileList;
|
nsString mStaticDocFileList;
|
||||||
|
|
||||||
|
|
|
@ -193,6 +193,7 @@ NS_IMPL_BOOL_ATTR(HTMLTextAreaElement, Autofocus, autofocus)
|
||||||
NS_IMPL_UINT_ATTR_NON_ZERO_DEFAULT_VALUE(HTMLTextAreaElement, Cols, cols, DEFAULT_COLS)
|
NS_IMPL_UINT_ATTR_NON_ZERO_DEFAULT_VALUE(HTMLTextAreaElement, Cols, cols, DEFAULT_COLS)
|
||||||
NS_IMPL_BOOL_ATTR(HTMLTextAreaElement, Disabled, disabled)
|
NS_IMPL_BOOL_ATTR(HTMLTextAreaElement, Disabled, disabled)
|
||||||
NS_IMPL_NON_NEGATIVE_INT_ATTR(HTMLTextAreaElement, MaxLength, maxlength)
|
NS_IMPL_NON_NEGATIVE_INT_ATTR(HTMLTextAreaElement, MaxLength, maxlength)
|
||||||
|
NS_IMPL_NON_NEGATIVE_INT_ATTR(HTMLTextAreaElement, MinLength, minlength)
|
||||||
NS_IMPL_STRING_ATTR(HTMLTextAreaElement, Name, name)
|
NS_IMPL_STRING_ATTR(HTMLTextAreaElement, Name, name)
|
||||||
NS_IMPL_BOOL_ATTR(HTMLTextAreaElement, ReadOnly, readonly)
|
NS_IMPL_BOOL_ATTR(HTMLTextAreaElement, ReadOnly, readonly)
|
||||||
NS_IMPL_BOOL_ATTR(HTMLTextAreaElement, Required, required)
|
NS_IMPL_BOOL_ATTR(HTMLTextAreaElement, Required, required)
|
||||||
|
@ -398,7 +399,8 @@ HTMLTextAreaElement::ParseAttribute(int32_t aNamespaceID,
|
||||||
nsAttrValue& aResult)
|
nsAttrValue& aResult)
|
||||||
{
|
{
|
||||||
if (aNamespaceID == kNameSpaceID_None) {
|
if (aNamespaceID == kNameSpaceID_None) {
|
||||||
if (aAttribute == nsGkAtoms::maxlength) {
|
if (aAttribute == nsGkAtoms::maxlength ||
|
||||||
|
aAttribute == nsGkAtoms::minlength) {
|
||||||
return aResult.ParseNonNegativeIntValue(aValue);
|
return aResult.ParseNonNegativeIntValue(aValue);
|
||||||
} else if (aAttribute == nsGkAtoms::cols ||
|
} else if (aAttribute == nsGkAtoms::cols ||
|
||||||
aAttribute == nsGkAtoms::rows) {
|
aAttribute == nsGkAtoms::rows) {
|
||||||
|
@ -1317,6 +1319,8 @@ HTMLTextAreaElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
||||||
}
|
}
|
||||||
} else if (aName == nsGkAtoms::maxlength) {
|
} else if (aName == nsGkAtoms::maxlength) {
|
||||||
UpdateTooLongValidityState();
|
UpdateTooLongValidityState();
|
||||||
|
} else if (aName == nsGkAtoms::minlength) {
|
||||||
|
UpdateTooShortValidityState();
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateState(aNotify);
|
UpdateState(aNotify);
|
||||||
|
@ -1390,6 +1394,29 @@ HTMLTextAreaElement::IsTooLong()
|
||||||
return textLength > maxLength;
|
return textLength > maxLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
HTMLTextAreaElement::IsTooShort()
|
||||||
|
{
|
||||||
|
if (!mValueChanged ||
|
||||||
|
!mLastValueChangeWasInteractive ||
|
||||||
|
!HasAttr(kNameSpaceID_None, nsGkAtoms::minlength)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t minLength = -1;
|
||||||
|
GetMinLength(&minLength);
|
||||||
|
|
||||||
|
// Minlength of -1 means parsing error.
|
||||||
|
if (minLength == -1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t textLength = -1;
|
||||||
|
GetTextLength(&textLength);
|
||||||
|
|
||||||
|
return textLength && textLength < minLength;
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
HTMLTextAreaElement::IsValueMissing() const
|
HTMLTextAreaElement::IsValueMissing() const
|
||||||
{
|
{
|
||||||
|
@ -1406,6 +1433,12 @@ HTMLTextAreaElement::UpdateTooLongValidityState()
|
||||||
SetValidityState(VALIDITY_STATE_TOO_LONG, IsTooLong());
|
SetValidityState(VALIDITY_STATE_TOO_LONG, IsTooLong());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
HTMLTextAreaElement::UpdateTooShortValidityState()
|
||||||
|
{
|
||||||
|
SetValidityState(VALIDITY_STATE_TOO_SHORT, IsTooShort());
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
HTMLTextAreaElement::UpdateValueMissingValidityState()
|
HTMLTextAreaElement::UpdateValueMissingValidityState()
|
||||||
{
|
{
|
||||||
|
@ -1449,6 +1482,27 @@ HTMLTextAreaElement::GetValidationMessage(nsAString& aValidationMessage,
|
||||||
aValidationMessage = message;
|
aValidationMessage = message;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case VALIDITY_STATE_TOO_SHORT:
|
||||||
|
{
|
||||||
|
nsXPIDLString message;
|
||||||
|
int32_t minLength = -1;
|
||||||
|
int32_t textLength = -1;
|
||||||
|
nsAutoString strMinLength;
|
||||||
|
nsAutoString strTextLength;
|
||||||
|
|
||||||
|
GetMinLength(&minLength);
|
||||||
|
GetTextLength(&textLength);
|
||||||
|
|
||||||
|
strMinLength.AppendInt(minLength);
|
||||||
|
strTextLength.AppendInt(textLength);
|
||||||
|
|
||||||
|
const char16_t* params[] = { strMinLength.get(), strTextLength.get() };
|
||||||
|
rv = nsContentUtils::FormatLocalizedString(nsContentUtils::eDOM_PROPERTIES,
|
||||||
|
"FormValidationTextTooShort",
|
||||||
|
params, message);
|
||||||
|
aValidationMessage = message;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case VALIDITY_STATE_VALUE_MISSING:
|
case VALIDITY_STATE_VALUE_MISSING:
|
||||||
{
|
{
|
||||||
nsXPIDLString message;
|
nsXPIDLString message;
|
||||||
|
@ -1557,6 +1611,7 @@ HTMLTextAreaElement::OnValueChanged(bool aNotify, bool aWasInteractiveUserChange
|
||||||
// Update the validity state
|
// Update the validity state
|
||||||
bool validBefore = IsValid();
|
bool validBefore = IsValid();
|
||||||
UpdateTooLongValidityState();
|
UpdateTooLongValidityState();
|
||||||
|
UpdateTooShortValidityState();
|
||||||
UpdateValueMissingValidityState();
|
UpdateValueMissingValidityState();
|
||||||
|
|
||||||
if (validBefore != IsValid()) {
|
if (validBefore != IsValid()) {
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include "mozilla/Attributes.h"
|
#include "mozilla/Attributes.h"
|
||||||
#include "nsIDOMHTMLTextAreaElement.h"
|
#include "nsIDOMHTMLTextAreaElement.h"
|
||||||
#include "nsITextControlElement.h"
|
#include "nsITextControlElement.h"
|
||||||
|
#include "nsIControllers.h"
|
||||||
#include "nsIDOMNSEditableElement.h"
|
#include "nsIDOMNSEditableElement.h"
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsGenericHTMLElement.h"
|
#include "nsGenericHTMLElement.h"
|
||||||
|
@ -155,8 +156,10 @@ public:
|
||||||
|
|
||||||
// nsIConstraintValidation
|
// nsIConstraintValidation
|
||||||
bool IsTooLong();
|
bool IsTooLong();
|
||||||
|
bool IsTooShort();
|
||||||
bool IsValueMissing() const;
|
bool IsValueMissing() const;
|
||||||
void UpdateTooLongValidityState();
|
void UpdateTooLongValidityState();
|
||||||
|
void UpdateTooShortValidityState();
|
||||||
void UpdateValueMissingValidityState();
|
void UpdateValueMissingValidityState();
|
||||||
void UpdateBarredFromConstraintValidation();
|
void UpdateBarredFromConstraintValidation();
|
||||||
nsresult GetValidationMessage(nsAString& aValidationMessage,
|
nsresult GetValidationMessage(nsAString& aValidationMessage,
|
||||||
|
@ -199,12 +202,26 @@ public:
|
||||||
}
|
}
|
||||||
void SetMaxLength(int32_t aMaxLength, ErrorResult& aError)
|
void SetMaxLength(int32_t aMaxLength, ErrorResult& aError)
|
||||||
{
|
{
|
||||||
if (aMaxLength < 0) {
|
int32_t minLength = MinLength();
|
||||||
|
if (aMaxLength < 0 || (minLength >= 0 && aMaxLength < minLength)) {
|
||||||
aError.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
|
aError.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
|
||||||
} else {
|
} else {
|
||||||
SetHTMLIntAttr(nsGkAtoms::maxlength, aMaxLength, aError);
|
SetHTMLIntAttr(nsGkAtoms::maxlength, aMaxLength, aError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
int32_t MinLength()
|
||||||
|
{
|
||||||
|
return GetIntAttr(nsGkAtoms::minlength, -1);
|
||||||
|
}
|
||||||
|
void SetMinLength(int32_t aMinLength, ErrorResult& aError)
|
||||||
|
{
|
||||||
|
int32_t maxLength = MaxLength();
|
||||||
|
if (aMinLength < 0 || (maxLength >= 0 && aMinLength > maxLength)) {
|
||||||
|
aError.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
|
||||||
|
} else {
|
||||||
|
SetHTMLIntAttr(nsGkAtoms::minlength, aMinLength, aError);
|
||||||
|
}
|
||||||
|
}
|
||||||
// XPCOM GetName is fine
|
// XPCOM GetName is fine
|
||||||
void SetName(const nsAString& aName, ErrorResult& aError)
|
void SetName(const nsAString& aName, ErrorResult& aError)
|
||||||
{
|
{
|
||||||
|
|
|
@ -55,6 +55,13 @@ ValidityState::GetTooLong(bool* aTooLong)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
ValidityState::GetTooShort(bool* aTooShort)
|
||||||
|
{
|
||||||
|
*aTooShort = TooShort();
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
ValidityState::GetRangeUnderflow(bool* aRangeUnderflow)
|
ValidityState::GetRangeUnderflow(bool* aRangeUnderflow)
|
||||||
{
|
{
|
||||||
|
|
|
@ -50,6 +50,10 @@ public:
|
||||||
{
|
{
|
||||||
return GetValidityState(nsIConstraintValidation::VALIDITY_STATE_TOO_LONG);
|
return GetValidityState(nsIConstraintValidation::VALIDITY_STATE_TOO_LONG);
|
||||||
}
|
}
|
||||||
|
bool TooShort() const
|
||||||
|
{
|
||||||
|
return GetValidityState(nsIConstraintValidation::VALIDITY_STATE_TOO_SHORT);
|
||||||
|
}
|
||||||
bool RangeUnderflow() const
|
bool RangeUnderflow() const
|
||||||
{
|
{
|
||||||
return GetValidityState(nsIConstraintValidation::VALIDITY_STATE_RANGE_UNDERFLOW);
|
return GetValidityState(nsIConstraintValidation::VALIDITY_STATE_RANGE_UNDERFLOW);
|
||||||
|
|
|
@ -947,7 +947,8 @@ nsHTMLDocument::SetDomain(const nsAString& aDomain, ErrorResult& rv)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
rv2 = newURI->SetHostPort(NS_ConvertUTF16toUTF8(aDomain));
|
// We use SetHostAndPort because we want to reset the port number if needed.
|
||||||
|
rv2 = newURI->SetHostAndPort(NS_ConvertUTF16toUTF8(aDomain));
|
||||||
if (NS_FAILED(rv2)) {
|
if (NS_FAILED(rv2)) {
|
||||||
rv.Throw(rv2);
|
rv.Throw(rv2);
|
||||||
return;
|
return;
|
||||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче