mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge mozilla-central to b2g-inbound
This commit is contained in:
commit
fc987c1ac0
2
CLOBBER
2
CLOBBER
@ -22,5 +22,5 @@
|
||||
# changes to stick? As of bug 928195, this shouldn't be necessary! Please
|
||||
# don't change CLOBBER for WebIDL changes any more.
|
||||
|
||||
Bug 1003764 - Oh snap, Waldo did it again.
|
||||
Bug 1014976 - Windows debug bustage from linking changes.
|
||||
|
||||
|
@ -82,7 +82,7 @@ RelatedAccIterator::
|
||||
{
|
||||
mBindingParent = aDependentContent->GetBindingParent();
|
||||
nsIAtom* IDAttr = mBindingParent ?
|
||||
nsGkAtoms::anonid : aDependentContent->GetIDAttributeName();
|
||||
nsGkAtoms::anonid : nsGkAtoms::id;
|
||||
|
||||
nsAutoString id;
|
||||
if (aDependentContent->GetAttr(kNameSpaceID_None, IDAttr, id))
|
||||
|
@ -456,8 +456,7 @@ nsCoreUtils::IsErrorPage(nsIDocument *aDocument)
|
||||
bool
|
||||
nsCoreUtils::GetID(nsIContent *aContent, nsAString& aID)
|
||||
{
|
||||
nsIAtom *idAttribute = aContent->GetIDAttributeName();
|
||||
return idAttribute ? aContent->GetAttr(kNameSpaceID_None, idAttribute, aID) : false;
|
||||
return aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::id, aID);
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -1555,7 +1555,7 @@ Accessible::ApplyARIAState(uint64_t* aState) const
|
||||
if (mRoleMapEntry->role != roles::NOTHING)
|
||||
*aState &= ~states::READONLY;
|
||||
|
||||
if (mContent->HasAttr(kNameSpaceID_None, mContent->GetIDAttributeName())) {
|
||||
if (mContent->HasID()) {
|
||||
// If has a role & ID and aria-activedescendant on the container, assume focusable
|
||||
nsIContent *ancestorContent = mContent;
|
||||
while ((ancestorContent = ancestorContent->GetParent()) != nullptr) {
|
||||
|
@ -166,9 +166,6 @@ HTMLListBulletAccessible::Name(nsString &aName)
|
||||
nsBlockFrame* blockFrame = do_QueryFrame(mContent->GetPrimaryFrame());
|
||||
if (blockFrame) {
|
||||
blockFrame->GetBulletText(aName);
|
||||
|
||||
// Append space otherwise bullets are jammed up against list text.
|
||||
aName.Append(' ');
|
||||
}
|
||||
|
||||
return eNameOK;
|
||||
|
@ -71,8 +71,8 @@
|
||||
testText(IDs, 0, 1, kEmbedChar);
|
||||
|
||||
IDs = [ "listitem" ];
|
||||
testCharacterCount(IDs, 5);
|
||||
testText(IDs, 0, 5, "1.foo");
|
||||
testCharacterCount(IDs, 6);
|
||||
testText(IDs, 0, 6, "1. foo");
|
||||
|
||||
testText(["testbr"], 0, 3, "foo");
|
||||
|
||||
|
@ -118,17 +118,17 @@
|
||||
// list items
|
||||
|
||||
testTextAtOffset([ "li1" ], BOUNDARY_LINE_START,
|
||||
[ [ 0, 5, kDiscBulletChar + "Item", 0, 5 ] ]);
|
||||
[ [ 0, 6, kDiscBulletText + "Item", 0, 6 ] ]);
|
||||
testTextAtOffset([ "li2" ], BOUNDARY_LINE_START,
|
||||
[ [ 0, 1, kDiscBulletChar, 0, 1 ] ]);
|
||||
[ [ 0, 2, kDiscBulletText, 0, 2 ] ]);
|
||||
testTextAtOffset([ "li3" ], BOUNDARY_LINE_START,
|
||||
[ [ 0, 7, kDiscBulletChar + "a long ", 0, 8 ],
|
||||
[ 8, 11, "and ", 8, 12 ] ]);
|
||||
[ [ 0, 8, kDiscBulletText + "a long ", 0, 9 ],
|
||||
[ 9, 12, "and ", 9, 13 ] ]);
|
||||
testTextAtOffset([ "li4" ], BOUNDARY_LINE_START,
|
||||
[ [ 0, 6, kDiscBulletChar + "a " + kEmbedChar + " c", 0, 6 ] ]);
|
||||
[ [ 0, 7, kDiscBulletText + "a " + kEmbedChar + " c", 0, 7 ] ]);
|
||||
testTextAtOffset([ "li5" ], BOUNDARY_LINE_START,
|
||||
[ [ 0, 1, kDiscBulletChar + "\n", 0, 2 ],
|
||||
[ 2, 6, "hello", 2, 7 ] ]);
|
||||
[ [ 0, 2, kDiscBulletText + "\n", 0, 3 ],
|
||||
[ 3, 7, "hello", 3, 8 ] ]);
|
||||
testTextAtOffset([ "ul1" ], BOUNDARY_LINE_START,
|
||||
[ [ 0, 0, kEmbedChar, 0, 1 ],
|
||||
[ 1, 1, kEmbedChar, 1, 2 ],
|
||||
@ -137,17 +137,17 @@
|
||||
[ 4, 5, kEmbedChar, 4, 5 ] ]);
|
||||
|
||||
testTextAtOffset([ "li6" ], BOUNDARY_LINE_START,
|
||||
[ [ 0, 6, "1.Item", 0, 6 ] ]);
|
||||
[ [ 0, 7, "1. Item", 0, 7 ] ]);
|
||||
testTextAtOffset([ "li7" ], BOUNDARY_LINE_START,
|
||||
[ [ 0, 2, "2.", 0, 2 ] ]);
|
||||
[ [ 0, 3, "2. ", 0, 3 ] ]);
|
||||
testTextAtOffset([ "li8" ], BOUNDARY_LINE_START,
|
||||
[ [ 0, 8, "3.a long ", 0, 9 ],
|
||||
[ 9, 12, "and ", 9, 13 ] ]);
|
||||
[ [ 0, 9, "3. a long ", 0, 10 ],
|
||||
[ 10, 13, "and ", 10, 14 ] ]);
|
||||
testTextAtOffset([ "li9" ], BOUNDARY_LINE_START,
|
||||
[ [ 0, 7, "4.a " + kEmbedChar + " c", 0, 7 ] ]);
|
||||
[ [ 0, 8, "4. a " + kEmbedChar + " c", 0, 8 ] ]);
|
||||
testTextAtOffset([ "li10" ], BOUNDARY_LINE_START,
|
||||
[ [ 0, 2, "5.\n", 0, 3 ],
|
||||
[ 3, 7, "hello", 3, 8 ] ]);
|
||||
[ [ 0, 3, "5. \n", 0, 4 ],
|
||||
[ 4, 8, "hello", 4, 9 ] ]);
|
||||
testTextAtOffset([ "ol1" ], BOUNDARY_LINE_START,
|
||||
[ [ 0, 0, kEmbedChar, 0, 1 ],
|
||||
[ 1, 1, kEmbedChar, 1, 2 ],
|
||||
|
@ -538,9 +538,9 @@
|
||||
var attrs = {
|
||||
"auto-generated": "true"
|
||||
};
|
||||
testTextAttrs(ID, 0, attrs, defAttrs, 0, 2);
|
||||
testTextAttrs(ID, 2, { }, defAttrs, 2, 6);
|
||||
testTextAttrs(ID, 6, attrs, defAttrs, 6, 7);
|
||||
testTextAttrs(ID, 0, attrs, defAttrs, 0, 3);
|
||||
testTextAttrs(ID, 3, { }, defAttrs, 3, 7);
|
||||
testTextAttrs(ID, 7, attrs, defAttrs, 7, 8);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// area19, "HTML5 mark tag" test
|
||||
|
@ -22,8 +22,10 @@ DEFINES += -DMOZ_CHILD_PROCESS_NAME=$(MOZ_CHILD_PROCESS_NAME)
|
||||
|
||||
# Set MSVC dlls version to package, if any.
|
||||
ifdef WIN32_REDIST_DIR
|
||||
ifdef MOZ_NO_DEBUG_RTL
|
||||
DEFINES += -DMOZ_MSVC_REDIST=$(_MSC_VER)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef ENABLE_MARIONETTE
|
||||
DEFINES += -DENABLE_MARIONETTE=1
|
||||
|
@ -69,7 +69,6 @@
|
||||
@BINPATH@/@MOZ_CHILD_PROCESS_NAME@
|
||||
#endif
|
||||
#ifdef XP_WIN32
|
||||
#ifndef MOZ_DEBUG
|
||||
#if MOZ_MSVC_REDIST == 1600
|
||||
@BINPATH@/msvcp100.dll
|
||||
@BINPATH@/msvcr100.dll
|
||||
@ -81,7 +80,6 @@
|
||||
@BINPATH@/msvcr120.dll
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#ifdef MOZ_SHARED_MOZGLUE
|
||||
@BINPATH@/@DLL_PREFIX@mozglue@DLL_SUFFIX@
|
||||
#endif
|
||||
@ -808,7 +806,7 @@ bin/components/@DLL_PREFIX@nkgnomevfs@DLL_SUFFIX@
|
||||
#endif
|
||||
|
||||
@BINPATH@/components/DataStore.manifest
|
||||
@BINPATH@/components/DataStoreService.js
|
||||
@BINPATH@/components/DataStoreImpl.js
|
||||
@BINPATH@/components/dom_datastore.xpt
|
||||
|
||||
#ifdef MOZ_WEBSPEECH
|
||||
|
@ -1,4 +1,5 @@
|
||||
ac_add_options --enable-debug
|
||||
ac_add_options --enable-dmd
|
||||
ac_add_options --enable-signmar
|
||||
|
||||
ac_add_options --disable-unified-compilation
|
||||
|
@ -1,4 +1,5 @@
|
||||
ac_add_options --enable-debug
|
||||
ac_add_options --enable-dmd
|
||||
ac_add_options --enable-signmar
|
||||
|
||||
. $topsrcdir/build/unix/mozconfig.linux
|
||||
|
@ -1,6 +1,7 @@
|
||||
. $topsrcdir/build/macosx/mozconfig.common
|
||||
|
||||
ac_add_options --enable-debug
|
||||
ac_add_options --enable-dmd
|
||||
ac_add_options --enable-accessibility
|
||||
ac_add_options --enable-signmar
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
. "$topsrcdir/browser/config/mozconfigs/common"
|
||||
|
||||
ac_add_options --enable-debug
|
||||
ac_add_options --enable-dmd
|
||||
ac_add_options --enable-profiling # needed for --enable-dmd to work on Windows
|
||||
ac_add_options --enable-signmar
|
||||
ac_add_options --enable-require-all-d3dc-versions
|
||||
|
||||
|
@ -4,6 +4,8 @@ ac_add_options --target=x86_64-pc-mingw32
|
||||
ac_add_options --host=x86_64-pc-mingw32
|
||||
|
||||
ac_add_options --enable-debug
|
||||
ac_add_options --enable-dmd
|
||||
ac_add_options --enable-profiling # needed for --enable-dmd to work on Windows
|
||||
ac_add_options --enable-signmar
|
||||
|
||||
# Needed to enable breakpad in application.ini
|
||||
|
@ -7,4 +7,4 @@ PREF_JS_EXPORTS = $(srcdir)/webide-prefs.js
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
libs::
|
||||
$(NSINSTALL) $(srcdir)/modules/*.js $(FINAL_TARGET)/modules/devtools
|
||||
$(NSINSTALL) $(srcdir)/modules/*.js $(FINAL_TARGET)/modules/devtools/webide
|
||||
|
@ -8,7 +8,7 @@ const {Services} = Cu.import("resource://gre/modules/Services.jsm");
|
||||
const {require} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}).devtools;
|
||||
const {AppProjects} = require("devtools/app-manager/app-projects");
|
||||
const {AppValidator} = require("devtools/app-manager/app-validator");
|
||||
const {AppManager} = require("devtools/app-manager");
|
||||
const {AppManager} = require("devtools/webide/app-manager");
|
||||
|
||||
window.addEventListener("load", function onLoad() {
|
||||
window.removeEventListener("load", onLoad);
|
||||
|
@ -16,7 +16,7 @@ const {require} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}).de
|
||||
const {FileUtils} = Cu.import("resource://gre/modules/FileUtils.jsm");
|
||||
const {AppProjects} = require("devtools/app-manager/app-projects");
|
||||
const APP_CREATOR_LIST = "devtools.webide.templatesURL";
|
||||
const {AppManager} = require("devtools/app-manager");
|
||||
const {AppManager} = require("devtools/webide/app-manager");
|
||||
|
||||
let gTemplateList = null;
|
||||
|
||||
|
@ -15,7 +15,7 @@ const {require} = devtools;
|
||||
const {Services} = Cu.import("resource://gre/modules/Services.jsm");
|
||||
const {AppProjects} = require("devtools/app-manager/app-projects");
|
||||
const {Connection} = require("devtools/client/connection-manager");
|
||||
const {AppManager} = require("devtools/app-manager");
|
||||
const {AppManager} = require("devtools/webide/app-manager");
|
||||
const {Promise: promise} = Cu.import("resource://gre/modules/Promise.jsm", {});
|
||||
const ProjectEditor = require("projecteditor/projecteditor");
|
||||
|
||||
@ -210,37 +210,28 @@ let UI = {
|
||||
updateRuntimeList: function() {
|
||||
let USBListNode = document.querySelector("#runtime-panel-usbruntime");
|
||||
let simulatorListNode = document.querySelector("#runtime-panel-simulators");
|
||||
while (USBListNode.hasChildNodes()) {
|
||||
USBListNode.firstChild.remove();
|
||||
}
|
||||
let customListNode = document.querySelector("#runtime-panel-custom");
|
||||
|
||||
for (let runtime of AppManager.runtimeList.usb) {
|
||||
let panelItemNode = document.createElement("toolbarbutton");
|
||||
panelItemNode.className = "panel-item runtime-panel-item-usbruntime";
|
||||
panelItemNode.setAttribute("label", runtime.getName());
|
||||
USBListNode.appendChild(panelItemNode);
|
||||
let r = runtime;
|
||||
panelItemNode.addEventListener("click", () => {
|
||||
this.hidePanels();
|
||||
this.connectToRuntime(r);
|
||||
}, true);
|
||||
for (let [type, parent] of [
|
||||
["usb", USBListNode],
|
||||
["simulator", simulatorListNode],
|
||||
["custom", customListNode],
|
||||
]) {
|
||||
while (parent.hasChildNodes()) {
|
||||
parent.firstChild.remove();
|
||||
}
|
||||
for (let runtime of AppManager.runtimeList[type]) {
|
||||
let panelItemNode = document.createElement("toolbarbutton");
|
||||
panelItemNode.className = "panel-item runtime-panel-item-" + type;
|
||||
panelItemNode.setAttribute("label", runtime.getName());
|
||||
parent.appendChild(panelItemNode);
|
||||
let r = runtime;
|
||||
panelItemNode.addEventListener("click", () => {
|
||||
this.hidePanels();
|
||||
this.connectToRuntime(r);
|
||||
}, true);
|
||||
}
|
||||
}
|
||||
|
||||
while (simulatorListNode.hasChildNodes()) {
|
||||
simulatorListNode.firstChild.remove();
|
||||
}
|
||||
for (let runtime of AppManager.runtimeList.simulator) {
|
||||
let panelItemNode = document.createElement("toolbarbutton");
|
||||
panelItemNode.className = "panel-item runtime-panel-item-simulator";
|
||||
panelItemNode.setAttribute("label", runtime.getName());
|
||||
simulatorListNode.appendChild(panelItemNode);
|
||||
let r = runtime;
|
||||
panelItemNode.addEventListener("click", () => {
|
||||
this.hidePanels();
|
||||
this.connectToRuntime(r);
|
||||
}, true);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
connectToRuntime: function(runtime) {
|
||||
|
@ -139,6 +139,8 @@
|
||||
<vbox id="runtime-panel-usbruntime"></vbox>
|
||||
<label class="panel-header">&runtimePanel_simulators;</label>
|
||||
<vbox id="runtime-panel-simulators"></vbox>
|
||||
<label class="panel-header">&runtimePanel_custom;</label>
|
||||
<vbox id="runtime-panel-custom"></vbox>
|
||||
<vbox flex="1" id="runtime-actions" hidden="true">
|
||||
<toolbarbutton class="panel-item" id="runtime-details" command="cmd_showRuntimeDetails"/>
|
||||
<toolbarbutton class="panel-item" id="runtime-permissions" command="cmd_showPermissionsTable"/>
|
||||
|
@ -60,6 +60,7 @@
|
||||
<!ENTITY projectPanel_runtimeApps "Runtime Apps">
|
||||
<!ENTITY runtimePanel_USBDevices "USB Devices">
|
||||
<!ENTITY runtimePanel_simulators "Simulators">
|
||||
<!ENTITY runtimePanel_custom "Custom">
|
||||
|
||||
<!-- Lense -->
|
||||
<!ENTITY details_valid_header "valid">
|
||||
|
@ -8,6 +8,11 @@ title_app=Firefox App Manager: %S
|
||||
runtimeButton_label=Select Runtime
|
||||
projectButton_label=Open App
|
||||
|
||||
local_runtime=Local Runtime
|
||||
remote_runtime=Remote Runtime
|
||||
remote_runtime_promptTitle=Remote Runtime
|
||||
remote_runtime_promptMessage=hostname:port
|
||||
|
||||
importPackagedApp_title=Select directory
|
||||
importHostedApp_title=Open Hosted App
|
||||
importHostedApp_header=Enter Manifest URL
|
||||
|
@ -20,6 +20,7 @@ const AppActorFront = require("devtools/app-actor-front");
|
||||
const {getDeviceFront} = require("devtools/server/actors/device");
|
||||
const {setTimeout} = require("sdk/timers");
|
||||
const {Task} = Cu.import("resource://gre/modules/Task.jsm", {});
|
||||
const {USBRuntime, SimulatorRuntime, gLocalRuntime, gRemoteRuntime} = require("devtools/webide/runtimes");
|
||||
|
||||
const Strings = Services.strings.createBundle("chrome://webide/content/webide.properties");
|
||||
|
||||
@ -41,7 +42,10 @@ exports.AppManager = AppManager = {
|
||||
this.webAppsStore = new WebappsStore(this.connection);
|
||||
this.webAppsStore.on("store-ready", this.onWebAppsStoreready);
|
||||
|
||||
this.runtimeList = {usb: [], simulator: []};
|
||||
this.runtimeList = {usb: [], simulator: [], custom: [gRemoteRuntime]};
|
||||
if (Services.prefs.getBoolPref("devtools.webide.enableLocalRuntime")) {
|
||||
this.runtimeList.custom.push(gLocalRuntime);
|
||||
}
|
||||
this.trackUSBRuntimes();
|
||||
this.trackSimulatorRuntimes();
|
||||
},
|
||||
@ -276,9 +280,14 @@ exports.AppManager = AppManager = {
|
||||
}
|
||||
this.connection.on(Connection.Events.CONNECTED, onConnectedOrDisconnected);
|
||||
this.connection.on(Connection.Events.DISCONNECTED, onConnectedOrDisconnected);
|
||||
this.selectedRuntime.connect(this.connection).then(
|
||||
() => {},
|
||||
() => {deferred.reject()});
|
||||
try {
|
||||
this.selectedRuntime.connect(this.connection).then(
|
||||
() => {},
|
||||
() => {deferred.reject()});
|
||||
} catch(e) {
|
||||
console.error(e);
|
||||
deferred.reject();
|
||||
}
|
||||
|
||||
return deferred.promise;
|
||||
},
|
||||
@ -537,56 +546,3 @@ exports.AppManager = AppManager = {
|
||||
}
|
||||
|
||||
EventEmitter.decorate(AppManager);
|
||||
|
||||
/* RUNTIMES */
|
||||
|
||||
function USBRuntime(id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
USBRuntime.prototype = {
|
||||
connect: function(connection) {
|
||||
let device = Devices.getByName(this.id);
|
||||
if (!device) {
|
||||
console.error("Can't find device: " + id);
|
||||
return promise.reject();
|
||||
}
|
||||
return device.connect().then((port) => {
|
||||
connection.host = "localhost";
|
||||
connection.port = port;
|
||||
connection.connect();
|
||||
});
|
||||
},
|
||||
getID: function() {
|
||||
return this.id;
|
||||
},
|
||||
getName: function() {
|
||||
return this.id;
|
||||
},
|
||||
}
|
||||
|
||||
function SimulatorRuntime(version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
SimulatorRuntime.prototype = {
|
||||
connect: function(connection) {
|
||||
let port = ConnectionManager.getFreeTCPPort();
|
||||
let simulator = Simulator.getByVersion(this.version);
|
||||
if (!simulator || !simulator.launch) {
|
||||
console.error("Can't find simulator: " + this.version);
|
||||
return promise.reject();
|
||||
}
|
||||
return simulator.launch({port: port}).then(() => {
|
||||
connection.port = port;
|
||||
connection.keepConnecting = true;
|
||||
connection.connect();
|
||||
});
|
||||
},
|
||||
getID: function() {
|
||||
return this.version;
|
||||
},
|
||||
getName: function() {
|
||||
return this.version;
|
||||
},
|
||||
}
|
||||
|
108
browser/devtools/webide/modules/runtimes.js
Normal file
108
browser/devtools/webide/modules/runtimes.js
Normal file
@ -0,0 +1,108 @@
|
||||
/* 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/. */
|
||||
|
||||
const {Cu} = require("chrome");
|
||||
const {Devices} = Cu.import("resource://gre/modules/devtools/Devices.jsm");
|
||||
const {Services} = Cu.import("resource://gre/modules/Services.jsm");
|
||||
const {Simulator} = Cu.import("resource://gre/modules/devtools/Simulator.jsm");
|
||||
const {ConnectionManager, Connection} = require("devtools/client/connection-manager");
|
||||
const {DebuggerServer} = require("resource://gre/modules/devtools/dbg-server.jsm");
|
||||
|
||||
const Strings = Services.strings.createBundle("chrome://webide/content/webide.properties");
|
||||
|
||||
function USBRuntime(id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
USBRuntime.prototype = {
|
||||
connect: function(connection) {
|
||||
let device = Devices.getByName(this.id);
|
||||
if (!device) {
|
||||
return promise.reject("Can't find device: " + id);
|
||||
}
|
||||
return device.connect().then((port) => {
|
||||
connection.host = "localhost";
|
||||
connection.port = port;
|
||||
connection.connect();
|
||||
});
|
||||
},
|
||||
getID: function() {
|
||||
return this.id;
|
||||
},
|
||||
getName: function() {
|
||||
return this.id;
|
||||
},
|
||||
}
|
||||
|
||||
function SimulatorRuntime(version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
SimulatorRuntime.prototype = {
|
||||
connect: function(connection) {
|
||||
let port = ConnectionManager.getFreeTCPPort();
|
||||
let simulator = Simulator.getByVersion(this.version);
|
||||
if (!simulator || !simulator.launch) {
|
||||
return promise.reject("Can't find simulator: " + this.version);
|
||||
}
|
||||
return simulator.launch({port: port}).then(() => {
|
||||
connection.port = port;
|
||||
connection.keepConnecting = true;
|
||||
connection.connect();
|
||||
});
|
||||
},
|
||||
getID: function() {
|
||||
return this.version;
|
||||
},
|
||||
getName: function() {
|
||||
return this.version;
|
||||
},
|
||||
}
|
||||
|
||||
let gLocalRuntime = {
|
||||
supportApps: false, // Temporary static value
|
||||
connect: function(connection) {
|
||||
if (!DebuggerServer.initialized) {
|
||||
DebuggerServer.init();
|
||||
DebuggerServer.addBrowserActors();
|
||||
}
|
||||
connection.port = null;
|
||||
connection.host = null; // Force Pipe transport
|
||||
connection.connect();
|
||||
return promise.resolve();
|
||||
},
|
||||
getName: function() {
|
||||
return Strings.GetStringFromName("local_runtime");
|
||||
},
|
||||
}
|
||||
|
||||
let gRemoteRuntime = {
|
||||
connect: function(connection) {
|
||||
let win = Services.wm.getMostRecentWindow("devtools:webide");
|
||||
if (!win) {
|
||||
return promise.reject();
|
||||
}
|
||||
let ret = {value: connection.host + ":" + connection.port};
|
||||
Services.prompt.prompt(win,
|
||||
Strings.GetStringFromName("remote_runtime_promptTitle"),
|
||||
Strings.GetStringFromName("remote_runtime_promptMessage"),
|
||||
ret, null, {});
|
||||
let [host,port] = ret.value.split(":");
|
||||
if (!host || !port) {
|
||||
return promise.reject();
|
||||
}
|
||||
connection.host = host;
|
||||
connection.port = port;
|
||||
connection.connect();
|
||||
return promise.resolve();
|
||||
},
|
||||
getName: function() {
|
||||
return Strings.GetStringFromName("remote_runtime");
|
||||
},
|
||||
}
|
||||
|
||||
exports.USBRuntime = USBRuntime;
|
||||
exports.SimulatorRuntime = SimulatorRuntime;
|
||||
exports.gRemoteRuntime = gRemoteRuntime;
|
||||
exports.gLocalRuntime = gLocalRuntime;
|
@ -17,9 +17,11 @@ const {AppProjects} = require("devtools/app-manager/app-projects");
|
||||
const TEST_BASE = "chrome://mochitests/content/chrome/browser/devtools/webide/test/";
|
||||
|
||||
Services.prefs.setBoolPref("devtools.webide.enabled", true);
|
||||
Services.prefs.setBoolPref("devtools.webide.enableLocalRuntime", true);
|
||||
|
||||
SimpleTest.registerCleanupFunction(() => {
|
||||
Services.prefs.clearUserPref("devtools.webide.enabled");
|
||||
Services.prefs.clearUserPref("devtools.webide.enableLocalRuntime");
|
||||
});
|
||||
|
||||
function openWebIDE() {
|
||||
|
@ -60,7 +60,7 @@
|
||||
is(json.name, "xxx", "manifest written on disc");
|
||||
|
||||
// Make the manifest invalid on disk
|
||||
delete json.name
|
||||
delete json.name;
|
||||
let Encoder = new TextEncoder();
|
||||
data = Encoder.encode(JSON.stringify(json));
|
||||
yield OS.File.writeAtomic(manifestPath, data , {tmpPath: manifestPath + ".tmp"});
|
||||
|
@ -55,7 +55,7 @@
|
||||
yield win.Cmds.showRuntimePanel();
|
||||
|
||||
let panelNode = win.document.querySelector("#runtime-panel");
|
||||
let items = panelNode.querySelectorAll(".runtime-panel-item-usbruntime");
|
||||
let items = panelNode.querySelectorAll(".runtime-panel-item-usb");
|
||||
is(items.length, 1, "Found one runtime button");
|
||||
|
||||
let deferred = promise.defer();
|
||||
@ -67,6 +67,8 @@
|
||||
|
||||
yield deferred.promise;
|
||||
|
||||
is(Object.keys(DebuggerServer._connections).length, 1, "Connected");
|
||||
|
||||
yield nextTick();
|
||||
|
||||
ok(!isPlayActive(), "play button is disabled 2");
|
||||
@ -97,11 +99,24 @@
|
||||
|
||||
yield win.Cmds.disconnectRuntime();
|
||||
|
||||
is(Object.keys(DebuggerServer._connections).length, 0, "Disconnected");
|
||||
|
||||
ok(win.AppManager.selectedProject, "A project is still selected");
|
||||
ok(!isPlayActive(), "play button is disabled 6");
|
||||
ok(!isStopActive(), "stop button is disabled 6");
|
||||
|
||||
deferred = promise.defer();
|
||||
win.AppManager.connection.once(
|
||||
win.Connection.Events.CONNECTED,
|
||||
() => deferred.resolve());
|
||||
|
||||
win.document.querySelectorAll(".runtime-panel-item-custom")[1].click();
|
||||
|
||||
yield deferred.promise;
|
||||
|
||||
is(Object.keys(DebuggerServer._connections).length, 1, "Locally connected");
|
||||
|
||||
yield win.Cmds.disconnectRuntime();
|
||||
|
||||
yield closeWebIDE(win);
|
||||
|
||||
|
@ -173,20 +173,22 @@ panel > .panel-arrowcontainer > .panel-arrowcontent {
|
||||
padding: 12px 0 0;
|
||||
}
|
||||
|
||||
#runtime-panel-simulators {
|
||||
#runtime-panel-custom {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
#runtime-permissions,
|
||||
#runtime-screenshot,
|
||||
.runtime-panel-item-usbruntime,
|
||||
.runtime-panel-item-usb,
|
||||
.runtime-panel-item-custom,
|
||||
.runtime-panel-item-simulator {
|
||||
list-style-image: url("icons.png");
|
||||
}
|
||||
|
||||
#runtime-screenshot { -moz-image-region: rect(200px, 640px, 240px, 600px) }
|
||||
#runtime-permissions { -moz-image-region: rect(100px, 840px, 140px, 800px) }
|
||||
.runtime-panel-item-usbruntime { -moz-image-region: rect(100px, 640px, 140px, 600px) }
|
||||
.runtime-panel-item-usb { -moz-image-region: rect(100px, 640px, 140px, 600px) }
|
||||
.runtime-panel-item-custom { -moz-image-region: rect(100px, 640px, 140px, 600px) }
|
||||
.runtime-panel-item-simulator { -moz-image-region: rect(100px, 740px, 140px, 700px) }
|
||||
|
||||
#runtime-actions {
|
||||
@ -203,7 +205,7 @@ panel > .panel-arrowcontainer > .panel-arrowcontent {
|
||||
}
|
||||
|
||||
#runtime-actions > toolbarbutton:hover {
|
||||
background-color: rgba(221,221,221,1);
|
||||
background-color: #CBF0FE;
|
||||
}
|
||||
|
||||
#runtime-actions > toolbarbutton:last-child {
|
||||
|
@ -6,3 +6,4 @@
|
||||
pref("devtools.webide.showProjectEditor", true);
|
||||
pref("devtools.webide.templatesURL", "http://fixme/");
|
||||
pref("devtools.webide.lastprojectlocation", "");
|
||||
pref("devtools.webide.enableLocalRuntime", false);
|
||||
|
@ -72,8 +72,10 @@ DEFINES += -DMOZ_CHILD_PROCESS_NAME=$(MOZ_CHILD_PROCESS_NAME)
|
||||
|
||||
# Set MSVC dlls version to package, if any.
|
||||
ifdef WIN32_REDIST_DIR
|
||||
ifdef MOZ_NO_DEBUG_RTL
|
||||
DEFINES += -DMOZ_MSVC_REDIST=$(_MSC_VER)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq (,$(filter WINNT Darwin Android,$(OS_TARGET)))
|
||||
DEFINES += -DMOZ_SHARED_MOZGLUE=1
|
||||
@ -136,6 +138,7 @@ endif
|
||||
ifdef MOZ_JEMALLOC3
|
||||
DEFINES += -DMOZ_JEMALLOC3
|
||||
endif
|
||||
DEFINES += -DMOZ_ICU_DBG_SUFFIX=$(MOZ_ICU_DBG_SUFFIX)
|
||||
|
||||
libs::
|
||||
$(MAKE) -C $(DEPTH)/browser/locales langpack
|
||||
|
@ -85,7 +85,6 @@
|
||||
#endif
|
||||
#ifdef XP_WIN32
|
||||
@BINPATH@/plugin-hang-ui@BIN_SUFFIX@
|
||||
#ifndef MOZ_DEBUG
|
||||
#if MOZ_MSVC_REDIST == 1600
|
||||
@BINPATH@/msvcp100.dll
|
||||
@BINPATH@/msvcr100.dll
|
||||
@ -97,19 +96,12 @@
|
||||
@BINPATH@/msvcr120.dll
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#ifndef MOZ_NATIVE_ICU
|
||||
#ifdef MOZ_SHARED_ICU
|
||||
#ifdef XP_WIN
|
||||
#ifdef MOZ_DEBUG
|
||||
@BINPATH@/icudtd@MOZ_ICU_VERSION@.dll
|
||||
@BINPATH@/icuind@MOZ_ICU_VERSION@.dll
|
||||
@BINPATH@/icuucd@MOZ_ICU_VERSION@.dll
|
||||
#else
|
||||
@BINPATH@/icudt@MOZ_ICU_VERSION@.dll
|
||||
@BINPATH@/icuin@MOZ_ICU_VERSION@.dll
|
||||
@BINPATH@/icuuc@MOZ_ICU_VERSION@.dll
|
||||
#endif
|
||||
@BINPATH@/icudt@MOZ_ICU_DBG_SUFFIX@@MOZ_ICU_VERSION@.dll
|
||||
@BINPATH@/icuin@MOZ_ICU_DBG_SUFFIX@@MOZ_ICU_VERSION@.dll
|
||||
@BINPATH@/icuuc@MOZ_ICU_DBG_SUFFIX@@MOZ_ICU_VERSION@.dll
|
||||
#elif defined(XP_MACOSX)
|
||||
@BINPATH@/libicudata.@MOZ_ICU_VERSION@.dylib
|
||||
@BINPATH@/libicui18n.@MOZ_ICU_VERSION@.dylib
|
||||
@ -861,7 +853,7 @@ bin/libfreebl_32int64_3.so
|
||||
#endif
|
||||
|
||||
@BINPATH@/components/DataStore.manifest
|
||||
@BINPATH@/components/DataStoreService.js
|
||||
@BINPATH@/components/DataStoreImpl.js
|
||||
@BINPATH@/components/dom_datastore.xpt
|
||||
|
||||
|
||||
|
@ -122,7 +122,13 @@ MOZ_ARG_ENABLE_STRING(debug,
|
||||
fi ],
|
||||
MOZ_DEBUG=)
|
||||
|
||||
MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG -DTRACING"
|
||||
if test -z "$MOZ_DEBUG"; then
|
||||
MOZ_NO_DEBUG_RTL=1
|
||||
fi
|
||||
|
||||
AC_SUBST(MOZ_NO_DEBUG_RTL)
|
||||
|
||||
MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -DTRACING"
|
||||
MOZ_ARG_WITH_STRING(debug-label,
|
||||
[ --with-debug-label=LABELS
|
||||
Define DEBUG_<value> for each comma-separated
|
||||
|
@ -48,17 +48,21 @@ if test -z "$BUILDING_JS" -o -n "$JS_STANDALONE"; then
|
||||
CFLAGS=
|
||||
ac_configure_args="$ac_configure_args LD=link CPP=\"cl -nologo -EP\" \
|
||||
CXXCPP=\"cl -nologo -EP\" SHELL=sh.exe"
|
||||
rtl=
|
||||
if test -z "$MOZ_NO_DEBUG_RTL" -a -n "$MOZ_DEBUG"; then
|
||||
rtl=" -DUSE_DEBUG_RTL"
|
||||
fi
|
||||
case "${target_cpu}" in
|
||||
x86_64)
|
||||
# Need target since MSYS tools into mozilla-build may be 32bit
|
||||
ac_configure_args="$ac_configure_args \
|
||||
CC=\"$_topsrcdir/js/src/ctypes/libffi/msvcc.sh -m64\" \
|
||||
CXX=\"$_topsrcdir/js/src/ctypes/libffi/msvcc.sh -m64\""
|
||||
CC=\"$_topsrcdir/js/src/ctypes/libffi/msvcc.sh -m64$rtl\" \
|
||||
CXX=\"$_topsrcdir/js/src/ctypes/libffi/msvcc.sh -m64$rtl\""
|
||||
;;
|
||||
*)
|
||||
ac_configure_args="$ac_configure_args \
|
||||
CC=$_topsrcdir/js/src/ctypes/libffi/msvcc.sh \
|
||||
CXX=$_topsrcdir/js/src/ctypes/libffi/msvcc.sh"
|
||||
CC=\"$_topsrcdir/js/src/ctypes/libffi/msvcc.sh$rtl\" \
|
||||
CXX=\"$_topsrcdir/js/src/ctypes/libffi/msvcc.sh$rtl\""
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
@ -85,11 +85,11 @@ if test -n "$ENABLE_INTL_API"; then
|
||||
WINNT)
|
||||
ICU_LIB_NAMES="icuin icuuc icudt"
|
||||
if test -n "$MOZ_SHARED_ICU"; then
|
||||
DBG_SUFFIX=
|
||||
if test -n "$MOZ_DEBUG"; then
|
||||
DBG_SUFFIX=d
|
||||
MOZ_ICU_DBG_SUFFIX=
|
||||
if test -n "$MOZ_DEBUG" -a -z "$MOZ_NO_DEBUG_RTL"; then
|
||||
MOZ_ICU_DBG_SUFFIX=d
|
||||
fi
|
||||
MOZ_ICU_LIBS='$(foreach lib,$(ICU_LIB_NAMES),$(DEPTH)/intl/icu/target/lib/$(LIB_PREFIX)$(lib)$(DBG_SUFFIX).$(LIB_SUFFIX))'
|
||||
MOZ_ICU_LIBS='$(foreach lib,$(ICU_LIB_NAMES),$(DEPTH)/intl/icu/target/lib/$(LIB_PREFIX)$(lib)$(MOZ_ICU_DBG_SUFFIX).$(LIB_SUFFIX))'
|
||||
fi
|
||||
;;
|
||||
Darwin)
|
||||
@ -113,7 +113,7 @@ if test -n "$ENABLE_INTL_API"; then
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_SUBST(DBG_SUFFIX)
|
||||
AC_SUBST(MOZ_ICU_DBG_SUFFIX)
|
||||
AC_SUBST(ENABLE_INTL_API)
|
||||
AC_SUBST(ICU_LIB_NAMES)
|
||||
AC_SUBST(MOZ_ICU_LIBS)
|
||||
@ -259,7 +259,7 @@ if test -z "$BUILDING_JS" -o -n "$JS_STANDALONE"; then
|
||||
# But, not debug build.
|
||||
ICU_CFLAGS="$ICU_CFLAGS -UDEBUG -DNDEBUG"
|
||||
ICU_CXXFLAGS="$ICU_CXXFLAGS -UDEBUG -DNDEBUG"
|
||||
else
|
||||
elif test -z "$MOZ_NO_DEBUG_RTL"; then
|
||||
ICU_BUILD_OPTS="$ICU_BUILD_OPTS --enable-debug"
|
||||
fi
|
||||
fi
|
||||
@ -284,7 +284,7 @@ if test -z "$BUILDING_JS" -o -n "$JS_STANDALONE"; then
|
||||
fi
|
||||
|
||||
# Add RTL flags for MSVCRT.DLL
|
||||
if test -n "$MOZ_DEBUG"; then
|
||||
if test -n "$MOZ_DEBUG" -a -z "$MOZ_NO_DEBUG_RTL"; then
|
||||
ICU_CFLAGS="$ICU_CFLAGS -MDd"
|
||||
ICU_CXXFLAGS="$ICU_CXXFLAGS -MDd"
|
||||
else
|
||||
|
@ -27,6 +27,8 @@ gyp_vars = {
|
||||
'build_libyuv': 0,
|
||||
'libyuv_dir': '/media/libyuv',
|
||||
'yuv_disable_avx2': 0 if CONFIG['HAVE_X86_AVX2'] else 1,
|
||||
# don't use openssl
|
||||
'use_openssl': 0,
|
||||
|
||||
# saves 4MB when webrtc_trace is off
|
||||
'enable_lazy_trace_alloc': 1,
|
||||
|
@ -7,7 +7,6 @@ MOZ_GLUE_LDFLAGS =
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
ifdef WIN32_REDIST_DIR
|
||||
ifndef MOZ_DEBUG
|
||||
|
||||
ifeq (1600,$(_MSC_VER))
|
||||
REDIST_FILES = \
|
||||
@ -39,7 +38,6 @@ libs:: $(libs-preqs)
|
||||
install --preserve-timestamps $(foreach f,$(REDIST_FILES),'$(WIN32_REDIST_DIR)'/$(f)) $(FINAL_TARGET)
|
||||
endif
|
||||
|
||||
endif # ! MOZ_DEBUG
|
||||
endif # WIN32_REDIST_DIR
|
||||
|
||||
# run the binscope tool to make sure the binary and all libraries
|
||||
|
@ -154,22 +154,6 @@ private:
|
||||
static JSRuntime *sRuntime;
|
||||
};
|
||||
|
||||
#define NS_SECURITYNAMESET_CID \
|
||||
{ 0x7c02eadc, 0x76, 0x4d03, \
|
||||
{ 0x99, 0x8d, 0x80, 0xd7, 0x79, 0xc4, 0x85, 0x89 } }
|
||||
#define NS_SECURITYNAMESET_CONTRACTID "@mozilla.org/security/script/nameset;1"
|
||||
|
||||
class nsSecurityNameSet : public nsIScriptExternalNameSet
|
||||
{
|
||||
public:
|
||||
nsSecurityNameSet();
|
||||
virtual ~nsSecurityNameSet();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD InitializeNameSet(nsIScriptContext* aScriptContext);
|
||||
};
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
void
|
||||
|
@ -11,7 +11,6 @@ UNIFIED_SOURCES += [
|
||||
'nsNullPrincipalURI.cpp',
|
||||
'nsPrincipal.cpp',
|
||||
'nsScriptSecurityManager.cpp',
|
||||
'nsSecurityManagerFactory.cpp',
|
||||
'nsSystemPrincipal.cpp',
|
||||
]
|
||||
|
||||
|
@ -1,127 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
/*Factory for internal browser security resource managers*/
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsScriptSecurityManager.h"
|
||||
#include "nsIPrincipal.h"
|
||||
#include "nsPrincipal.h"
|
||||
#include "nsSystemPrincipal.h"
|
||||
#include "nsNullPrincipal.h"
|
||||
#include "nsIScriptNameSpaceManager.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsICategoryManager.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsString.h"
|
||||
#include "nsNetCID.h"
|
||||
#include "nsIClassInfoImpl.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "jsfriendapi.h"
|
||||
#include "xpcprivate.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
///////////////////////
|
||||
// nsSecurityNameSet //
|
||||
///////////////////////
|
||||
|
||||
nsSecurityNameSet::nsSecurityNameSet()
|
||||
{
|
||||
}
|
||||
|
||||
nsSecurityNameSet::~nsSecurityNameSet()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsSecurityNameSet, nsIScriptExternalNameSet)
|
||||
|
||||
static bool
|
||||
netscape_security_enablePrivilege(JSContext *cx, unsigned argc, JS::Value *vp)
|
||||
{
|
||||
Telemetry::Accumulate(Telemetry::ENABLE_PRIVILEGE_EVER_CALLED, true);
|
||||
return xpc::EnableUniversalXPConnect(cx);
|
||||
}
|
||||
|
||||
static const JSFunctionSpec PrivilegeManager_static_methods[] = {
|
||||
JS_FS("enablePrivilege", netscape_security_enablePrivilege, 1, 0),
|
||||
JS_FS_END
|
||||
};
|
||||
|
||||
/*
|
||||
* "Steal" calls to netscape.security.PrivilegeManager.enablePrivilege,
|
||||
* et al. so that code that worked with 4.0 can still work.
|
||||
*/
|
||||
NS_IMETHODIMP
|
||||
nsSecurityNameSet::InitializeNameSet(nsIScriptContext* aScriptContext)
|
||||
{
|
||||
AutoJSContext cx;
|
||||
JS::Rooted<JSObject*> global(cx, aScriptContext->GetWindowProxy());
|
||||
JSAutoCompartment ac(cx, global);
|
||||
|
||||
/*
|
||||
* Find Object.prototype's class by walking up the global object's
|
||||
* prototype chain.
|
||||
*/
|
||||
JS::Rooted<JSObject*> obj(cx, global);
|
||||
JS::Rooted<JSObject*> proto(cx);
|
||||
for (;;) {
|
||||
MOZ_ALWAYS_TRUE(JS_GetPrototype(cx, obj, &proto));
|
||||
if (!proto)
|
||||
break;
|
||||
obj = proto;
|
||||
}
|
||||
const JSClass *objectClass = JS_GetClass(obj);
|
||||
|
||||
JS::Rooted<JS::Value> v(cx);
|
||||
if (!JS_GetProperty(cx, global, "netscape", &v))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
JS::Rooted<JSObject*> securityObj(cx);
|
||||
if (v.isObject()) {
|
||||
/*
|
||||
* "netscape" property of window object exists; get the
|
||||
* "security" property.
|
||||
*/
|
||||
obj = &v.toObject();
|
||||
if (!JS_GetProperty(cx, obj, "security", &v) || !v.isObject())
|
||||
return NS_ERROR_FAILURE;
|
||||
securityObj = &v.toObject();
|
||||
} else {
|
||||
/* define netscape.security object */
|
||||
obj = JS_DefineObject(cx, global, "netscape", objectClass);
|
||||
if (obj == nullptr)
|
||||
return NS_ERROR_FAILURE;
|
||||
securityObj = JS_DefineObject(cx, obj, "security", objectClass);
|
||||
if (securityObj == nullptr)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// We hide enablePrivilege behind a pref because it has been altered in a
|
||||
// way that makes it fundamentally insecure to use in production. Mozilla
|
||||
// uses this pref during automated testing to support legacy test code that
|
||||
// uses enablePrivilege. If you're not doing test automation, you _must_ not
|
||||
// flip this pref, or you will be exposing all your users to security
|
||||
// vulnerabilities.
|
||||
if (!Preferences::GetBool("security.turn_off_all_security_so_that_viruses_can_take_over_this_computer"))
|
||||
return NS_OK;
|
||||
|
||||
/* Define PrivilegeManager object with the necessary "static" methods. */
|
||||
obj = JS_DefineObject(cx, securityObj, "PrivilegeManager", objectClass);
|
||||
if (obj == nullptr)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
return JS_DefineFunctions(cx, obj, PrivilegeManager_static_methods)
|
||||
? NS_OK
|
||||
: NS_ERROR_FAILURE;
|
||||
}
|
@ -36,13 +36,13 @@
|
||||
# error "STL code can only be used with infallible ::operator new()"
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef _DEBUG
|
||||
// From
|
||||
// http://msdn.microsoft.com/en-us/library/aa985982%28VS.80%29.aspx
|
||||
// and
|
||||
// http://msdn.microsoft.com/en-us/library/aa985965%28VS.80%29.aspx
|
||||
// there appear to be two types of STL container checking. The
|
||||
// former is enabled by -D_DEBUG (which is implied by -DDEBUG), and
|
||||
// former is enabled by -D_DEBUG (which is implied by -MDd or -MTd), and
|
||||
// looks to be full generation/mutation checked iterators as done by
|
||||
// _GLIBCXX_DEBUG. The latter appears to just be bounds checking, and
|
||||
// is enabled by the following macros. It appears that the _DEBUG
|
||||
|
@ -347,7 +347,6 @@ commdlg.h
|
||||
compat.h
|
||||
condapi.h
|
||||
ConditionalMacros.h
|
||||
config.h
|
||||
conio.h
|
||||
console.h
|
||||
ControlDefinitions.h
|
||||
|
13
configure.in
13
configure.in
@ -2189,6 +2189,7 @@ ia64*-hpux*)
|
||||
dnl both SSSE3 and SSE4.1.
|
||||
HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
|
||||
HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1
|
||||
MOZ_MEMORY=1
|
||||
fi
|
||||
AC_DEFINE(HAVE_SNPRINTF)
|
||||
AC_DEFINE(_WINDOWS)
|
||||
@ -7114,16 +7115,13 @@ else
|
||||
;;
|
||||
*-mingw*)
|
||||
AC_DEFINE(MOZ_MEMORY_WINDOWS)
|
||||
if test -z "$MOZ_DEBUG"; then
|
||||
WIN32_CRT_LIBS="msvcrt.lib msvcprt.lib"
|
||||
else
|
||||
WIN32_CRT_LIBS="msvcrtd.lib msvcprtd.lib"
|
||||
fi
|
||||
export MOZ_NO_DEBUG_RTL=1
|
||||
WIN32_CRT_LIBS="msvcrt.lib msvcprt.lib"
|
||||
dnl Look for a broken crtdll.obj
|
||||
WIN32_CRTDLL_FULLPATH=`lib -nologo -list $WIN32_CRT_LIBS | grep crtdll\\.obj`
|
||||
lib -NOLOGO -OUT:crtdll.obj $WIN32_CRT_LIBS -EXTRACT:$WIN32_CRTDLL_FULLPATH
|
||||
if grep -q '__imp__\{0,1\}free' crtdll.obj; then
|
||||
MOZ_GLUE_LDFLAGS='-LIBPATH:$(DIST)/lib -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt'
|
||||
MOZ_GLUE_LDFLAGS='-LIBPATH:$(DIST)/lib -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcprt -DEFAULTLIB:mozcrt'
|
||||
dnl Also pass this to NSPR/NSS
|
||||
DLLFLAGS="$DLLFLAGS $MOZ_GLUE_LDFLAGS"
|
||||
else
|
||||
@ -9215,6 +9213,9 @@ if test -z "$MOZ_NATIVE_NSPR"; then
|
||||
ac_configure_args="$ac_configure_args --disable-debug"
|
||||
else
|
||||
ac_configure_args="$ac_configure_args --enable-debug"
|
||||
if test -n "$MOZ_NO_DEBUG_RTL"; then
|
||||
ac_configure_args="$ac_configure_args --disable-debug-rtl"
|
||||
fi
|
||||
fi
|
||||
if test "$MOZ_OPTIMIZE" = "1"; then
|
||||
ac_configure_args="$ac_configure_args --enable-optimize"
|
||||
|
@ -279,13 +279,6 @@ public:
|
||||
virtual nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute,
|
||||
int32_t aModType) const;
|
||||
|
||||
/**
|
||||
* Returns an atom holding the name of the "class" attribute on this
|
||||
* content node (if applicable). Returns null if there is no
|
||||
* "class" attribute for this type of content node.
|
||||
*/
|
||||
virtual nsIAtom *GetClassAttributeName() const;
|
||||
|
||||
inline Directionality GetDirectionality() const {
|
||||
if (HasFlag(NODE_HAS_DIRECTION_RTL)) {
|
||||
return eDir_RTL;
|
||||
@ -587,8 +580,20 @@ public:
|
||||
{
|
||||
SetAttr(kNameSpaceID_None, nsGkAtoms::id, aId, true);
|
||||
}
|
||||
void GetClassName(nsAString& aClassName)
|
||||
{
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::_class, aClassName);
|
||||
}
|
||||
void GetClassName(DOMString& aClassName)
|
||||
{
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::_class, aClassName);
|
||||
}
|
||||
void SetClassName(const nsAString& aClassName)
|
||||
{
|
||||
SetAttr(kNameSpaceID_None, nsGkAtoms::_class, aClassName, true);
|
||||
}
|
||||
|
||||
nsDOMTokenList* GetClassList();
|
||||
nsDOMTokenList* ClassList();
|
||||
nsDOMAttributeMap* Attributes()
|
||||
{
|
||||
nsDOMSlots* slots = DOMSlots();
|
||||
@ -862,8 +867,6 @@ public:
|
||||
const nsAttrValue* mValue;
|
||||
};
|
||||
|
||||
// Be careful when using this method. This does *NOT* handle
|
||||
// XUL prototypes. You may want to use GetAttrInfo.
|
||||
const nsAttrValue* GetParsedAttr(nsIAtom* aAttr) const
|
||||
{
|
||||
return mAttrsAndChildren.GetAttr(aAttr);
|
||||
@ -1128,8 +1131,7 @@ protected:
|
||||
* Add/remove this element to the documents id cache
|
||||
*/
|
||||
void AddToIdTable(nsIAtom* aId);
|
||||
void RemoveFromIdTable(); // checks HasID() and uses DoGetID()
|
||||
void RemoveFromIdTable(nsIAtom* aId);
|
||||
void RemoveFromIdTable();
|
||||
|
||||
/**
|
||||
* Functions to carry out event default actions for links of all types
|
||||
@ -1364,6 +1366,26 @@ NS_IMETHOD GetTagName(nsAString& aTagName) MOZ_FINAL \
|
||||
Element::GetTagName(aTagName); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
NS_IMETHOD GetId(nsAString& aId) MOZ_FINAL \
|
||||
{ \
|
||||
Element::GetId(aId); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
NS_IMETHOD SetId(const nsAString& aId) MOZ_FINAL \
|
||||
{ \
|
||||
Element::SetId(aId); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
NS_IMETHOD GetClassName(nsAString& aClassName) MOZ_FINAL \
|
||||
{ \
|
||||
Element::GetClassName(aClassName); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
NS_IMETHOD SetClassName(const nsAString& aClassName) MOZ_FINAL \
|
||||
{ \
|
||||
Element::SetClassName(aClassName); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
NS_IMETHOD GetClassList(nsISupports** aClassList) MOZ_FINAL \
|
||||
{ \
|
||||
Element::GetClassList(aClassList); \
|
||||
|
@ -222,7 +222,6 @@ public:
|
||||
virtual void DestroyContent() MOZ_OVERRIDE;
|
||||
virtual void SaveSubtreeState() MOZ_OVERRIDE;
|
||||
|
||||
virtual const nsAttrValue* DoGetClasses() const MOZ_OVERRIDE;
|
||||
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker) MOZ_OVERRIDE;
|
||||
|
||||
nsIHTMLCollection* Children();
|
||||
|
@ -320,13 +320,6 @@ public:
|
||||
GetBindingParent();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an atom holding the name of the attribute of type ID on
|
||||
* this content node (if applicable). Returns null for non-element
|
||||
* content nodes.
|
||||
*/
|
||||
virtual nsIAtom *GetIDAttributeName() const = 0;
|
||||
|
||||
/**
|
||||
* Set attribute values. All attribute values are assumed to have a
|
||||
* canonical string representation that can be used for these
|
||||
@ -831,8 +824,7 @@ public:
|
||||
|
||||
/**
|
||||
* Get the ID of this content node (the atom corresponding to the
|
||||
* value of the null-namespace attribute whose name is given by
|
||||
* GetIDAttributeName(). This may be null if there is no ID.
|
||||
* value of the id attribute). This may be null if there is no ID.
|
||||
*/
|
||||
nsIAtom* GetID() const {
|
||||
if (HasID()) {
|
||||
@ -843,8 +835,7 @@ public:
|
||||
|
||||
/**
|
||||
* Get the class list of this content node (this corresponds to the
|
||||
* value of the null-namespace attribute whose name is given by
|
||||
* GetClassAttributeName()). This may be null if there are no
|
||||
* value of the class attribute). This may be null if there are no
|
||||
* classes, but that's not guaranteed.
|
||||
*/
|
||||
const nsAttrValue* GetClasses() const {
|
||||
@ -957,14 +948,14 @@ protected:
|
||||
* Hook for implementing GetID. This is guaranteed to only be
|
||||
* called if HasID() is true.
|
||||
*/
|
||||
virtual nsIAtom* DoGetID() const = 0;
|
||||
nsIAtom* DoGetID() const;
|
||||
|
||||
private:
|
||||
/**
|
||||
* Hook for implementing GetClasses. This is guaranteed to only be
|
||||
* called if the NODE_MAY_HAVE_CLASS flag is set.
|
||||
*/
|
||||
virtual const nsAttrValue* DoGetClasses() const = 0;
|
||||
const nsAttrValue* DoGetClasses() const;
|
||||
|
||||
public:
|
||||
#ifdef DEBUG
|
||||
|
@ -160,22 +160,6 @@ public:
|
||||
return mInner.mExtraName;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get and set the ID attribute atom for this node.
|
||||
* See http://www.w3.org/TR/1998/REC-xml-19980210#sec-attribute-types
|
||||
* for the definition of an ID attribute.
|
||||
*
|
||||
*/
|
||||
nsIAtom* GetIDAttributeAtom() const
|
||||
{
|
||||
return mIDAttributeAtom;
|
||||
}
|
||||
|
||||
void SetIDAttributeAtom(nsIAtom* aID)
|
||||
{
|
||||
mIDAttributeAtom = aID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the owning node info manager. Only to be used inside Gecko, you can't
|
||||
* really do anything with the pointer outside Gecko anyway.
|
||||
@ -330,7 +314,6 @@ protected:
|
||||
|
||||
nsNodeInfoInner mInner;
|
||||
|
||||
nsCOMPtr<nsIAtom> mIDAttributeAtom;
|
||||
nsRefPtr<nsNodeInfoManager> mOwnerManager;
|
||||
|
||||
/*
|
||||
|
@ -32,7 +32,7 @@ class MOZ_STACK_CLASS nsViewportInfo
|
||||
mAllowZoom(aAllowZoom),
|
||||
mAllowDoubleTapZoom(aAllowDoubleTapZoom)
|
||||
{
|
||||
mSize = mozilla::gfx::RoundedToInt(mozilla::ScreenSize(aDisplaySize) / mDefaultZoom);
|
||||
mSize = mozilla::ScreenSize(aDisplaySize) / mDefaultZoom;
|
||||
mozilla::CSSToLayoutDeviceScale pixelRatio(1.0f);
|
||||
mMinZoom = pixelRatio * kViewportMinScale;
|
||||
mMaxZoom = pixelRatio * kViewportMaxScale;
|
||||
@ -42,7 +42,7 @@ class MOZ_STACK_CLASS nsViewportInfo
|
||||
nsViewportInfo(const mozilla::CSSToScreenScale& aDefaultZoom,
|
||||
const mozilla::CSSToScreenScale& aMinZoom,
|
||||
const mozilla::CSSToScreenScale& aMaxZoom,
|
||||
const mozilla::CSSIntSize& aSize,
|
||||
const mozilla::CSSSize& aSize,
|
||||
bool aAutoSize,
|
||||
bool aAllowZoom,
|
||||
bool aAllowDoubleTapZoom) :
|
||||
@ -62,7 +62,7 @@ class MOZ_STACK_CLASS nsViewportInfo
|
||||
mozilla::CSSToScreenScale GetMinZoom() { return mMinZoom; }
|
||||
mozilla::CSSToScreenScale GetMaxZoom() { return mMaxZoom; }
|
||||
|
||||
mozilla::CSSIntSize GetSize() { return mSize; }
|
||||
mozilla::CSSSize GetSize() { return mSize; }
|
||||
|
||||
bool IsAutoSizeEnabled() { return mAutoSize; }
|
||||
bool IsZoomAllowed() { return mAllowZoom; }
|
||||
@ -90,7 +90,7 @@ class MOZ_STACK_CLASS nsViewportInfo
|
||||
mozilla::CSSToScreenScale mMaxZoom;
|
||||
|
||||
// The size of the viewport, specified by the <meta name="viewport"> tag.
|
||||
mozilla::CSSIntSize mSize;
|
||||
mozilla::CSSSize mSize;
|
||||
|
||||
// Whether or not we should automatically size the viewport to the device's
|
||||
// width. This is true if the document has been optimized for mobile, and
|
||||
|
@ -321,19 +321,7 @@ Attr::SetTextContentInternal(const nsAString& aTextContent,
|
||||
NS_IMETHODIMP
|
||||
Attr::GetIsId(bool* aReturn)
|
||||
{
|
||||
Element* element = GetElement();
|
||||
if (!element) {
|
||||
*aReturn = false;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIAtom* idAtom = element->GetIDAttributeName();
|
||||
if (!idAtom) {
|
||||
*aReturn = false;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
*aReturn = mNodeInfo->Equals(idAtom, kNameSpaceID_None);
|
||||
*aReturn = mNodeInfo->Equals(nsGkAtoms::id, kNameSpaceID_None);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -35,18 +35,6 @@ DocumentFragment::IsNodeOfType(uint32_t aFlags) const
|
||||
return !(aFlags & ~(eCONTENT | eDOCUMENT_FRAGMENT));
|
||||
}
|
||||
|
||||
nsIAtom*
|
||||
DocumentFragment::DoGetID() const
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsIAtom*
|
||||
DocumentFragment::GetIDAttributeName() const
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
DocumentFragment::QuerySelector(const nsAString& aSelector,
|
||||
nsIDOMElement **aReturn)
|
||||
|
@ -103,9 +103,6 @@ public:
|
||||
|
||||
virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; }
|
||||
|
||||
virtual nsIAtom* DoGetID() const MOZ_OVERRIDE;
|
||||
virtual nsIAtom *GetIDAttributeName() const MOZ_OVERRIDE;
|
||||
|
||||
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers) MOZ_OVERRIDE
|
||||
|
@ -66,6 +66,7 @@
|
||||
#ifdef MOZ_XUL
|
||||
#include "nsXULElement.h"
|
||||
#endif /* MOZ_XUL */
|
||||
#include "nsSVGElement.h"
|
||||
#include "nsFrameManager.h"
|
||||
#include "nsFrameSelection.h"
|
||||
#ifdef DEBUG
|
||||
@ -138,6 +139,32 @@
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
nsIAtom*
|
||||
nsIContent::DoGetID() const
|
||||
{
|
||||
MOZ_ASSERT(HasID(), "Unexpected call");
|
||||
MOZ_ASSERT(IsElement(), "Only elements can have IDs");
|
||||
|
||||
return AsElement()->GetParsedAttr(nsGkAtoms::id)->GetAtomValue();
|
||||
}
|
||||
|
||||
const nsAttrValue*
|
||||
nsIContent::DoGetClasses() const
|
||||
{
|
||||
MOZ_ASSERT(HasFlag(NODE_MAY_HAVE_CLASS), "Unexpected call");
|
||||
MOZ_ASSERT(IsElement(), "Only elements can have classes");
|
||||
|
||||
if (IsSVG()) {
|
||||
const nsAttrValue* animClass =
|
||||
static_cast<const nsSVGElement*>(this)->GetAnimatedClassName();
|
||||
if (animClass) {
|
||||
return animClass;
|
||||
}
|
||||
}
|
||||
|
||||
return AsElement()->GetParsedAttr(nsGkAtoms::_class);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
Element::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
@ -469,15 +496,12 @@ Element::WrapObject(JSContext *aCx)
|
||||
}
|
||||
|
||||
nsDOMTokenList*
|
||||
Element::GetClassList()
|
||||
Element::ClassList()
|
||||
{
|
||||
Element::nsDOMSlots *slots = DOMSlots();
|
||||
Element::nsDOMSlots* slots = DOMSlots();
|
||||
|
||||
if (!slots->mClassList) {
|
||||
nsIAtom* classAttr = GetClassAttributeName();
|
||||
if (classAttr) {
|
||||
slots->mClassList = new nsDOMTokenList(this, classAttr);
|
||||
}
|
||||
slots->mClassList = new nsDOMTokenList(this, nsGkAtoms::_class);
|
||||
}
|
||||
|
||||
return slots->mClassList;
|
||||
@ -486,7 +510,7 @@ Element::GetClassList()
|
||||
void
|
||||
Element::GetClassList(nsISupports** aClassList)
|
||||
{
|
||||
NS_IF_ADDREF(*aClassList = GetClassList());
|
||||
NS_ADDREF(*aClassList = ClassList());
|
||||
}
|
||||
|
||||
already_AddRefed<nsIHTMLCollection>
|
||||
@ -739,31 +763,22 @@ Element::AddToIdTable(nsIAtom* aId)
|
||||
void
|
||||
Element::RemoveFromIdTable()
|
||||
{
|
||||
if (HasID()) {
|
||||
RemoveFromIdTable(DoGetID());
|
||||
if (!HasID()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Element::RemoveFromIdTable(nsIAtom* aId)
|
||||
{
|
||||
NS_ASSERTION(HasID(), "Node doesn't have an ID?");
|
||||
nsIAtom* id = DoGetID();
|
||||
if (HasFlag(NODE_IS_IN_SHADOW_TREE)) {
|
||||
ShadowRoot* containingShadow = GetContainingShadow();
|
||||
// Check for containingShadow because it may have
|
||||
// been deleted during unlinking.
|
||||
if (containingShadow) {
|
||||
containingShadow->RemoveFromIdTable(this, aId);
|
||||
containingShadow->RemoveFromIdTable(this, id);
|
||||
}
|
||||
} else {
|
||||
nsIDocument* doc = GetCurrentDoc();
|
||||
if (doc && (!IsInAnonymousSubtree() || doc->IsXUL())) {
|
||||
// id can be null during mutation events evilness. Also, XUL elements
|
||||
// loose their proto attributes during cc-unlink, so this can happen
|
||||
// during cc-unlink too.
|
||||
if (aId) {
|
||||
doc->RemoveFromIdTable(this, aId);
|
||||
}
|
||||
doc->RemoveFromIdTable(this, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1573,12 +1588,6 @@ Element::GetAttributeChangeHint(const nsIAtom* aAttribute,
|
||||
return nsChangeHint(0);
|
||||
}
|
||||
|
||||
nsIAtom *
|
||||
Element::GetClassAttributeName() const
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool
|
||||
Element::FindAttributeDependence(const nsIAtom* aAttribute,
|
||||
const MappedAttributeEntry* const aMaps[],
|
||||
@ -2056,6 +2065,27 @@ Element::ParseAttribute(int32_t aNamespaceID,
|
||||
const nsAString& aValue,
|
||||
nsAttrValue& aResult)
|
||||
{
|
||||
if (aNamespaceID == kNameSpaceID_None) {
|
||||
if (aAttribute == nsGkAtoms::_class) {
|
||||
SetFlags(NODE_MAY_HAVE_CLASS);
|
||||
aResult.ParseAtomArray(aValue);
|
||||
return true;
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::id) {
|
||||
// Store id as an atom. id="" means that the element has no id,
|
||||
// not that it has an emptystring as the id.
|
||||
RemoveFromIdTable();
|
||||
if (aValue.IsEmpty()) {
|
||||
ClearHasID();
|
||||
return false;
|
||||
}
|
||||
aResult.ParseAtom(aValue);
|
||||
SetHasID();
|
||||
AddToIdTable(aResult.GetAtomValue());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -2171,6 +2201,12 @@ Element::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
||||
// react to unexpected attribute changes.
|
||||
nsMutationGuard::DidMutate();
|
||||
|
||||
if (aName == nsGkAtoms::id && aNameSpaceID == kNameSpaceID_None) {
|
||||
// Have to do this before clearing flag. See RemoveFromIdTable
|
||||
RemoveFromIdTable();
|
||||
ClearHasID();
|
||||
}
|
||||
|
||||
bool hadValidDir = false;
|
||||
bool hadDirAuto = false;
|
||||
|
||||
|
@ -886,13 +886,6 @@ nsIContent::IsFocusableInternal(int32_t* aTabIndex, bool aWithMouse)
|
||||
return false;
|
||||
}
|
||||
|
||||
const nsAttrValue*
|
||||
FragmentOrElement::DoGetClasses() const
|
||||
{
|
||||
NS_NOTREACHED("Shouldn't ever be called");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
FragmentOrElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker)
|
||||
{
|
||||
|
@ -647,7 +647,7 @@ ContentSecurityPolicy.prototype = {
|
||||
}
|
||||
policy.log(WARN_FLAG, violationMessage,
|
||||
(aSourceFile) ? aSourceFile : null,
|
||||
(aScriptSample) ? decodeURIComponent(aScriptSample) : null,
|
||||
(aScriptSample) ? aScriptSample : null,
|
||||
(aLineNum) ? aLineNum : null);
|
||||
},
|
||||
|
||||
|
@ -7625,11 +7625,11 @@ nsDocument::GetViewportInfo(const ScreenIntSize& aDisplaySize)
|
||||
}
|
||||
case Specified:
|
||||
default:
|
||||
CSSIntSize size = mViewportSize;
|
||||
CSSSize size = mViewportSize;
|
||||
|
||||
if (!mValidWidth) {
|
||||
if (mValidHeight && !aDisplaySize.IsEmpty()) {
|
||||
size.width = int32_t(size.height * aDisplaySize.width / aDisplaySize.height);
|
||||
size.width = size.height * aDisplaySize.width / aDisplaySize.height;
|
||||
} else {
|
||||
size.width = Preferences::GetInt("browser.viewport.desktopWidth",
|
||||
kViewportDefaultScreenWidth);
|
||||
@ -7638,7 +7638,7 @@ nsDocument::GetViewportInfo(const ScreenIntSize& aDisplaySize)
|
||||
|
||||
if (!mValidHeight) {
|
||||
if (!aDisplaySize.IsEmpty()) {
|
||||
size.height = int32_t(size.width * aDisplaySize.height / aDisplaySize.width);
|
||||
size.height = size.width * aDisplaySize.height / aDisplaySize.width;
|
||||
} else {
|
||||
size.height = size.width;
|
||||
}
|
||||
@ -7654,28 +7654,28 @@ nsDocument::GetViewportInfo(const ScreenIntSize& aDisplaySize)
|
||||
if (mAutoSize) {
|
||||
// aDisplaySize is in screen pixels; convert them to CSS pixels for the viewport size.
|
||||
CSSToScreenScale defaultPixelScale = pixelRatio * LayoutDeviceToScreenScale(1.0f);
|
||||
size = mozilla::gfx::RoundedToInt(ScreenSize(aDisplaySize) / defaultPixelScale);
|
||||
size = ScreenSize(aDisplaySize) / defaultPixelScale;
|
||||
}
|
||||
|
||||
size.width = clamped(size.width, kViewportMinSize.width, kViewportMaxSize.width);
|
||||
size.width = clamped(size.width, float(kViewportMinSize.width), float(kViewportMaxSize.width));
|
||||
|
||||
// Also recalculate the default zoom, if it wasn't specified in the metadata,
|
||||
// and the width is specified.
|
||||
if (mScaleStrEmpty && !mWidthStrEmpty) {
|
||||
CSSToScreenScale defaultScale(float(aDisplaySize.width) / float(size.width));
|
||||
CSSToScreenScale defaultScale(float(aDisplaySize.width) / size.width);
|
||||
scaleFloat = (scaleFloat > defaultScale) ? scaleFloat : defaultScale;
|
||||
}
|
||||
|
||||
size.height = clamped(size.height, kViewportMinSize.height, kViewportMaxSize.height);
|
||||
size.height = clamped(size.height, float(kViewportMinSize.height), float(kViewportMaxSize.height));
|
||||
|
||||
// We need to perform a conversion, but only if the initial or maximum
|
||||
// scale were set explicitly by the user.
|
||||
if (mValidScaleFloat) {
|
||||
CSSIntSize displaySize = RoundedToInt(ScreenSize(aDisplaySize) / scaleFloat);
|
||||
CSSSize displaySize = ScreenSize(aDisplaySize) / scaleFloat;
|
||||
size.width = std::max(size.width, displaySize.width);
|
||||
size.height = std::max(size.height, displaySize.height);
|
||||
} else if (mValidMaxScale) {
|
||||
CSSIntSize displaySize = RoundedToInt(ScreenSize(aDisplaySize) / scaleMaxFloat);
|
||||
CSSSize displaySize = ScreenSize(aDisplaySize) / scaleMaxFloat;
|
||||
size.width = std::max(size.width, displaySize.width);
|
||||
size.height = std::max(size.height, displaySize.height);
|
||||
}
|
||||
|
@ -1692,7 +1692,7 @@ private:
|
||||
mozilla::LayoutDeviceToScreenScale mScaleFloat;
|
||||
mozilla::CSSToLayoutDeviceScale mPixelRatio;
|
||||
bool mAutoSize, mAllowZoom, mAllowDoubleTapZoom, mValidScaleFloat, mValidMaxScale, mScaleStrEmpty, mWidthStrEmpty;
|
||||
mozilla::CSSIntSize mViewportSize;
|
||||
mozilla::CSSSize mViewportSize;
|
||||
|
||||
nsrefcnt mStackRefCnt;
|
||||
bool mNeedsReleaseAfterStackRefCntRelease;
|
||||
|
@ -590,12 +590,6 @@ nsGenericDOMDataNode::GetChildren(uint32_t aFilter)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsIAtom *
|
||||
nsGenericDOMDataNode::GetIDAttributeName() const
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGenericDOMDataNode::SetAttr(int32_t aNameSpaceID, nsIAtom* aAttr,
|
||||
nsIAtom* aPrefix, const nsAString& aValue,
|
||||
@ -1070,19 +1064,6 @@ nsGenericDOMDataNode::GetCurrentValueAtom()
|
||||
return NS_NewAtom(val);
|
||||
}
|
||||
|
||||
nsIAtom*
|
||||
nsGenericDOMDataNode::DoGetID() const
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const nsAttrValue*
|
||||
nsGenericDOMDataNode::DoGetClasses() const
|
||||
{
|
||||
NS_NOTREACHED("Shouldn't ever be called");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGenericDOMDataNode::WalkContentStyleRules(nsRuleWalker* aRuleWalker)
|
||||
{
|
||||
@ -1103,12 +1084,6 @@ nsGenericDOMDataNode::GetAttributeChangeHint(const nsIAtom* aAttribute,
|
||||
return nsChangeHint(0);
|
||||
}
|
||||
|
||||
nsIAtom*
|
||||
nsGenericDOMDataNode::GetClassAttributeName() const
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
size_t
|
||||
nsGenericDOMDataNode::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
|
||||
{
|
||||
|
@ -115,7 +115,6 @@ public:
|
||||
|
||||
virtual already_AddRefed<nsINodeList> GetChildren(uint32_t aFilter) MOZ_OVERRIDE;
|
||||
|
||||
virtual nsIAtom *GetIDAttributeName() const MOZ_OVERRIDE;
|
||||
|
||||
nsresult SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
||||
const nsAString& aValue, bool aNotify)
|
||||
@ -170,13 +169,10 @@ public:
|
||||
virtual mozilla::dom::CustomElementData* GetCustomElementData() const MOZ_OVERRIDE;
|
||||
virtual void SetCustomElementData(mozilla::dom::CustomElementData* aData) MOZ_OVERRIDE;
|
||||
|
||||
virtual nsIAtom* DoGetID() const MOZ_OVERRIDE;
|
||||
virtual const nsAttrValue* DoGetClasses() const MOZ_OVERRIDE;
|
||||
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker) MOZ_OVERRIDE;
|
||||
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const;
|
||||
virtual nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute,
|
||||
int32_t aModType) const;
|
||||
virtual nsIAtom *GetClassAttributeName() const;
|
||||
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE
|
||||
{
|
||||
|
@ -28,106 +28,22 @@ using namespace mozilla::dom;
|
||||
//----------------------------------------------------------------------
|
||||
// nsIContent methods
|
||||
|
||||
nsIAtom*
|
||||
nsStyledElementNotElementCSSInlineStyle::GetClassAttributeName() const
|
||||
{
|
||||
return nsGkAtoms::_class;
|
||||
}
|
||||
|
||||
nsIAtom*
|
||||
nsStyledElementNotElementCSSInlineStyle::GetIDAttributeName() const
|
||||
{
|
||||
return nsGkAtoms::id;
|
||||
}
|
||||
|
||||
nsIAtom*
|
||||
nsStyledElementNotElementCSSInlineStyle::DoGetID() const
|
||||
{
|
||||
NS_ASSERTION(HasID(), "Unexpected call");
|
||||
|
||||
// The nullcheck here is needed because Element::UnsetAttr calls
|
||||
// out to various code between removing the attribute and we get a chance to
|
||||
// ClearHasID().
|
||||
|
||||
const nsAttrValue* attr = mAttrsAndChildren.GetAttr(nsGkAtoms::id);
|
||||
|
||||
return attr ? attr->GetAtomValue() : nullptr;
|
||||
}
|
||||
|
||||
const nsAttrValue*
|
||||
nsStyledElementNotElementCSSInlineStyle::DoGetClasses() const
|
||||
{
|
||||
NS_ASSERTION(HasFlag(NODE_MAY_HAVE_CLASS), "Unexpected call");
|
||||
return mAttrsAndChildren.GetAttr(nsGkAtoms::_class);
|
||||
}
|
||||
|
||||
bool
|
||||
nsStyledElementNotElementCSSInlineStyle::ParseAttribute(int32_t aNamespaceID,
|
||||
nsIAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
nsAttrValue& aResult)
|
||||
{
|
||||
if (aNamespaceID == kNameSpaceID_None) {
|
||||
if (aAttribute == nsGkAtoms::style) {
|
||||
SetMayHaveStyle();
|
||||
ParseStyleAttribute(aValue, aResult, false);
|
||||
return true;
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::_class) {
|
||||
SetFlags(NODE_MAY_HAVE_CLASS);
|
||||
aResult.ParseAtomArray(aValue);
|
||||
return true;
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::id) {
|
||||
// Store id as an atom. id="" means that the element has no id,
|
||||
// not that it has an emptystring as the id.
|
||||
RemoveFromIdTable();
|
||||
if (aValue.IsEmpty()) {
|
||||
ClearHasID();
|
||||
return false;
|
||||
}
|
||||
aResult.ParseAtom(aValue);
|
||||
SetHasID();
|
||||
AddToIdTable(aResult.GetAtomValue());
|
||||
return true;
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::style && aNamespaceID == kNameSpaceID_None) {
|
||||
SetMayHaveStyle();
|
||||
ParseStyleAttribute(aValue, aResult, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
return nsStyledElementBase::ParseAttribute(aNamespaceID, aAttribute, aValue,
|
||||
aResult);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsStyledElementNotElementCSSInlineStyle::UnsetAttr(int32_t aNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
bool aNotify)
|
||||
{
|
||||
nsAutoScriptBlocker scriptBlocker;
|
||||
if (aAttribute == nsGkAtoms::id && aNameSpaceID == kNameSpaceID_None) {
|
||||
// Have to do this before clearing flag. See RemoveFromIdTable
|
||||
RemoveFromIdTable();
|
||||
}
|
||||
|
||||
return Element::UnsetAttr(aNameSpaceID, aAttribute, aNotify);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsStyledElementNotElementCSSInlineStyle::AfterSetAttr(int32_t aNamespaceID,
|
||||
nsIAtom* aAttribute,
|
||||
const nsAttrValue* aValue,
|
||||
bool aNotify)
|
||||
{
|
||||
if (aNamespaceID == kNameSpaceID_None && !aValue &&
|
||||
aAttribute == nsGkAtoms::id) {
|
||||
// The id has been removed when calling UnsetAttr but we kept it because
|
||||
// the id is used for some layout stuff between UnsetAttr and AfterSetAttr.
|
||||
// Now. the id is really removed so it would not be safe to keep this flag.
|
||||
ClearHasID();
|
||||
}
|
||||
|
||||
return Element::AfterSetAttr(aNamespaceID, aAttribute, aValue, aNotify);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsStyledElementNotElementCSSInlineStyle::SetInlineStyleRule(css::StyleRule* aStyleRule,
|
||||
const nsAString* aSerialized,
|
||||
|
@ -36,21 +36,11 @@ protected:
|
||||
|
||||
public:
|
||||
// nsIContent interface methods
|
||||
virtual nsIAtom* GetClassAttributeName() const MOZ_OVERRIDE;
|
||||
virtual nsIAtom* GetIDAttributeName() const MOZ_OVERRIDE;
|
||||
virtual nsIAtom* DoGetID() const MOZ_OVERRIDE;
|
||||
virtual const nsAttrValue* DoGetClasses() const MOZ_OVERRIDE;
|
||||
|
||||
virtual mozilla::css::StyleRule* GetInlineStyleRule();
|
||||
virtual nsresult SetInlineStyleRule(mozilla::css::StyleRule* aStyleRule,
|
||||
const nsAString* aSerialized,
|
||||
bool aNotify) MOZ_OVERRIDE;
|
||||
|
||||
virtual nsresult UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
|
||||
bool aNotify) MOZ_OVERRIDE;
|
||||
virtual nsresult AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
|
||||
const nsAttrValue* aValue, bool aNotify) MOZ_OVERRIDE;
|
||||
|
||||
nsICSSDeclaration* Style();
|
||||
|
||||
protected:
|
||||
|
@ -412,16 +412,13 @@ var mathMLNode = document.createElementNS(MATHML_NS, "math");
|
||||
content.appendChild(mathMLNode);
|
||||
testClassList(mathMLNode);
|
||||
|
||||
// Nodes not meant to be styled have a null classList property.
|
||||
|
||||
var xmlNode = document.createElementNS(null, "foo");
|
||||
content.appendChild(xmlNode);
|
||||
is(xmlNode.classList, null, "classList is not null for plain XML nodes");
|
||||
testClassList(xmlNode);
|
||||
|
||||
var fooNode = document.createElementNS("http://example.org/foo", "foo");
|
||||
content.appendChild(fooNode);
|
||||
is(fooNode.classList, null, "classList is not null for nodes in " +
|
||||
" http://example.org/foo namespace");
|
||||
testClassList(fooNode);
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
|
@ -255,14 +255,6 @@ public:
|
||||
#undef ERROR_EVENT
|
||||
#undef FORWARDED_EVENT
|
||||
#undef EVENT
|
||||
void GetClassName(mozilla::dom::DOMString& aClassName)
|
||||
{
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::_class, aClassName);
|
||||
}
|
||||
void SetClassName(const nsAString& aClassName)
|
||||
{
|
||||
SetAttr(kNameSpaceID_None, nsGkAtoms::_class, aClassName, true);
|
||||
}
|
||||
mozilla::dom::Element* GetOffsetParent()
|
||||
{
|
||||
mozilla::CSSIntRect rcFrame;
|
||||
@ -321,14 +313,6 @@ public:
|
||||
|
||||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
NS_IMETHOD GetId(nsAString& aId) MOZ_FINAL {
|
||||
mozilla::dom::Element::GetId(aId);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD SetId(const nsAString& aId) MOZ_FINAL {
|
||||
mozilla::dom::Element::SetId(aId);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD GetTitle(nsAString& aTitle) MOZ_FINAL {
|
||||
nsString title;
|
||||
GetTitle(title);
|
||||
|
@ -459,7 +459,7 @@ ImageDocument::Notify(imgIRequest* aRequest, int32_t aType, const nsIntRect* aDa
|
||||
return OnStartContainer(aRequest, image);
|
||||
}
|
||||
|
||||
nsDOMTokenList* classList = mImageContent->AsElement()->GetClassList();
|
||||
nsDOMTokenList* classList = mImageContent->AsElement()->ClassList();
|
||||
mozilla::ErrorResult rv;
|
||||
if (aType == imgINotificationObserver::DECODE_COMPLETE) {
|
||||
if (mImageContent && !nsContentUtils::IsChildOfSameType(this)) {
|
||||
@ -494,7 +494,7 @@ ImageDocument::Notify(imgIRequest* aRequest, int32_t aType, const nsIntRect* aDa
|
||||
void
|
||||
ImageDocument::SetModeClass(eModeClasses mode)
|
||||
{
|
||||
nsDOMTokenList* classList = mImageContent->AsElement()->GetClassList();
|
||||
nsDOMTokenList* classList = mImageContent->AsElement()->ClassList();
|
||||
mozilla::ErrorResult rv;
|
||||
|
||||
if (mode == eShrinkToFit) {
|
||||
|
@ -13,11 +13,6 @@ using namespace mozilla::dom;
|
||||
nsresult
|
||||
NS_NewMathMLElement(Element** aResult, already_AddRefed<nsINodeInfo>&& aNodeInfo)
|
||||
{
|
||||
nsCOMPtr<nsINodeInfo> ni = aNodeInfo;
|
||||
ni->SetIDAttributeAtom(nsGkAtoms::id);
|
||||
|
||||
nsMathMLElement* it = new nsMathMLElement(ni.forget());
|
||||
|
||||
NS_ADDREF(*aResult = it);
|
||||
NS_ADDREF(*aResult = new nsMathMLElement(aNodeInfo));
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -131,12 +131,10 @@ MediaEngineWebRTC::EnumerateVideoDevices(nsTArray<nsRefPtr<MediaEngineVideoSourc
|
||||
MutexAutoLock lock(mMutex);
|
||||
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
jobject context = mozilla::AndroidBridge::Bridge()->GetGlobalContextRef();
|
||||
|
||||
// get the JVM
|
||||
JavaVM *jvm = mozilla::AndroidBridge::Bridge()->GetVM();
|
||||
|
||||
if (webrtc::VideoEngine::SetAndroidObjects(jvm, (void*)context) != 0) {
|
||||
if (webrtc::VideoEngine::SetAndroidObjects(jvm) != 0) {
|
||||
LOG(("VieCapture:SetAndroidObjects Failed"));
|
||||
return;
|
||||
}
|
||||
|
@ -43,6 +43,8 @@
|
||||
#include "webrtc/voice_engine/include/voe_call_report.h"
|
||||
|
||||
// Video Engine
|
||||
// conflicts with #include of scoped_ptr.h
|
||||
#undef FF
|
||||
#include "webrtc/video_engine/include/vie_base.h"
|
||||
#include "webrtc/video_engine/include/vie_codec.h"
|
||||
#include "webrtc/video_engine/include/vie_render.h"
|
||||
|
@ -8,9 +8,9 @@
|
||||
#include "DOMSVGAnimatedNumberList.h"
|
||||
#include "SVGAnimatedNumberList.h"
|
||||
#include "nsSVGElement.h"
|
||||
#include "nsIDOMSVGNumber.h"
|
||||
#include "nsError.h"
|
||||
#include "nsContentUtils.h" // for NS_ENSURE_FINITE
|
||||
#include "mozilla/dom/SVGNumberBinding.h"
|
||||
|
||||
// See the architecture comment in DOMSVGAnimatedNumberList.h.
|
||||
|
||||
@ -27,23 +27,25 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(DOMSVGNumber)
|
||||
if (tmp->mList) {
|
||||
tmp->mList->mItems[tmp->mListIndex] = nullptr;
|
||||
}
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mList)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mList)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mParent)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(DOMSVGNumber)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mList)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mList)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mParent)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(DOMSVGNumber)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(DOMSVGNumber)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(DOMSVGNumber)
|
||||
}
|
||||
DOMCI_DATA(SVGNumber, mozilla::DOMSVGNumber)
|
||||
|
||||
namespace mozilla {
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(DOMSVGNumber)
|
||||
NS_INTERFACE_MAP_ENTRY(mozilla::DOMSVGNumber) // pseudo-interface
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGNumber)
|
||||
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGNumber)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
@ -84,6 +86,7 @@ DOMSVGNumber::DOMSVGNumber(DOMSVGNumberList *aList,
|
||||
uint32_t aListIndex,
|
||||
bool aIsAnimValItem)
|
||||
: mList(aList)
|
||||
, mParent(aList)
|
||||
, mListIndex(aListIndex)
|
||||
, mAttrEnum(aAttrEnum)
|
||||
, mIsAnimValItem(aIsAnimValItem)
|
||||
@ -95,46 +98,76 @@ DOMSVGNumber::DOMSVGNumber(DOMSVGNumberList *aList,
|
||||
aListIndex <= MaxListIndex(), "bad arg");
|
||||
|
||||
NS_ABORT_IF_FALSE(IndexIsValid(), "Bad index for DOMSVGNumber!");
|
||||
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
|
||||
DOMSVGNumber::DOMSVGNumber()
|
||||
DOMSVGNumber::DOMSVGNumber(nsISupports* aParent)
|
||||
: mList(nullptr)
|
||||
, mParent(aParent)
|
||||
, mListIndex(0)
|
||||
, mAttrEnum(0)
|
||||
, mIsAnimValItem(false)
|
||||
, mValue(0.0f)
|
||||
{
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
DOMSVGNumber::GetValue(float* aValue)
|
||||
/* static */ already_AddRefed<DOMSVGNumber>
|
||||
DOMSVGNumber::Constructor(const dom::GlobalObject& aGlobal, ErrorResult& aRv)
|
||||
{
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aGlobal.GetAsSupports());
|
||||
if (!window) {
|
||||
aRv.Throw(NS_ERROR_UNEXPECTED);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsRefPtr<DOMSVGNumber> number = new DOMSVGNumber(window);
|
||||
return number.forget();
|
||||
}
|
||||
|
||||
/* static */ already_AddRefed<DOMSVGNumber>
|
||||
DOMSVGNumber::Constructor(const dom::GlobalObject& aGlobal, float aValue,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aGlobal.GetAsSupports());
|
||||
if (!window) {
|
||||
aRv.Throw(NS_ERROR_UNEXPECTED);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsRefPtr<DOMSVGNumber> number = new DOMSVGNumber(window);
|
||||
number->SetValue(aValue, aRv);
|
||||
return number.forget();
|
||||
}
|
||||
|
||||
float
|
||||
DOMSVGNumber::Value()
|
||||
{
|
||||
if (mIsAnimValItem && HasOwner()) {
|
||||
Element()->FlushAnimations(); // May make HasOwner() == false
|
||||
}
|
||||
*aValue = HasOwner() ? InternalItem() : mValue;
|
||||
return NS_OK;
|
||||
return HasOwner() ? InternalItem() : mValue;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
DOMSVGNumber::SetValue(float aValue)
|
||||
void
|
||||
DOMSVGNumber::SetValue(float aValue, ErrorResult& aRv)
|
||||
{
|
||||
if (mIsAnimValItem) {
|
||||
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
|
||||
aRv.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR);
|
||||
return;
|
||||
}
|
||||
|
||||
NS_ENSURE_FINITE(aValue, NS_ERROR_ILLEGAL_VALUE);
|
||||
|
||||
if (HasOwner()) {
|
||||
if (InternalItem() == aValue) {
|
||||
return NS_OK;
|
||||
return;
|
||||
}
|
||||
AutoChangeNumberNotifier notifier(this);
|
||||
InternalItem() = aValue;
|
||||
return NS_OK;
|
||||
return;
|
||||
}
|
||||
|
||||
mValue = aValue;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
@ -188,4 +221,10 @@ DOMSVGNumber::IndexIsValid()
|
||||
}
|
||||
#endif
|
||||
|
||||
JSObject*
|
||||
DOMSVGNumber::WrapObject(JSContext* aCx)
|
||||
{
|
||||
return dom::SVGNumberBinding::Wrap(aCx, this);
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -9,21 +9,13 @@
|
||||
#include "DOMSVGNumberList.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsIDOMSVGNumber.h"
|
||||
#include "nsTArray.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
#include "nsWrapperCache.h"
|
||||
|
||||
class nsSVGElement;
|
||||
|
||||
// We make DOMSVGNumber a pseudo-interface to allow us to QI to it in order to
|
||||
// check that the objects that scripts pass to DOMSVGNumberList methods are our
|
||||
// *native* number objects.
|
||||
//
|
||||
// {2CA92412-2E1F-4DDB-A16C-52B3B582270D}
|
||||
#define MOZILLA_DOMSVGNUMBER_IID \
|
||||
{ 0x2CA92412, 0x2E1F, 0x4DDB, \
|
||||
{ 0xA1, 0x6C, 0x52, 0xB3, 0xB5, 0x82, 0x27, 0x0D } }
|
||||
|
||||
#define MOZ_SVG_LIST_INDEX_BIT_COUNT 27 // supports > 134 million list items
|
||||
|
||||
namespace mozilla {
|
||||
@ -41,15 +33,14 @@ namespace mozilla {
|
||||
*
|
||||
* See the comment in DOMSVGLength.h (yes, LENGTH), which applies here too.
|
||||
*/
|
||||
class DOMSVGNumber MOZ_FINAL : public nsIDOMSVGNumber
|
||||
class DOMSVGNumber MOZ_FINAL : public nsISupports
|
||||
, public nsWrapperCache
|
||||
{
|
||||
friend class AutoChangeNumberNotifier;
|
||||
|
||||
public:
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(MOZILLA_DOMSVGNUMBER_IID)
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS(DOMSVGNumber)
|
||||
NS_DECL_NSIDOMSVGNUMBER
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMSVGNumber)
|
||||
|
||||
/**
|
||||
* Generic ctor for DOMSVGNumber objects that are created for an attribute.
|
||||
@ -63,7 +54,7 @@ public:
|
||||
* Ctor for creating the objects returned by SVGSVGElement.createSVGNumber(),
|
||||
* which do not initially belong to an attribute.
|
||||
*/
|
||||
DOMSVGNumber();
|
||||
explicit DOMSVGNumber(nsISupports* aParent);
|
||||
|
||||
~DOMSVGNumber() {
|
||||
// Our mList's weak ref to us must be nulled out when we die. If GC has
|
||||
@ -78,7 +69,7 @@ public:
|
||||
* Create an unowned copy. The caller is responsible for the first AddRef().
|
||||
*/
|
||||
DOMSVGNumber* Clone() {
|
||||
DOMSVGNumber *clone = new DOMSVGNumber();
|
||||
DOMSVGNumber *clone = new DOMSVGNumber(mParent);
|
||||
clone->mValue = ToSVGNumber();
|
||||
return clone;
|
||||
}
|
||||
@ -128,6 +119,23 @@ public:
|
||||
|
||||
float ToSVGNumber();
|
||||
|
||||
nsISupports* GetParentObject()
|
||||
{
|
||||
return mParent;
|
||||
}
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
|
||||
|
||||
static already_AddRefed<DOMSVGNumber>
|
||||
Constructor(const dom::GlobalObject& aGlobal, ErrorResult& aRv);
|
||||
|
||||
static already_AddRefed<DOMSVGNumber>
|
||||
Constructor(const dom::GlobalObject& aGlobal, float aValue, ErrorResult& aRv);
|
||||
|
||||
float Value();
|
||||
|
||||
void SetValue(float aValue, ErrorResult& aRv);
|
||||
|
||||
private:
|
||||
|
||||
nsSVGElement* Element() {
|
||||
@ -154,6 +162,7 @@ private:
|
||||
#endif
|
||||
|
||||
nsRefPtr<DOMSVGNumberList> mList;
|
||||
nsCOMPtr<nsISupports> mParent;
|
||||
|
||||
// Bounds for the following are checked in the ctor, so be sure to update
|
||||
// that if you change the capacity of any of the following.
|
||||
@ -166,8 +175,6 @@ private:
|
||||
float mValue;
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(DOMSVGNumber, MOZILLA_DOMSVGNUMBER_IID)
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#undef MOZ_SVG_LIST_INDEX_BIT_COUNT
|
||||
|
@ -171,8 +171,8 @@ DOMSVGNumberList::Clear(ErrorResult& error)
|
||||
}
|
||||
}
|
||||
|
||||
already_AddRefed<nsIDOMSVGNumber>
|
||||
DOMSVGNumberList::Initialize(nsIDOMSVGNumber *newItem,
|
||||
already_AddRefed<DOMSVGNumber>
|
||||
DOMSVGNumberList::Initialize(DOMSVGNumber& aItem,
|
||||
ErrorResult& error)
|
||||
{
|
||||
if (IsAnimValList()) {
|
||||
@ -187,33 +187,25 @@ DOMSVGNumberList::Initialize(nsIDOMSVGNumber *newItem,
|
||||
// from this list, and so the InsertItemBefore() call would not insert a
|
||||
// clone of newItem, it would actually insert newItem. To prevent that from
|
||||
// happening we have to do the clone here, if necessary.
|
||||
|
||||
nsCOMPtr<DOMSVGNumber> domItem = do_QueryInterface(newItem);
|
||||
if (!domItem) {
|
||||
error.Throw(NS_ERROR_DOM_SVG_WRONG_TYPE_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
if (domItem->HasOwner()) {
|
||||
newItem = domItem->Clone();
|
||||
}
|
||||
nsRefPtr<DOMSVGNumber> domItem = aItem.HasOwner() ? aItem.Clone() : &aItem;
|
||||
|
||||
Clear(error);
|
||||
MOZ_ASSERT(!error.Failed());
|
||||
return InsertItemBefore(newItem, 0, error);
|
||||
return InsertItemBefore(*domItem, 0, error);
|
||||
}
|
||||
|
||||
already_AddRefed<nsIDOMSVGNumber>
|
||||
already_AddRefed<DOMSVGNumber>
|
||||
DOMSVGNumberList::GetItem(uint32_t index, ErrorResult& error)
|
||||
{
|
||||
bool found;
|
||||
nsRefPtr<nsIDOMSVGNumber> item = IndexedGetter(index, found, error);
|
||||
nsRefPtr<DOMSVGNumber> item = IndexedGetter(index, found, error);
|
||||
if (!found) {
|
||||
error.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
|
||||
}
|
||||
return item.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<nsIDOMSVGNumber>
|
||||
already_AddRefed<DOMSVGNumber>
|
||||
DOMSVGNumberList::IndexedGetter(uint32_t index, bool& found, ErrorResult& error)
|
||||
{
|
||||
if (IsAnimValList()) {
|
||||
@ -226,8 +218,8 @@ DOMSVGNumberList::IndexedGetter(uint32_t index, bool& found, ErrorResult& error)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
already_AddRefed<nsIDOMSVGNumber>
|
||||
DOMSVGNumberList::InsertItemBefore(nsIDOMSVGNumber *newItem,
|
||||
already_AddRefed<DOMSVGNumber>
|
||||
DOMSVGNumberList::InsertItemBefore(DOMSVGNumber& aItem,
|
||||
uint32_t index,
|
||||
ErrorResult& error)
|
||||
{
|
||||
@ -242,14 +234,8 @@ DOMSVGNumberList::InsertItemBefore(nsIDOMSVGNumber *newItem,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsCOMPtr<DOMSVGNumber> domItem = do_QueryInterface(newItem);
|
||||
if (!domItem) {
|
||||
error.Throw(NS_ERROR_DOM_SVG_WRONG_TYPE_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
if (domItem->HasOwner()) {
|
||||
domItem = domItem->Clone(); // must do this before changing anything!
|
||||
}
|
||||
// must do this before changing anything!
|
||||
nsRefPtr<DOMSVGNumber> domItem = aItem.HasOwner() ? aItem.Clone() : &aItem;
|
||||
|
||||
// Ensure we have enough memory so we can avoid complex error handling below:
|
||||
if (!mItems.SetCapacity(mItems.Length() + 1) ||
|
||||
@ -263,7 +249,7 @@ DOMSVGNumberList::InsertItemBefore(nsIDOMSVGNumber *newItem,
|
||||
MaybeInsertNullInAnimValListAt(index);
|
||||
|
||||
InternalList().InsertItem(index, domItem->ToSVGNumber());
|
||||
mItems.InsertElementAt(index, domItem.get());
|
||||
mItems.InsertElementAt(index, domItem);
|
||||
|
||||
// This MUST come after the insertion into InternalList(), or else under the
|
||||
// insertion into InternalList() the values read from domItem would be bad
|
||||
@ -275,8 +261,8 @@ DOMSVGNumberList::InsertItemBefore(nsIDOMSVGNumber *newItem,
|
||||
return domItem.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<nsIDOMSVGNumber>
|
||||
DOMSVGNumberList::ReplaceItem(nsIDOMSVGNumber *newItem,
|
||||
already_AddRefed<DOMSVGNumber>
|
||||
DOMSVGNumberList::ReplaceItem(DOMSVGNumber& aItem,
|
||||
uint32_t index,
|
||||
ErrorResult& error)
|
||||
{
|
||||
@ -285,18 +271,13 @@ DOMSVGNumberList::ReplaceItem(nsIDOMSVGNumber *newItem,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsCOMPtr<DOMSVGNumber> domItem = do_QueryInterface(newItem);
|
||||
if (!domItem) {
|
||||
error.Throw(NS_ERROR_DOM_SVG_WRONG_TYPE_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
if (index >= LengthNoFlush()) {
|
||||
error.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
if (domItem->HasOwner()) {
|
||||
domItem = domItem->Clone(); // must do this before changing anything!
|
||||
}
|
||||
|
||||
// must do this before changing anything!
|
||||
nsRefPtr<DOMSVGNumber> domItem = aItem.HasOwner() ? aItem.Clone() : &aItem;
|
||||
|
||||
AutoChangeNumberListNotifier notifier(this);
|
||||
if (mItems[index]) {
|
||||
@ -315,7 +296,7 @@ DOMSVGNumberList::ReplaceItem(nsIDOMSVGNumber *newItem,
|
||||
return domItem.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<nsIDOMSVGNumber>
|
||||
already_AddRefed<DOMSVGNumber>
|
||||
DOMSVGNumberList::RemoveItem(uint32_t index,
|
||||
ErrorResult& error)
|
||||
{
|
||||
@ -335,7 +316,7 @@ DOMSVGNumberList::RemoveItem(uint32_t index,
|
||||
MaybeRemoveItemFromAnimValListAt(index);
|
||||
|
||||
// We have to return the removed item, so get it, creating it if necessary:
|
||||
nsRefPtr<nsIDOMSVGNumber> result = GetItemAt(index);
|
||||
nsRefPtr<DOMSVGNumber> result = GetItemAt(index);
|
||||
|
||||
AutoChangeNumberListNotifier notifier(this);
|
||||
// Notify the DOM item of removal *before* modifying the lists so that the
|
||||
@ -350,7 +331,7 @@ DOMSVGNumberList::RemoveItem(uint32_t index,
|
||||
return result.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<nsIDOMSVGNumber>
|
||||
already_AddRefed<DOMSVGNumber>
|
||||
DOMSVGNumberList::GetItemAt(uint32_t aIndex)
|
||||
{
|
||||
MOZ_ASSERT(aIndex < mItems.Length());
|
||||
@ -358,7 +339,7 @@ DOMSVGNumberList::GetItemAt(uint32_t aIndex)
|
||||
if (!mItems[aIndex]) {
|
||||
mItems[aIndex] = new DOMSVGNumber(this, AttrEnum(), aIndex, IsAnimValList());
|
||||
}
|
||||
nsRefPtr<nsIDOMSVGNumber> result = mItems[aIndex];
|
||||
nsRefPtr<DOMSVGNumber> result = mItems[aIndex];
|
||||
return result.forget();
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include "nsDebug.h"
|
||||
#include "nsTArray.h"
|
||||
#include "SVGNumberList.h"
|
||||
#include "nsIDOMSVGNumber.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
|
||||
@ -109,22 +108,19 @@ public:
|
||||
return LengthNoFlush();
|
||||
}
|
||||
void Clear(ErrorResult& error);
|
||||
already_AddRefed<nsIDOMSVGNumber> Initialize(nsIDOMSVGNumber *newItem,
|
||||
ErrorResult& error);
|
||||
already_AddRefed<nsIDOMSVGNumber> GetItem(uint32_t index,
|
||||
already_AddRefed<DOMSVGNumber> Initialize(DOMSVGNumber& newItem,
|
||||
ErrorResult& error);
|
||||
already_AddRefed<nsIDOMSVGNumber> IndexedGetter(uint32_t index, bool& found,
|
||||
ErrorResult& error);
|
||||
already_AddRefed<nsIDOMSVGNumber> InsertItemBefore(nsIDOMSVGNumber *newItem,
|
||||
uint32_t index,
|
||||
ErrorResult& error);
|
||||
already_AddRefed<nsIDOMSVGNumber> ReplaceItem(nsIDOMSVGNumber *newItem,
|
||||
uint32_t index,
|
||||
ErrorResult& error);
|
||||
already_AddRefed<nsIDOMSVGNumber> RemoveItem(uint32_t index,
|
||||
already_AddRefed<DOMSVGNumber> GetItem(uint32_t index, ErrorResult& error);
|
||||
already_AddRefed<DOMSVGNumber> IndexedGetter(uint32_t index, bool& found,
|
||||
ErrorResult& error);
|
||||
already_AddRefed<nsIDOMSVGNumber> AppendItem(nsIDOMSVGNumber *newItem,
|
||||
ErrorResult& error)
|
||||
already_AddRefed<DOMSVGNumber> InsertItemBefore(DOMSVGNumber& newItem,
|
||||
uint32_t index, ErrorResult& error);
|
||||
already_AddRefed<DOMSVGNumber> ReplaceItem(DOMSVGNumber& newItem, uint32_t index,
|
||||
ErrorResult& error);
|
||||
already_AddRefed<DOMSVGNumber> RemoveItem(uint32_t index,
|
||||
ErrorResult& error);
|
||||
already_AddRefed<DOMSVGNumber> AppendItem(DOMSVGNumber& newItem,
|
||||
ErrorResult& error)
|
||||
{
|
||||
return InsertItemBefore(newItem, LengthNoFlush(), error);
|
||||
}
|
||||
@ -160,8 +156,8 @@ private:
|
||||
*/
|
||||
SVGNumberList& InternalList() const;
|
||||
|
||||
/// Returns the nsIDOMSVGNumber at aIndex, creating it if necessary.
|
||||
already_AddRefed<nsIDOMSVGNumber> GetItemAt(uint32_t aIndex);
|
||||
/// Returns the DOMSVGNumber at aIndex, creating it if necessary.
|
||||
already_AddRefed<DOMSVGNumber> GetItemAt(uint32_t aIndex);
|
||||
|
||||
void MaybeInsertNullInAnimValListAt(uint32_t aIndex);
|
||||
void MaybeRemoveItemFromAnimValListAt(uint32_t aIndex);
|
||||
|
@ -381,10 +381,10 @@ SVGSVGElement::DeselectAll()
|
||||
}
|
||||
}
|
||||
|
||||
already_AddRefed<nsIDOMSVGNumber>
|
||||
already_AddRefed<DOMSVGNumber>
|
||||
SVGSVGElement::CreateSVGNumber()
|
||||
{
|
||||
nsCOMPtr<nsIDOMSVGNumber> number = new DOMSVGNumber();
|
||||
nsRefPtr<DOMSVGNumber> number = new DOMSVGNumber(ToSupports(this));
|
||||
return number.forget();
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,6 @@ nsresult NS_NewSVGSVGElement(nsIContent **aResult,
|
||||
already_AddRefed<nsINodeInfo>&& aNodeInfo,
|
||||
mozilla::dom::FromParser aFromParser);
|
||||
|
||||
class nsIDOMSVGNumber;
|
||||
class nsSMILTimeContainer;
|
||||
class nsSVGOuterSVGFrame;
|
||||
class nsSVGInnerSVGFrame;
|
||||
@ -31,6 +30,7 @@ namespace mozilla {
|
||||
class AutoSVGRenderingState;
|
||||
class DOMSVGAnimatedPreserveAspectRatio;
|
||||
class DOMSVGLength;
|
||||
class DOMSVGNumber;
|
||||
class EventChainPreVisitor;
|
||||
class SVGFragmentIdentifier;
|
||||
|
||||
@ -239,7 +239,7 @@ public:
|
||||
float GetCurrentTime();
|
||||
void SetCurrentTime(float seconds);
|
||||
void DeselectAll();
|
||||
already_AddRefed<nsIDOMSVGNumber> CreateSVGNumber();
|
||||
already_AddRefed<DOMSVGNumber> CreateSVGNumber();
|
||||
already_AddRefed<DOMSVGLength> CreateSVGLength();
|
||||
already_AddRefed<SVGAngle> CreateSVGAngle();
|
||||
already_AddRefed<nsISVGPoint> CreateSVGPoint();
|
||||
|
@ -99,7 +99,7 @@ nsSVGElement::WrapNode(JSContext *aCx)
|
||||
|
||||
/* readonly attribute SVGAnimatedString className; */
|
||||
NS_IMETHODIMP
|
||||
nsSVGElement::GetClassName(nsISupports** aClassName)
|
||||
nsSVGElement::GetSVGClassName(nsISupports** aClassName)
|
||||
{
|
||||
*aClassName = ClassName().take();
|
||||
return NS_OK;
|
||||
@ -240,15 +240,6 @@ NS_IMPL_ISUPPORTS_INHERITED(nsSVGElement, nsSVGElementBase,
|
||||
//----------------------------------------------------------------------
|
||||
// nsIContent methods
|
||||
|
||||
const nsAttrValue*
|
||||
nsSVGElement::DoGetClasses() const
|
||||
{
|
||||
if (mClassAttribute.IsAnimated()) {
|
||||
return mClassAnimAttr;
|
||||
}
|
||||
return nsSVGElementBase::DoGetClasses();
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSVGElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
@ -1095,19 +1086,6 @@ nsSVGElement::sMaskMap[] = {
|
||||
//----------------------------------------------------------------------
|
||||
// nsIDOMSVGElement methods
|
||||
|
||||
/* attribute DOMString id; */
|
||||
NS_IMETHODIMP nsSVGElement::GetId(nsAString & aId)
|
||||
{
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::id, aId);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSVGElement::SetId(const nsAString & aId)
|
||||
{
|
||||
return SetAttr(kNameSpaceID_None, nsGkAtoms::id, aId, true);
|
||||
}
|
||||
|
||||
/* readonly attribute nsIDOMSVGSVGElement ownerSVGElement; */
|
||||
NS_IMETHODIMP
|
||||
nsSVGElement::GetOwnerSVGElement(nsIDOMSVGElement * *aOwnerSVGElement)
|
||||
|
@ -96,7 +96,6 @@ public:
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
virtual const nsAttrValue* DoGetClasses() const MOZ_OVERRIDE;
|
||||
void DidAnimateClass();
|
||||
|
||||
// nsIContent interface methods
|
||||
@ -305,6 +304,13 @@ public:
|
||||
virtual nsIAtom* GetTransformListAttrName() const {
|
||||
return nullptr;
|
||||
}
|
||||
const nsAttrValue* GetAnimatedClassName() const
|
||||
{
|
||||
if (!mClassAttribute.IsAnimated()) {
|
||||
return nullptr;
|
||||
}
|
||||
return mClassAnimAttr;
|
||||
}
|
||||
|
||||
virtual nsIDOMNode* AsDOMNode() MOZ_FINAL MOZ_OVERRIDE { return this; }
|
||||
virtual bool IsTransformable() { return false; }
|
||||
|
@ -6,7 +6,6 @@
|
||||
#include "nsSVGNumber2.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "nsContentUtils.h" // NS_ENSURE_FINITE
|
||||
#include "nsIDOMSVGNumber.h"
|
||||
#include "nsSMILFloatType.h"
|
||||
#include "nsSMILValue.h"
|
||||
#include "nsSVGAttrTearoffTable.h"
|
||||
|
@ -29,107 +29,3 @@ nsXMLElement::WrapNode(JSContext *aCx)
|
||||
}
|
||||
|
||||
NS_IMPL_ELEMENT_CLONE(nsXMLElement)
|
||||
|
||||
nsresult
|
||||
nsXMLElement::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
|
||||
bool aNotify)
|
||||
{
|
||||
nsAutoScriptBlocker scriptBlocker;
|
||||
bool isId = false;
|
||||
if (aAttribute == GetIDAttributeName() &&
|
||||
aNameSpaceID == kNameSpaceID_None) {
|
||||
// Have to do this before clearing flag. See RemoveFromIdTable
|
||||
RemoveFromIdTable();
|
||||
isId = true;
|
||||
}
|
||||
|
||||
nsMutationGuard guard;
|
||||
|
||||
nsresult rv = Element::UnsetAttr(aNameSpaceID, aAttribute, aNotify);
|
||||
|
||||
if (isId &&
|
||||
(!guard.Mutated(0) ||
|
||||
!mNodeInfo->GetIDAttributeAtom() ||
|
||||
!HasAttr(kNameSpaceID_None, GetIDAttributeName()))) {
|
||||
ClearHasID();
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsIAtom *
|
||||
nsXMLElement::GetIDAttributeName() const
|
||||
{
|
||||
return mNodeInfo->GetIDAttributeAtom();
|
||||
}
|
||||
|
||||
nsIAtom*
|
||||
nsXMLElement::DoGetID() const
|
||||
{
|
||||
NS_ASSERTION(HasID(), "Unexpected call");
|
||||
|
||||
const nsAttrValue* attrVal = mAttrsAndChildren.GetAttr(GetIDAttributeName());
|
||||
return attrVal ? attrVal->GetAtomValue() : nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
nsXMLElement::NodeInfoChanged(nsINodeInfo* aOldNodeInfo)
|
||||
{
|
||||
NS_ASSERTION(!IsInDoc() ||
|
||||
aOldNodeInfo->GetDocument() == mNodeInfo->GetDocument(),
|
||||
"Can only change document if we're not inside one");
|
||||
nsIDocument* doc = GetCurrentDoc();
|
||||
|
||||
if (HasID() && doc) {
|
||||
const nsAttrValue* attrVal =
|
||||
mAttrsAndChildren.GetAttr(aOldNodeInfo->GetIDAttributeAtom());
|
||||
if (attrVal) {
|
||||
RemoveFromIdTable(attrVal->GetAtomValue());
|
||||
}
|
||||
}
|
||||
|
||||
ClearHasID();
|
||||
|
||||
nsIAtom* IDName = GetIDAttributeName();
|
||||
if (IDName) {
|
||||
const nsAttrValue* attrVal = mAttrsAndChildren.GetAttr(IDName);
|
||||
if (attrVal) {
|
||||
SetHasID();
|
||||
if (attrVal->Type() == nsAttrValue::eString) {
|
||||
nsString idVal(attrVal->GetStringValue());
|
||||
|
||||
// Create an atom from the value and set it into the attribute list.
|
||||
const_cast<nsAttrValue*>(attrVal)->ParseAtom(idVal);
|
||||
}
|
||||
NS_ASSERTION(attrVal->Type() == nsAttrValue::eAtom,
|
||||
"Should be atom by now");
|
||||
if (doc) {
|
||||
AddToIdTable(attrVal->GetAtomValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
nsXMLElement::ParseAttribute(int32_t aNamespaceID,
|
||||
nsIAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
nsAttrValue& aResult)
|
||||
{
|
||||
if (aAttribute == GetIDAttributeName() &&
|
||||
aNamespaceID == kNameSpaceID_None) {
|
||||
// Store id as an atom. id="" means that the element has no id,
|
||||
// not that it has an emptystring as the id.
|
||||
RemoveFromIdTable();
|
||||
if (aValue.IsEmpty()) {
|
||||
ClearHasID();
|
||||
return false;
|
||||
}
|
||||
aResult.ParseAtom(aValue);
|
||||
SetHasID();
|
||||
AddToIdTable(aResult.GetAtomValue());
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -34,19 +34,6 @@ public:
|
||||
|
||||
virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; }
|
||||
|
||||
// nsIContent interface methods
|
||||
virtual nsIAtom *GetIDAttributeName() const MOZ_OVERRIDE;
|
||||
virtual nsIAtom* DoGetID() const MOZ_OVERRIDE;
|
||||
virtual nsresult UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
|
||||
bool aNotify) MOZ_OVERRIDE;
|
||||
virtual bool ParseAttribute(int32_t aNamespaceID,
|
||||
nsIAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
nsAttrValue& aResult) MOZ_OVERRIDE;
|
||||
|
||||
// Element overrides
|
||||
virtual void NodeInfoChanged(nsINodeInfo* aOldNodeInfo) MOZ_OVERRIDE;
|
||||
|
||||
protected:
|
||||
virtual JSObject* WrapNode(JSContext *aCx) MOZ_OVERRIDE;
|
||||
};
|
||||
|
@ -937,10 +937,9 @@ NS_IMETHODIMP
|
||||
nsXMLContentSink::HandleStartElement(const char16_t *aName,
|
||||
const char16_t **aAtts,
|
||||
uint32_t aAttsCount,
|
||||
int32_t aIndex,
|
||||
uint32_t aLineNumber)
|
||||
{
|
||||
return HandleStartElement(aName, aAtts, aAttsCount, aIndex, aLineNumber,
|
||||
return HandleStartElement(aName, aAtts, aAttsCount, aLineNumber,
|
||||
true);
|
||||
}
|
||||
|
||||
@ -948,11 +947,9 @@ nsresult
|
||||
nsXMLContentSink::HandleStartElement(const char16_t *aName,
|
||||
const char16_t **aAtts,
|
||||
uint32_t aAttsCount,
|
||||
int32_t aIndex,
|
||||
uint32_t aLineNumber,
|
||||
bool aInterruptable)
|
||||
{
|
||||
NS_PRECONDITION(aIndex >= -1, "Bogus aIndex");
|
||||
NS_PRECONDITION(aAttsCount % 2 == 0, "incorrect aAttsCount");
|
||||
// Adjust aAttsCount so it's the actual number of attributes
|
||||
aAttsCount /= 2;
|
||||
@ -998,17 +995,6 @@ nsXMLContentSink::HandleStartElement(const char16_t *aName,
|
||||
result = PushContent(content);
|
||||
NS_ENSURE_SUCCESS(result, result);
|
||||
|
||||
// Set the ID attribute atom on the node info object for this node
|
||||
// This must occur before the attributes are added so the name
|
||||
// of the id attribute is known.
|
||||
if (aIndex != -1 && NS_SUCCEEDED(result)) {
|
||||
nsCOMPtr<nsIAtom> IDAttr = do_GetAtom(aAtts[aIndex]);
|
||||
|
||||
if (IDAttr) {
|
||||
nodeInfo->SetIDAttributeAtom(IDAttr);
|
||||
}
|
||||
}
|
||||
|
||||
// Set the attributes on the new content element
|
||||
result = AddAttributes(aAtts, content);
|
||||
|
||||
@ -1384,7 +1370,7 @@ nsXMLContentSink::ReportError(const char16_t* aErrorText,
|
||||
parsererror.Append((char16_t)0xFFFF);
|
||||
parsererror.AppendLiteral("parsererror");
|
||||
|
||||
rv = HandleStartElement(parsererror.get(), noAtts, 0, -1, (uint32_t)-1,
|
||||
rv = HandleStartElement(parsererror.get(), noAtts, 0, (uint32_t)-1,
|
||||
false);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
@ -1395,7 +1381,7 @@ nsXMLContentSink::ReportError(const char16_t* aErrorText,
|
||||
sourcetext.Append((char16_t)0xFFFF);
|
||||
sourcetext.AppendLiteral("sourcetext");
|
||||
|
||||
rv = HandleStartElement(sourcetext.get(), noAtts, 0, -1, (uint32_t)-1,
|
||||
rv = HandleStartElement(sourcetext.get(), noAtts, 0, (uint32_t)-1,
|
||||
false);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -157,8 +157,7 @@ protected:
|
||||
bool IsMonolithicContainer(nsINodeInfo* aNodeInfo);
|
||||
|
||||
nsresult HandleStartElement(const char16_t *aName, const char16_t **aAtts,
|
||||
uint32_t aAttsCount, int32_t aIndex,
|
||||
uint32_t aLineNumber,
|
||||
uint32_t aAttsCount, uint32_t aLineNumber,
|
||||
bool aInterruptable);
|
||||
nsresult HandleEndElement(const char16_t *aName, bool aInterruptable);
|
||||
nsresult HandleCharacterData(const char16_t *aData, uint32_t aLength,
|
||||
|
@ -336,6 +336,12 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsXULElement,
|
||||
}
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsXULElement,
|
||||
nsStyledElement)
|
||||
// Why aren't we unlinking the prototype?
|
||||
tmp->ClearHasID();
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsXULElement, nsStyledElement)
|
||||
NS_IMPL_RELEASE_INHERITED(nsXULElement, nsStyledElement)
|
||||
|
||||
@ -1503,7 +1509,6 @@ nsXULElement::GetBoxObject(ErrorResult& rv)
|
||||
}
|
||||
|
||||
|
||||
NS_IMPL_XUL_STRING_ATTR(ClassName, _class)
|
||||
NS_IMPL_XUL_STRING_ATTR(Align, align)
|
||||
NS_IMPL_XUL_STRING_ATTR(Dir, dir)
|
||||
NS_IMPL_XUL_STRING_ATTR(Flex, flex)
|
||||
|
@ -379,8 +379,7 @@ public:
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED_NO_UNLINK(nsXULElement,
|
||||
mozilla::dom::Element)
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsXULElement, nsStyledElement)
|
||||
|
||||
// nsINode
|
||||
virtual nsresult PreHandleEvent(
|
||||
|
@ -966,8 +966,7 @@ XULDocument::AttributeWillChange(nsIDocument* aDocument,
|
||||
|
||||
// XXXbz check aNameSpaceID, dammit!
|
||||
// See if we need to update our ref map.
|
||||
if (aAttribute == nsGkAtoms::ref ||
|
||||
(aAttribute == nsGkAtoms::id && !aElement->GetIDAttributeName())) {
|
||||
if (aAttribute == nsGkAtoms::ref) {
|
||||
// Might not need this, but be safe for now.
|
||||
nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this);
|
||||
RemoveElementFromRefMap(aElement);
|
||||
@ -986,8 +985,7 @@ XULDocument::AttributeChanged(nsIDocument* aDocument,
|
||||
|
||||
// XXXbz check aNameSpaceID, dammit!
|
||||
// See if we need to update our ref map.
|
||||
if (aAttribute == nsGkAtoms::ref ||
|
||||
(aAttribute == nsGkAtoms::id && !aElement->GetIDAttributeName())) {
|
||||
if (aAttribute == nsGkAtoms::ref) {
|
||||
AddElementToRefMap(aElement);
|
||||
}
|
||||
|
||||
@ -1927,9 +1925,6 @@ static void
|
||||
GetRefMapAttribute(Element* aElement, nsAutoString* aValue)
|
||||
{
|
||||
aElement->GetAttr(kNameSpaceID_None, nsGkAtoms::ref, *aValue);
|
||||
if (aValue->IsEmpty() && !aElement->GetIDAttributeName()) {
|
||||
aElement->GetAttr(kNameSpaceID_None, nsGkAtoms::id, *aValue);
|
||||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -456,13 +456,11 @@ NS_IMETHODIMP
|
||||
XULContentSinkImpl::HandleStartElement(const char16_t *aName,
|
||||
const char16_t **aAtts,
|
||||
uint32_t aAttsCount,
|
||||
int32_t aIndex,
|
||||
uint32_t aLineNumber)
|
||||
{
|
||||
// XXX Hopefully the parser will flag this before we get here. If
|
||||
// we're in the epilog, there should be no new elements
|
||||
NS_PRECONDITION(mState != eInEpilog, "tag in XUL doc epilog");
|
||||
NS_PRECONDITION(aIndex >= -1, "Bogus aIndex");
|
||||
NS_PRECONDITION(aAttsCount % 2 == 0, "incorrect aAttsCount");
|
||||
// Adjust aAttsCount so it's the actual number of attributes
|
||||
aAttsCount /= 2;
|
||||
@ -503,15 +501,6 @@ XULContentSinkImpl::HandleStartElement(const char16_t *aName,
|
||||
break;
|
||||
}
|
||||
|
||||
// Set the ID attribute atom on the node info object for this node
|
||||
if (aIndex != -1 && NS_SUCCEEDED(rv)) {
|
||||
nsCOMPtr<nsIAtom> IDAttr = do_GetAtom(aAtts[aIndex]);
|
||||
|
||||
if (IDAttr) {
|
||||
nodeInfo->SetIDAttributeAtom(IDAttr);
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
@ -721,7 +710,7 @@ XULContentSinkImpl::ReportError(const char16_t* aErrorText,
|
||||
parsererror.Append((char16_t)0xFFFF);
|
||||
parsererror.AppendLiteral("parsererror");
|
||||
|
||||
rv = HandleStartElement(parsererror.get(), noAtts, 0, -1, 0);
|
||||
rv = HandleStartElement(parsererror.get(), noAtts, 0, 0);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
rv = HandleCharacterData(aErrorText, NS_strlen(aErrorText));
|
||||
@ -731,7 +720,7 @@ XULContentSinkImpl::ReportError(const char16_t* aErrorText,
|
||||
sourcetext.Append((char16_t)0xFFFF);
|
||||
sourcetext.AppendLiteral("sourcetext");
|
||||
|
||||
rv = HandleStartElement(sourcetext.get(), noAtts, 0, -1, 0);
|
||||
rv = HandleStartElement(sourcetext.get(), noAtts, 0, 0);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
rv = HandleCharacterData(aSourceText, NS_strlen(aSourceText));
|
||||
|
@ -5565,11 +5565,19 @@ nsDocShell::GetVisibility(bool * aVisibility)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIContent *shellContent =
|
||||
pPresShell->GetDocument()->FindContentForSubDocument(presShell->GetDocument());
|
||||
NS_ASSERTION(shellContent, "subshell not in the map");
|
||||
vm = presShell->GetViewManager();
|
||||
if (vm) {
|
||||
view = vm->GetRootView();
|
||||
}
|
||||
|
||||
nsIFrame* frame = shellContent ? shellContent->GetPrimaryFrame() : nullptr;
|
||||
if (view) {
|
||||
view = view->GetParent(); // anonymous inner view
|
||||
if (view) {
|
||||
view = view->GetParent(); // subdocumentframe's view
|
||||
}
|
||||
}
|
||||
|
||||
nsIFrame* frame = view ? view->GetFrame() : nullptr;
|
||||
bool isDocShellOffScreen = false;
|
||||
docShell->GetIsOffScreenBrowser(&isDocShellOffScreen);
|
||||
if (frame &&
|
||||
|
@ -82,7 +82,7 @@
|
||||
#endif
|
||||
|
||||
#include "nsIDOMGlobalPropertyInitializer.h"
|
||||
#include "nsIDataStoreService.h"
|
||||
#include "mozilla/dom/DataStoreService.h"
|
||||
#include "nsJSUtils.h"
|
||||
|
||||
#include "nsScriptNameSpaceManager.h"
|
||||
@ -1466,8 +1466,7 @@ Navigator::GetDataStores(nsPIDOMWindow* aWindow,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDataStoreService> service =
|
||||
do_GetService("@mozilla.org/datastore-service;1");
|
||||
nsRefPtr<DataStoreService> service = DataStoreService::GetOrCreate();
|
||||
if (!service) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return nullptr;
|
||||
|
@ -341,7 +341,18 @@ URL::UpdateURLSearchParams()
|
||||
void
|
||||
URL::GetHostname(nsString& aHostname) const
|
||||
{
|
||||
URL_GETTER(aHostname, GetHost);
|
||||
aHostname.Truncate();
|
||||
nsAutoCString tmp;
|
||||
nsresult rv = mURI->GetHost(tmp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
if (tmp.FindChar(':') != -1) { // Escape IPv6 address
|
||||
MOZ_ASSERT(!tmp.Length() ||
|
||||
(tmp[0] !='[' && tmp[tmp.Length() - 1] != ']'));
|
||||
tmp.Insert('[', 0);
|
||||
tmp.Append(']');
|
||||
}
|
||||
CopyUTF8toUTF16(tmp, aHostname);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -49,7 +49,6 @@
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsIDOMWindowUtils.h"
|
||||
#include "nsIDOMGlobalPropertyInitializer.h"
|
||||
#include "nsLocation.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
@ -102,7 +101,6 @@
|
||||
#include "nsIDOMMozCSSKeyframesRule.h"
|
||||
#include "nsIDOMCSSPageRule.h"
|
||||
#include "nsIDOMCSSStyleRule.h"
|
||||
#include "nsIDOMCSSStyleSheet.h"
|
||||
#include "nsIDOMXULCommandDispatcher.h"
|
||||
#include "nsIControllers.h"
|
||||
#include "nsIBoxObject.h"
|
||||
@ -118,8 +116,6 @@
|
||||
#include "nsIDOMXPathNSResolver.h"
|
||||
#include "nsIDOMXPathResult.h"
|
||||
|
||||
#include "nsIDOMSVGNumber.h"
|
||||
|
||||
// Storage includes
|
||||
#include "nsIDOMStorage.h"
|
||||
#include "nsPIDOMStorage.h"
|
||||
@ -306,8 +302,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(CSSNameSpaceRule, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(CSSStyleSheet, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
|
||||
// XUL classes
|
||||
#ifdef MOZ_XUL
|
||||
@ -349,13 +343,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
||||
NS_DEFINE_CLASSINFO_DATA(CSSSupportsRule, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
|
||||
// other SVG classes
|
||||
NS_DEFINE_CLASSINFO_DATA(SVGNumber, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
|
||||
NS_DEFINE_CLASSINFO_DATA(WindowUtils, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
|
||||
NS_DEFINE_CLASSINFO_DATA(XSLTProcessor, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
|
||||
@ -863,10 +850,6 @@ nsDOMClassInfo::Init()
|
||||
#endif
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(WindowUtils, nsIDOMWindowUtils)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowUtils)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(Location, nsIDOMLocation)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMLocation)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
@ -899,10 +882,6 @@ nsDOMClassInfo::Init()
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMCSSRule)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(CSSStyleSheet, nsIDOMCSSStyleSheet)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMCSSStyleSheet)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
#ifdef MOZ_XUL
|
||||
DOM_CLASSINFO_MAP_BEGIN(XULCommandDispatcher, nsIDOMXULCommandDispatcher)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMXULCommandDispatcher)
|
||||
@ -962,13 +941,6 @@ nsDOMClassInfo::Init()
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMCSSSupportsRule)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
// The SVG document
|
||||
|
||||
// other SVG classes
|
||||
DOM_CLASSINFO_MAP_BEGIN(SVGNumber, nsIDOMSVGNumber)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGNumber)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(XSLTProcessor, nsIXSLTProcessor)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIXSLTProcessor)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIXSLTProcessorPrivate)
|
||||
|
@ -15,7 +15,6 @@ DOMCI_CLASS(CSSCharsetRule)
|
||||
DOMCI_CLASS(CSSImportRule)
|
||||
DOMCI_CLASS(CSSMediaRule)
|
||||
DOMCI_CLASS(CSSNameSpaceRule)
|
||||
DOMCI_CLASS(CSSStyleSheet)
|
||||
|
||||
// XUL classes
|
||||
#ifdef MOZ_XUL
|
||||
@ -43,12 +42,6 @@ DOMCI_CLASS(TreeColumn)
|
||||
DOMCI_CLASS(CSSMozDocumentRule)
|
||||
DOMCI_CLASS(CSSSupportsRule)
|
||||
|
||||
// other SVG classes
|
||||
DOMCI_CLASS(SVGNumber)
|
||||
|
||||
// WindowUtils
|
||||
DOMCI_CLASS(WindowUtils)
|
||||
|
||||
// XSLTProcessor
|
||||
DOMCI_CLASS(XSLTProcessor)
|
||||
|
||||
|
@ -103,13 +103,10 @@ class gfxContext;
|
||||
|
||||
static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
|
||||
|
||||
DOMCI_DATA(WindowUtils, nsDOMWindowUtils)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsDOMWindowUtils)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMWindowUtils)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMWindowUtils)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(WindowUtils)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
NS_IMPL_ADDREF(nsDOMWindowUtils)
|
||||
@ -318,8 +315,9 @@ nsDOMWindowUtils::GetViewportInfo(uint32_t aDisplayWidth,
|
||||
*aAllowZoom = info.IsZoomAllowed();
|
||||
*aMinZoom = info.GetMinZoom().scale;
|
||||
*aMaxZoom = info.GetMaxZoom().scale;
|
||||
*aWidth = info.GetSize().width;
|
||||
*aHeight = info.GetSize().height;
|
||||
CSSIntSize size = gfx::RoundedToInt(info.GetSize());
|
||||
*aWidth = size.width;
|
||||
*aHeight = size.height;
|
||||
*aAutoSize = info.IsAutoSizeEnabled();
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -2188,6 +2188,48 @@ TreatAsRemoteXUL(nsIPrincipal* aPrincipal)
|
||||
!Preferences::GetBool("dom.use_xbl_scopes_for_remote_xul", false);
|
||||
}
|
||||
|
||||
static bool
|
||||
EnablePrivilege(JSContext* cx, unsigned argc, JS::Value* vp)
|
||||
{
|
||||
Telemetry::Accumulate(Telemetry::ENABLE_PRIVILEGE_EVER_CALLED, true);
|
||||
return xpc::EnableUniversalXPConnect(cx);
|
||||
}
|
||||
|
||||
static const JSFunctionSpec EnablePrivilegeSpec[] = {
|
||||
JS_FS("enablePrivilege", EnablePrivilege, 1, 0),
|
||||
JS_FS_END
|
||||
};
|
||||
|
||||
static bool
|
||||
InitializeLegacyNetscapeObject(JSContext* aCx, JS::Handle<JSObject*> aGlobal)
|
||||
{
|
||||
JSAutoCompartment ac(aCx, aGlobal);
|
||||
|
||||
// Note: MathJax depends on window.netscape being exposed. See bug 791526.
|
||||
JS::Rooted<JSObject*> obj(aCx);
|
||||
obj = JS_DefineObject(aCx, aGlobal, "netscape", nullptr);
|
||||
NS_ENSURE_TRUE(obj, false);
|
||||
|
||||
obj = JS_DefineObject(aCx, obj, "security", nullptr);
|
||||
NS_ENSURE_TRUE(obj, false);
|
||||
|
||||
// We hide enablePrivilege behind a pref because it has been altered in a
|
||||
// way that makes it fundamentally insecure to use in production. Mozilla
|
||||
// uses this pref during automated testing to support legacy test code that
|
||||
// uses enablePrivilege. If you're not doing test automation, you _must_ not
|
||||
// flip this pref, or you will be exposing all your users to security
|
||||
// vulnerabilities.
|
||||
if (!Preferences::GetBool("security.turn_off_all_security_so_that_viruses_can_take_over_this_computer")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Define PrivilegeManager object with the necessary "static" methods. */
|
||||
obj = JS_DefineObject(aCx, obj, "PrivilegeManager", nullptr);
|
||||
NS_ENSURE_TRUE(obj, false);
|
||||
|
||||
return JS_DefineFunctions(aCx, obj, EnablePrivilegeSpec);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new global object that will be used for an inner window.
|
||||
* Return the native global and an nsISupports 'holder' that can be used
|
||||
@ -2251,6 +2293,10 @@ CreateNativeGlobalForInner(JSContext* aCx,
|
||||
// about:memory may use that information
|
||||
xpc::SetLocationForGlobal(aGlobal, aURI);
|
||||
|
||||
if (!InitializeLegacyNetscapeObject(aCx, aGlobal)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1657,8 +1657,10 @@ nsJSContext::InitClasses(JS::Handle<JSObject*> aGlobalObj)
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_DMD
|
||||
// Attempt to initialize DMD functions
|
||||
::JS_DefineFunctions(cx, aGlobalObj, DMDFunctions);
|
||||
if (nsContentUtils::IsCallerChrome()) {
|
||||
// Attempt to initialize DMD functions
|
||||
::JS_DefineFunctions(cx, aGlobalObj, DMDFunctions);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_JPROF
|
||||
|
@ -292,5 +292,32 @@
|
||||
url.hostname = "";
|
||||
is(url.href, "http://localhost/", "Empty hostname is ignored");
|
||||
</script>
|
||||
|
||||
<script>
|
||||
/** Test for Bug 960014 **/
|
||||
var url = new URL("http://localhost/");
|
||||
url.hostname = "[2001::1]";
|
||||
is(url.hostname, "[2001::1]", "IPv6 hostname");
|
||||
is(url.href, "http://[2001::1]/");
|
||||
|
||||
url.hostname = "[::192.9.5.5]";
|
||||
is(url.hostname, "[::192.9.5.5]", "IPv6 hostname");
|
||||
is(url.href, "http://[::192.9.5.5]/");
|
||||
|
||||
url = new URL("http://localhost/");
|
||||
url.hostname = "[::]";
|
||||
is(url.hostname, "[::]", "IPv6 hostname");
|
||||
|
||||
url = new URL("http://localhost/");
|
||||
url.host = "[2001::1]:30";
|
||||
is(url.hostname, "[2001::1]", "IPv6 hostname");
|
||||
is(url.port, 30, "Port");
|
||||
is(url.host, "[2001::1]:30", "IPv6 host");
|
||||
|
||||
url = new URL("http://localhost/");
|
||||
// This should silently fail since it's missing the brackets
|
||||
url.hostname = "2001::1";
|
||||
is(url.hostname, "localhost", "Setting bad hostname fails");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1141,6 +1141,11 @@ DOMInterfaces = {
|
||||
'headerFile': 'mozilla/dom/SVGGradientElement.h',
|
||||
},
|
||||
|
||||
'SVGNumber': {
|
||||
'nativeType': 'mozilla::DOMSVGNumber',
|
||||
'headerFile': 'DOMSVGNumber.h',
|
||||
},
|
||||
|
||||
'SVGNumberList': {
|
||||
'nativeType': 'mozilla::DOMSVGNumberList',
|
||||
'headerFile': 'DOMSVGNumberList.h'
|
||||
@ -1987,7 +1992,6 @@ addExternalIface('Principal', nativeType='nsIPrincipal',
|
||||
headerFile='nsIPrincipal.h', notflattened=True)
|
||||
addExternalIface('StackFrame', nativeType='nsIStackFrame',
|
||||
headerFile='nsIException.h', notflattened=True)
|
||||
addExternalIface('SVGNumber')
|
||||
addExternalIface('URI', nativeType='nsIURI', headerFile='nsIURI.h',
|
||||
notflattened=True)
|
||||
addExternalIface('UserDataHandler')
|
||||
|
@ -1,2 +1,2 @@
|
||||
component {d193d0e2-c677-4a7b-bb0a-19155b470f2e} DataStoreService.js
|
||||
contract @mozilla.org/datastore-service;1 {d193d0e2-c677-4a7b-bb0a-19155b470f2e}
|
||||
component {db5c9602-030f-4bff-a3de-881a8de370f2} DataStoreImpl.js
|
||||
contract @mozilla.org/dom/datastore;1 {db5c9602-030f-4bff-a3de-881a8de370f2}
|
||||
|
48
dom/datastore/DataStoreCallbacks.h
Normal file
48
dom/datastore/DataStoreCallbacks.h
Normal file
@ -0,0 +1,48 @@
|
||||
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
|
||||
/* vim: set ts=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_DataStoreCallbacks_h
|
||||
#define mozilla_dom_DataStoreCallbacks_h
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class DataStoreDB;
|
||||
|
||||
class DataStoreDBCallback
|
||||
{
|
||||
public:
|
||||
NS_IMETHOD_(MozExternalRefCountType) AddRef(void) = 0;
|
||||
NS_IMETHOD_(MozExternalRefCountType) Release(void) = 0;
|
||||
|
||||
virtual void Run(DataStoreDB* aDb, bool aSuccess) = 0;
|
||||
|
||||
protected:
|
||||
virtual ~DataStoreDBCallback()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class DataStoreRevisionCallback
|
||||
{
|
||||
public:
|
||||
NS_IMETHOD_(MozExternalRefCountType) AddRef(void) = 0;
|
||||
NS_IMETHOD_(MozExternalRefCountType) Release(void) = 0;
|
||||
|
||||
virtual void Run(const nsAString& aRevisionID) = 0;
|
||||
|
||||
protected:
|
||||
virtual ~DataStoreRevisionCallback()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
} // dom namespace
|
||||
} // mozilla namespace
|
||||
|
||||
#endif // mozilla_dom_DataStoreCallbacks_h
|
@ -12,9 +12,6 @@ function debug(s) {
|
||||
//dump('DEBUG DataStoreChangeNotifier: ' + s + '\n');
|
||||
}
|
||||
|
||||
// DataStoreServiceInternal should not be converted into a lazy getter as it
|
||||
// runs code during initialization.
|
||||
Cu.import('resource://gre/modules/DataStoreServiceInternal.jsm');
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
|
319
dom/datastore/DataStoreDB.cpp
Normal file
319
dom/datastore/DataStoreDB.cpp
Normal file
@ -0,0 +1,319 @@
|
||||
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
|
||||
/* vim: set ts=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 "DataStoreDB.h"
|
||||
|
||||
#include "DataStoreCallbacks.h"
|
||||
#include "mozilla/dom/IDBDatabaseBinding.h"
|
||||
#include "mozilla/dom/IDBFactoryBinding.h"
|
||||
#include "mozilla/dom/indexedDB/IDBDatabase.h"
|
||||
#include "mozilla/dom/indexedDB/IDBFactory.h"
|
||||
#include "mozilla/dom/indexedDB/IDBIndex.h"
|
||||
#include "mozilla/dom/indexedDB/IDBObjectStore.h"
|
||||
#include "mozilla/dom/indexedDB/IDBRequest.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
|
||||
#define DATASTOREDB_VERSION 1
|
||||
#define DATASTOREDB_NAME "DataStoreDB"
|
||||
#define DATASTOREDB_REVISION_INDEX "revisionIndex"
|
||||
|
||||
using namespace mozilla::dom::indexedDB;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
NS_IMPL_ISUPPORTS(DataStoreDB, nsIDOMEventListener)
|
||||
|
||||
DataStoreDB::DataStoreDB(const nsAString& aManifestURL, const nsAString& aName)
|
||||
: mState(Inactive)
|
||||
{
|
||||
mDatabaseName.Assign(aName);
|
||||
mDatabaseName.AppendASCII("|");
|
||||
mDatabaseName.Append(aManifestURL);
|
||||
}
|
||||
|
||||
DataStoreDB::~DataStoreDB()
|
||||
{
|
||||
}
|
||||
|
||||
nsresult
|
||||
DataStoreDB::CreateFactoryIfNeeded()
|
||||
{
|
||||
if (!mFactory) {
|
||||
nsresult rv = IDBFactory::Create(nullptr, getter_AddRefs(mFactory));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
DataStoreDB::Open(IDBTransactionMode aMode, const Sequence<nsString>& aDbs,
|
||||
DataStoreDBCallback* aCallback)
|
||||
{
|
||||
MOZ_ASSERT(mState == Inactive);
|
||||
|
||||
nsresult rv = CreateFactoryIfNeeded();
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
ErrorResult error;
|
||||
mRequest = mFactory->Open(mDatabaseName, DATASTOREDB_VERSION, error);
|
||||
if (NS_WARN_IF(error.Failed())) {
|
||||
return error.ErrorCode();
|
||||
}
|
||||
|
||||
rv = AddEventListeners();
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
mState = Active;
|
||||
mTransactionMode = aMode;
|
||||
mObjectStores = aDbs;
|
||||
mCallback = aCallback;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
DataStoreDB::HandleEvent(nsIDOMEvent* aEvent)
|
||||
{
|
||||
nsString type;
|
||||
nsresult rv = aEvent->GetType(type);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
if (type.EqualsASCII("success")) {
|
||||
RemoveEventListeners();
|
||||
mState = Inactive;
|
||||
|
||||
rv = DatabaseOpened();
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
mCallback->Run(this, false);
|
||||
} else {
|
||||
mCallback->Run(this, true);
|
||||
}
|
||||
|
||||
mRequest = nullptr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (type.EqualsASCII("upgradeneeded")) {
|
||||
return UpgradeSchema();
|
||||
}
|
||||
|
||||
if (type.EqualsASCII("error") || type.EqualsASCII("blocked")) {
|
||||
RemoveEventListeners();
|
||||
mState = Inactive;
|
||||
mCallback->Run(this, false);
|
||||
mRequest = nullptr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
MOZ_ASSUME_UNREACHABLE("This should not happen");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
DataStoreDB::UpgradeSchema()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
AutoSafeJSContext cx;
|
||||
|
||||
ErrorResult error;
|
||||
JS::Rooted<JS::Value> result(cx, mRequest->GetResult(error));
|
||||
if (NS_WARN_IF(error.Failed())) {
|
||||
return error.ErrorCode();
|
||||
}
|
||||
|
||||
MOZ_ASSERT(result.isObject());
|
||||
|
||||
IDBDatabase* database = nullptr;
|
||||
nsresult rv = UNWRAP_OBJECT(IDBDatabase, &result.toObject(), database);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("Didn't get the object we expected!");
|
||||
return rv;
|
||||
}
|
||||
|
||||
{
|
||||
RootedDictionary<IDBObjectStoreParameters> params(cx);
|
||||
params.Init(NS_LITERAL_STRING("{ \"autoIncrement\": true }"));
|
||||
nsRefPtr<IDBObjectStore> store =
|
||||
database->CreateObjectStore(cx, NS_LITERAL_STRING(DATASTOREDB_NAME),
|
||||
params, error);
|
||||
if (NS_WARN_IF(error.Failed())) {
|
||||
return error.ErrorCode();
|
||||
}
|
||||
}
|
||||
|
||||
nsRefPtr<IDBObjectStore> store;
|
||||
|
||||
{
|
||||
RootedDictionary<IDBObjectStoreParameters> params(cx);
|
||||
params.Init(NS_LITERAL_STRING("{ \"autoIncrement\": true, \"keyPath\": \"internalRevisionId\" }"));
|
||||
|
||||
store =
|
||||
database->CreateObjectStore(cx, NS_LITERAL_STRING(DATASTOREDB_REVISION),
|
||||
params, error);
|
||||
if (NS_WARN_IF(error.Failed())) {
|
||||
return error.ErrorCode();
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
RootedDictionary<IDBIndexParameters> params(cx);
|
||||
params.Init(NS_LITERAL_STRING("{ \"unique\": true }"));
|
||||
nsRefPtr<IDBIndex> index =
|
||||
store->CreateIndex(cx, NS_LITERAL_STRING(DATASTOREDB_REVISION_INDEX),
|
||||
NS_LITERAL_STRING("revisionId"), params, error);
|
||||
if (NS_WARN_IF(error.Failed())) {
|
||||
return error.ErrorCode();
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
DataStoreDB::DatabaseOpened()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
AutoSafeJSContext cx;
|
||||
|
||||
ErrorResult error;
|
||||
JS::Rooted<JS::Value> result(cx, mRequest->GetResult(error));
|
||||
if (NS_WARN_IF(error.Failed())) {
|
||||
return error.ErrorCode();
|
||||
}
|
||||
|
||||
MOZ_ASSERT(result.isObject());
|
||||
|
||||
nsresult rv = UNWRAP_OBJECT(IDBDatabase, &result.toObject(), mDatabase);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("Didn't get the object we expected!");
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsRefPtr<IDBTransaction> txn = mDatabase->Transaction(mObjectStores,
|
||||
mTransactionMode,
|
||||
error);
|
||||
if (NS_WARN_IF(error.Failed())) {
|
||||
return error.ErrorCode();
|
||||
}
|
||||
|
||||
mTransaction = txn.forget();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
DataStoreDB::Delete()
|
||||
{
|
||||
MOZ_ASSERT(mState == Inactive);
|
||||
|
||||
nsresult rv = CreateFactoryIfNeeded();
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
mTransaction = nullptr;
|
||||
|
||||
if (mDatabase) {
|
||||
rv = mDatabase->Close();
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
mDatabase = nullptr;
|
||||
}
|
||||
|
||||
ErrorResult error;
|
||||
nsRefPtr<IDBOpenDBRequest> request =
|
||||
mFactory->DeleteDatabase(mDatabaseName, IDBOpenDBOptions(), error);
|
||||
if (NS_WARN_IF(error.Failed())) {
|
||||
return error.ErrorCode();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
indexedDB::IDBTransaction*
|
||||
DataStoreDB::Transaction() const
|
||||
{
|
||||
MOZ_ASSERT(mTransaction);
|
||||
MOZ_ASSERT(mTransaction->IsOpen());
|
||||
return mTransaction;
|
||||
}
|
||||
|
||||
nsresult
|
||||
DataStoreDB::AddEventListeners()
|
||||
{
|
||||
nsresult rv;
|
||||
rv = mRequest->EventTarget::AddEventListener(NS_LITERAL_STRING("success"),
|
||||
this, false);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
rv = mRequest->EventTarget::AddEventListener(NS_LITERAL_STRING("upgradeneeded"),
|
||||
this, false);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
rv = mRequest->EventTarget::AddEventListener(NS_LITERAL_STRING("error"),
|
||||
this, false);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
rv = mRequest->EventTarget::AddEventListener(NS_LITERAL_STRING("blocked"),
|
||||
this, false);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
DataStoreDB::RemoveEventListeners()
|
||||
{
|
||||
nsresult rv;
|
||||
rv = mRequest->RemoveEventListener(NS_LITERAL_STRING("success"),
|
||||
this, false);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
rv = mRequest->RemoveEventListener(NS_LITERAL_STRING("upgradeneeded"),
|
||||
this, false);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
rv = mRequest->RemoveEventListener(NS_LITERAL_STRING("error"),
|
||||
this, false);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
rv = mRequest->RemoveEventListener(NS_LITERAL_STRING("blocked"),
|
||||
this, false);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
82
dom/datastore/DataStoreDB.h
Normal file
82
dom/datastore/DataStoreDB.h
Normal file
@ -0,0 +1,82 @@
|
||||
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
|
||||
/* vim: set ts=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_DataStoreDB_h
|
||||
#define mozilla_dom_DataStoreDB_h
|
||||
|
||||
#include "mozilla/dom/IDBTransactionBinding.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "nsISupportsImpl.h"
|
||||
#include "nsString.h"
|
||||
|
||||
#define DATASTOREDB_REVISION "revision"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
namespace indexedDB {
|
||||
class IDBDatabase;
|
||||
class IDBFactory;
|
||||
class IDBObjectStore;
|
||||
class IDBOpenDBRequest;
|
||||
class IDBTransaction;
|
||||
}
|
||||
|
||||
class DataStoreDBCallback;
|
||||
|
||||
class DataStoreDB MOZ_FINAL : public nsIDOMEventListener
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
DataStoreDB(const nsAString& aManifestURL, const nsAString& aName);
|
||||
~DataStoreDB();
|
||||
|
||||
nsresult Open(IDBTransactionMode aMode, const Sequence<nsString>& aDb,
|
||||
DataStoreDBCallback* aCallback);
|
||||
|
||||
nsresult Delete();
|
||||
|
||||
indexedDB::IDBTransaction* Transaction() const;
|
||||
|
||||
// nsIDOMEventListener
|
||||
NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent);
|
||||
|
||||
private:
|
||||
nsresult CreateFactoryIfNeeded();
|
||||
|
||||
nsresult UpgradeSchema();
|
||||
|
||||
nsresult DatabaseOpened();
|
||||
|
||||
nsresult AddEventListeners();
|
||||
|
||||
nsresult RemoveEventListeners();
|
||||
|
||||
nsString mDatabaseName;
|
||||
|
||||
nsRefPtr<indexedDB::IDBFactory> mFactory;
|
||||
nsRefPtr<indexedDB::IDBOpenDBRequest> mRequest;
|
||||
nsRefPtr<indexedDB::IDBDatabase> mDatabase;
|
||||
nsRefPtr<indexedDB::IDBTransaction> mTransaction;
|
||||
|
||||
nsRefPtr<DataStoreDBCallback> mCallback;
|
||||
|
||||
// Internal state to avoid strange use of this class.
|
||||
enum StateType {
|
||||
Inactive,
|
||||
Active
|
||||
} mState;
|
||||
|
||||
IDBTransactionMode mTransactionMode;
|
||||
Sequence<nsString> mObjectStores;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_dom_DataStoreDB_h
|
@ -6,8 +6,6 @@
|
||||
|
||||
'use strict'
|
||||
|
||||
this.EXPORTED_SYMBOLS = ["DataStore"];
|
||||
|
||||
function debug(s) {
|
||||
//dump('DEBUG DataStore: ' + s + '\n');
|
||||
}
|
||||
@ -59,17 +57,16 @@ function validateId(aId) {
|
||||
}
|
||||
|
||||
/* DataStore object */
|
||||
this.DataStore = function(aWindow, aName, aOwner, aReadOnly) {
|
||||
function DataStore() {
|
||||
debug("DataStore created");
|
||||
this.init(aWindow, aName, aOwner, aReadOnly);
|
||||
}
|
||||
|
||||
this.DataStore.prototype = {
|
||||
DataStore.prototype = {
|
||||
classDescription: "DataStore XPCOM Component",
|
||||
classID: Components.ID("{db5c9602-030f-4bff-a3de-881a8de370f2}"),
|
||||
contractID: "@mozilla.org/dom/datastore-impl;1",
|
||||
QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsISupports,
|
||||
Components.interfaces.nsIObserver]),
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIDataStore, Ci.nsISupports,
|
||||
Ci.nsIObserver]),
|
||||
|
||||
callbacks: [],
|
||||
|
||||
@ -536,3 +533,5 @@ this.DataStore.prototype = {
|
||||
return exposedCursor;
|
||||
}
|
||||
};
|
||||
|
||||
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([DataStore]);
|
102
dom/datastore/DataStoreRevision.cpp
Normal file
102
dom/datastore/DataStoreRevision.cpp
Normal file
@ -0,0 +1,102 @@
|
||||
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
|
||||
/* vim: set ts=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 "DataStoreRevision.h"
|
||||
|
||||
#include "DataStoreCallbacks.h"
|
||||
#include "DataStoreService.h"
|
||||
#include "mozilla/dom/DataStoreBinding.h"
|
||||
#include "mozilla/dom/indexedDB/IDBObjectStore.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
using namespace indexedDB;
|
||||
|
||||
NS_IMPL_ISUPPORTS(DataStoreRevision, nsIDOMEventListener)
|
||||
|
||||
// Note: this code in it must not assume anything about the compartment cx is
|
||||
// in.
|
||||
nsresult
|
||||
DataStoreRevision::AddRevision(JSContext* aCx,
|
||||
IDBObjectStore* aStore,
|
||||
uint32_t aObjectId,
|
||||
RevisionType aRevisionType,
|
||||
DataStoreRevisionCallback* aCallback)
|
||||
{
|
||||
MOZ_ASSERT(aStore);
|
||||
MOZ_ASSERT(aCallback);
|
||||
|
||||
nsRefPtr<DataStoreService> service = DataStoreService::Get();
|
||||
if (!service) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsString id;
|
||||
nsresult rv = service->GenerateUUID(mRevisionID);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
DataStoreRevisionData data;
|
||||
data.mRevisionId = mRevisionID;
|
||||
data.mObjectId = aObjectId;
|
||||
|
||||
switch (aRevisionType) {
|
||||
case RevisionVoid:
|
||||
data.mOperation = NS_LITERAL_STRING("void");
|
||||
break;
|
||||
|
||||
default:
|
||||
MOZ_ASSUME_UNREACHABLE("This should not happen");
|
||||
break;
|
||||
}
|
||||
|
||||
JS::Rooted<JS::Value> value(aCx);
|
||||
if (!data.ToObject(aCx, &value)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
ErrorResult error;
|
||||
mRequest = aStore->Put(aCx, value, JS::UndefinedHandleValue, error);
|
||||
if (NS_WARN_IF(error.Failed())) {
|
||||
return error.ErrorCode();
|
||||
}
|
||||
|
||||
rv = mRequest->EventTarget::AddEventListener(NS_LITERAL_STRING("success"),
|
||||
this, false);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
mCallback = aCallback;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
DataStoreRevision::HandleEvent(nsIDOMEvent* aEvent)
|
||||
{
|
||||
nsString type;
|
||||
nsresult rv = aEvent->GetType(type);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
if (!type.EqualsASCII("success")) {
|
||||
MOZ_ASSUME_UNREACHABLE("This should not happen");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
mRequest->RemoveEventListener(NS_LITERAL_STRING("success"), this, false);
|
||||
mRequest = nullptr;
|
||||
|
||||
mCallback->Run(mRevisionID);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
} // dom namespace
|
||||
} // mozilla namespace
|
52
dom/datastore/DataStoreRevision.h
Normal file
52
dom/datastore/DataStoreRevision.h
Normal file
@ -0,0 +1,52 @@
|
||||
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
|
||||
/* vim: set ts=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_DataStoreRevision_h
|
||||
#define mozilla_dom_DataStoreRevision_h
|
||||
|
||||
#include "jsapi.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "nsString.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
namespace indexedDB {
|
||||
class IDBObjectStore;
|
||||
class IDBRequest;
|
||||
}
|
||||
|
||||
class DataStoreRevisionCallback;
|
||||
|
||||
class DataStoreRevision MOZ_FINAL : public nsIDOMEventListener
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
enum RevisionType {
|
||||
RevisionVoid
|
||||
};
|
||||
|
||||
nsresult AddRevision(JSContext* aCx,
|
||||
indexedDB::IDBObjectStore* aStore,
|
||||
uint32_t aObjectId,
|
||||
RevisionType aRevisionType,
|
||||
DataStoreRevisionCallback* aCallback);
|
||||
|
||||
// nsIDOMEventListener
|
||||
NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent);
|
||||
|
||||
private:
|
||||
nsRefPtr<DataStoreRevisionCallback> mCallback;
|
||||
nsRefPtr<indexedDB::IDBRequest> mRequest;
|
||||
nsString mRevisionID;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_dom_DataStoreRevision_h
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user