mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge from mozilla-central.
This commit is contained in:
commit
d6601dffce
@ -12,6 +12,7 @@
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsTObserverArray.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
|
||||
class Accessible;
|
||||
class nsIAccessibleTraversalRule;
|
||||
@ -23,7 +24,7 @@ NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GENERAL, 0x26)
|
||||
/**
|
||||
* Class represents an accessible pivot.
|
||||
*/
|
||||
class nsAccessiblePivot: public nsIAccessiblePivot
|
||||
class nsAccessiblePivot MOZ_FINAL : public nsIAccessiblePivot
|
||||
{
|
||||
public:
|
||||
nsAccessiblePivot(Accessible* aRoot);
|
||||
|
@ -918,6 +918,7 @@ public:
|
||||
static const PRUint32 kControl = 2;
|
||||
static const PRUint32 kAlt = 4;
|
||||
static const PRUint32 kMeta = 8;
|
||||
static const PRUint32 kOS = 16;
|
||||
|
||||
KeyBinding() : mKey(0), mModifierMask(0) {}
|
||||
KeyBinding(PRUint32 aKey, PRUint32 aModifierMask) :
|
||||
|
@ -766,7 +766,7 @@ HTMLTableAccessible::ColExtentAt(PRUint32 aRowIdx, PRUint32 aColIdx)
|
||||
bool isSelected;
|
||||
PRInt32 columnExtent = 0;
|
||||
|
||||
nsresult rv = tableLayout->
|
||||
tableLayout->
|
||||
GetCellDataAt(aRowIdx, aColIdx, *getter_AddRefs(domElement),
|
||||
startRowIndex, startColIndex, rowSpan, colSpan,
|
||||
actualRowSpan, columnExtent, isSelected);
|
||||
@ -786,7 +786,7 @@ HTMLTableAccessible::RowExtentAt(PRUint32 aRowIdx, PRUint32 aColIdx)
|
||||
bool isSelected;
|
||||
PRInt32 rowExtent = 0;
|
||||
|
||||
nsresult rv = tableLayout->
|
||||
tableLayout->
|
||||
GetCellDataAt(aRowIdx, aColIdx, *getter_AddRefs(domElement),
|
||||
startRowIndex, startColIndex, rowSpan, colSpan,
|
||||
rowExtent, actualColSpan, isSelected);
|
||||
|
@ -184,6 +184,9 @@ XULMenuitemAccessible::AccessKey() const
|
||||
case nsIDOMKeyEvent::DOM_VK_META:
|
||||
modifierKey = KeyBinding::kMeta;
|
||||
break;
|
||||
case nsIDOMKeyEvent::DOM_VK_WIN:
|
||||
modifierKey = KeyBinding::kOS;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -226,6 +229,8 @@ XULMenuitemAccessible::KeyboardShortcut() const
|
||||
modifierMask |= KeyBinding::kAlt;
|
||||
if (modifiersStr.Find("meta") != -1)
|
||||
modifierMask |= KeyBinding::kMeta;
|
||||
if (modifiersStr.Find("os") != -1)
|
||||
modifierMask |= KeyBinding::kOS;
|
||||
if (modifiersStr.Find("control") != -1)
|
||||
modifierMask |= KeyBinding::kControl;
|
||||
if (modifiersStr.Find("accel") != -1) {
|
||||
@ -235,6 +240,10 @@ XULMenuitemAccessible::KeyboardShortcut() const
|
||||
modifierMask |= KeyBinding::kMeta;
|
||||
break;
|
||||
|
||||
case nsIDOMKeyEvent::DOM_VK_WIN:
|
||||
modifierMask |= KeyBinding::kOS;
|
||||
break;
|
||||
|
||||
case nsIDOMKeyEvent::DOM_VK_ALT:
|
||||
modifierMask |= KeyBinding::kAlt;
|
||||
break;
|
||||
|
@ -58,14 +58,17 @@ function addPermissions(urls) {
|
||||
'content-camera', 'webcontacts-manage', 'wifi-manage', 'desktop-notification',
|
||||
'geolocation', 'device-storage', 'alarms'
|
||||
];
|
||||
|
||||
urls.forEach(function(url) {
|
||||
url = url.trim();
|
||||
let uri = Services.io.newURI(url, null, null);
|
||||
let allow = Ci.nsIPermissionManager.ALLOW_ACTION;
|
||||
if (url) {
|
||||
let uri = Services.io.newURI(url, null, null);
|
||||
let allow = Ci.nsIPermissionManager.ALLOW_ACTION;
|
||||
|
||||
permissions.forEach(function(permission) {
|
||||
Services.perms.add(uri, permission, allow);
|
||||
});
|
||||
permissions.forEach(function(permission) {
|
||||
Services.perms.add(uri, permission, allow);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -204,11 +204,11 @@
|
||||
<key>NSAppleScriptEnabled</key>
|
||||
<true/>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>10.5</string>
|
||||
<string>10.6</string>
|
||||
<key>LSMinimumSystemVersionByArchitecture</key>
|
||||
<dict>
|
||||
<key>i386</key>
|
||||
<string>10.5.0</string>
|
||||
<string>10.6.0</string>
|
||||
<key>x86_64</key>
|
||||
<string>10.6.0</string>
|
||||
</dict>
|
||||
|
@ -711,9 +711,9 @@ function test_cancel_restart() {
|
||||
|
||||
// Close the notification
|
||||
let anchor = document.getElementById("addons-notification-icon");
|
||||
EventUtils.synthesizeMouseAtCenter(anchor, {});
|
||||
anchor.click();
|
||||
// Reopen the notification
|
||||
EventUtils.synthesizeMouseAtCenter(anchor, {});
|
||||
anchor.click();
|
||||
|
||||
ok(PopupNotifications.isPanelOpen, "Notification should still be open");
|
||||
is(PopupNotifications.panel.childNodes.length, 1, "Should be only one notification");
|
||||
|
@ -738,6 +738,10 @@ function triggerSecondaryCommand(popup, index) {
|
||||
ok(notifications.length > 0, "at least one notification displayed");
|
||||
let notification = notifications[0];
|
||||
|
||||
// Cancel the arrow panel slide-in transition (bug 767133) such that
|
||||
// it won't interfere with us interacting with the dropdown.
|
||||
document.getAnonymousNodes(popup)[0].style.transition = "none";
|
||||
|
||||
notification.button.focus();
|
||||
|
||||
popup.addEventListener("popupshown", function () {
|
||||
|
@ -473,7 +473,7 @@ function openAboutDialog() {
|
||||
|
||||
function openPreferences(paneID, extraArgs)
|
||||
{
|
||||
if (Services.prefs.getBoolPref("browser.preferences.inContent")) {
|
||||
if (Services.prefs.getBoolPref("browser.preferences.inContent")) {
|
||||
openUILinkIn("about:preferences", "tab");
|
||||
} else {
|
||||
var instantApply = getBoolPref("browser.preferences.instantApply", false);
|
||||
@ -492,17 +492,17 @@ function openPreferences(paneID, extraArgs)
|
||||
advancedPaneTabs.selectedTab = win.document.getElementById(extraArgs["advancedTab"]);
|
||||
}
|
||||
|
||||
return win;
|
||||
return;
|
||||
}
|
||||
|
||||
return openDialog("chrome://browser/content/preferences/preferences.xul",
|
||||
"Preferences", features, paneID, extraArgs);
|
||||
openDialog("chrome://browser/content/preferences/preferences.xul",
|
||||
"Preferences", features, paneID, extraArgs);
|
||||
}
|
||||
}
|
||||
|
||||
function openAdvancedPreferences(tabID)
|
||||
{
|
||||
return openPreferences("paneAdvanced", { "advancedTab" : tabID });
|
||||
openPreferences("paneAdvanced", { "advancedTab" : tabID });
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -25,7 +25,7 @@
|
||||
return flip++ == 0 ? chromeUrl : exploitUrl;
|
||||
};
|
||||
|
||||
var href = Components.lookupMethod(frames[1].location, "href");
|
||||
var href = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(frames[1].location), "href").get;
|
||||
var loadChrome = { handleEvent: href };
|
||||
var loadExploit = { handleEvent: href };
|
||||
|
||||
|
@ -149,6 +149,8 @@ ScriptsView.prototype = {
|
||||
*/
|
||||
empty: function DVS_empty() {
|
||||
this._scripts.selectedIndex = -1;
|
||||
this._scripts.setAttribute("label", L10N.getStr("noScriptsText"));
|
||||
this._scripts.removeAttribute("tooltiptext");
|
||||
|
||||
while (this._scripts.firstChild) {
|
||||
this._scripts.removeChild(this._scripts.firstChild);
|
||||
@ -425,9 +427,9 @@ ScriptsView.prototype = {
|
||||
return;
|
||||
}
|
||||
|
||||
let script = selectedItem.getUserData("sourceScript");
|
||||
this._preferredScript = script;
|
||||
DebuggerController.SourceScripts.showScript(script);
|
||||
this._preferredScript = selectedItem;
|
||||
this._scripts.setAttribute("tooltiptext", selectedItem.value);
|
||||
DebuggerController.SourceScripts.showScript(selectedItem.getUserData("sourceScript"));
|
||||
},
|
||||
|
||||
/**
|
||||
@ -438,8 +440,15 @@ ScriptsView.prototype = {
|
||||
let scripts = this._scripts;
|
||||
let [file, line, token] = this._getSearchboxInfo();
|
||||
|
||||
// If the webpage has no scripts, searching is redundant.
|
||||
if (!scripts.itemCount) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Presume we won't find anything.
|
||||
scripts.selectedItem = this._preferredScript;
|
||||
scripts.setAttribute("label", this._preferredScript.label);
|
||||
scripts.setAttribute("tooltiptext", this._preferredScript.value);
|
||||
|
||||
// If we're not searching for a file anymore, unhide all the scripts.
|
||||
if (!file) {
|
||||
@ -447,7 +456,9 @@ ScriptsView.prototype = {
|
||||
scripts.getItemAtIndex(i).hidden = false;
|
||||
}
|
||||
} else {
|
||||
for (let i = 0, l = scripts.itemCount, found = false; i < l; i++) {
|
||||
let found = false;
|
||||
|
||||
for (let i = 0, l = scripts.itemCount; i < l; i++) {
|
||||
let item = scripts.getItemAtIndex(i);
|
||||
let target = item.label.toLowerCase();
|
||||
|
||||
@ -458,6 +469,8 @@ ScriptsView.prototype = {
|
||||
if (!found) {
|
||||
found = true;
|
||||
scripts.selectedItem = item;
|
||||
scripts.setAttribute("label", item.label);
|
||||
scripts.setAttribute("tooltiptext", item.value);
|
||||
}
|
||||
}
|
||||
// Hide what doesn't match our search.
|
||||
@ -465,6 +478,10 @@ ScriptsView.prototype = {
|
||||
item.hidden = true;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
scripts.setAttribute("label", L10N.getStr("noMatchingScriptsText"));
|
||||
scripts.removeAttribute("tooltiptext");
|
||||
}
|
||||
}
|
||||
if (line > -1) {
|
||||
editor.setCaretPosition(line - 1);
|
||||
|
@ -64,6 +64,7 @@
|
||||
tabindex="0"/>
|
||||
</hbox>
|
||||
<menulist id="scripts" class="devtools-menulist"
|
||||
sizetopopup="always"
|
||||
label="&debuggerUI.emptyScriptText;"/>
|
||||
<textbox id="scripts-search" type="search"
|
||||
class="devtools-searchinput"
|
||||
|
@ -67,6 +67,13 @@ function testLocationChange()
|
||||
is(gDebugger.editor.getText().length, 0,
|
||||
"The source editor not have any text displayed.");
|
||||
|
||||
let menulist = gDebugger.DebuggerView.Scripts._scripts;
|
||||
let noScripts = gDebugger.L10N.getStr("noScriptsText");
|
||||
is(menulist.getAttribute("label"), noScripts,
|
||||
"The menulist should display a notice that there are no scripts availalble.");
|
||||
is(menulist.getAttribute("tooltiptext"), "",
|
||||
"The menulist shouldn't have any tooltip text attributed when there are no scripts available.");
|
||||
|
||||
closeDebuggerAndFinish();
|
||||
});
|
||||
});
|
||||
|
@ -124,10 +124,41 @@ function finalCheck(i, string, token) {
|
||||
}
|
||||
|
||||
clear();
|
||||
ok(gEditor.getCaretPosition().line == 5 &&
|
||||
gEditor.getCaretPosition().col == 8 + token.length + i,
|
||||
"The editor didn't remain at the correct token. (4)");
|
||||
|
||||
executeSoon(function() {
|
||||
let noMatchingScripts = gDebugger.L10N.getStr("noMatchingScriptsText");
|
||||
|
||||
is(gScripts.visibleItemsCount, 2,
|
||||
"Not all the scripts are shown after the searchbox was emptied.");
|
||||
is(gMenulist.selectedIndex, 1,
|
||||
"The menulist should have retained its selected index after the searchbox was emptied.");
|
||||
|
||||
write("BOGUS");
|
||||
ok(gEditor.getCaretPosition().line == 5 &&
|
||||
gEditor.getCaretPosition().col == 8 + token.length + i,
|
||||
"The editor didn't remain at the correct token. (5)");
|
||||
|
||||
is(gMenulist.getAttribute("label"), noMatchingScripts,
|
||||
"The menulist should display a notice that no scripts match the searched token.");
|
||||
is(gScripts.visibleItemsCount, 0,
|
||||
"No scripts should be displayed in the menulist after a bogus search.");
|
||||
is(gMenulist.selectedIndex, 1,
|
||||
"The menulist should retain its selected index after a bogus search.");
|
||||
|
||||
clear();
|
||||
ok(gEditor.getCaretPosition().line == 5 &&
|
||||
gEditor.getCaretPosition().col == 8 + token.length + i,
|
||||
"The editor didn't remain at the correct token. (6)");
|
||||
|
||||
isnot(gMenulist.getAttribute("label"), noMatchingScripts,
|
||||
"The menulist should not display a notice after the searchbox was emptied.");
|
||||
is(gScripts.visibleItemsCount, 2,
|
||||
"Not all the scripts are shown after the searchbox was emptied.");
|
||||
is(gMenulist.selectedIndex, 1,
|
||||
"The menulist should have retained its selected index after the searchbox was emptied of a bogus search.");
|
||||
|
||||
closeDebuggerAndFinish();
|
||||
});
|
||||
|
@ -441,7 +441,7 @@ TiltUtils.DOM = {
|
||||
}
|
||||
|
||||
// prepare the queue array
|
||||
Array.prototype.push.apply(queue, name === "iframe" ?
|
||||
Array.prototype.push.apply(queue, name === "iframe" || name === "frame" ?
|
||||
node.contentDocument.childNodes :
|
||||
node.childNodes);
|
||||
}
|
||||
|
@ -56,6 +56,7 @@ MOCHITEST_BROWSER_FILES += \
|
||||
browser_tilt_utils04.js \
|
||||
browser_tilt_utils05.js \
|
||||
browser_tilt_utils06.js \
|
||||
browser_tilt_utils07.js \
|
||||
browser_tilt_visualizer.js \
|
||||
browser_tilt_zoom.js \
|
||||
$(NULL)
|
||||
|
192
browser/devtools/tilt/test/browser_tilt_utils07.js
Normal file
192
browser/devtools/tilt/test/browser_tilt_utils07.js
Normal file
@ -0,0 +1,192 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
"use strict";
|
||||
|
||||
function init(callback) {
|
||||
let iframe = gBrowser.ownerDocument.createElement("iframe");
|
||||
|
||||
iframe.addEventListener("load", function onLoad() {
|
||||
iframe.removeEventListener("load", onLoad, true);
|
||||
callback(iframe);
|
||||
|
||||
gBrowser.parentNode.removeChild(iframe);
|
||||
finish();
|
||||
}, true);
|
||||
|
||||
iframe.setAttribute("src", ["data:text/html,",
|
||||
"<!DOCTYPE html>",
|
||||
"<html>",
|
||||
"<body style='margin: 0;'>",
|
||||
"<frameset cols='50%,50%'>",
|
||||
"<frame src='",
|
||||
["data:text/html,",
|
||||
"<!DOCTYPE html>",
|
||||
"<html>",
|
||||
"<body style='margin: 0;'>",
|
||||
"<div id='test-div' style='width: 123px; height: 456px;'></div>",
|
||||
"</body>",
|
||||
"</html>"
|
||||
].join(""),
|
||||
"' />",
|
||||
"<frame src='",
|
||||
["data:text/html,",
|
||||
"<!DOCTYPE html>",
|
||||
"<html>",
|
||||
"<body style='margin: 0;'>",
|
||||
"<span></span>",
|
||||
"</body>",
|
||||
"</html>"
|
||||
].join(""),
|
||||
"' />",
|
||||
"</frameset>",
|
||||
"<iframe src='",
|
||||
["data:text/html,",
|
||||
"<!DOCTYPE html>",
|
||||
"<html>",
|
||||
"<body>",
|
||||
"<span></span>",
|
||||
"</body>",
|
||||
"</html>"
|
||||
].join(""),
|
||||
"'></iframe>",
|
||||
"<frame src='",
|
||||
["data:text/html,",
|
||||
"<!DOCTYPE html>",
|
||||
"<html>",
|
||||
"<body style='margin: 0;'>",
|
||||
"<span></span>",
|
||||
"</body>",
|
||||
"</html>"
|
||||
].join(""),
|
||||
"' />",
|
||||
"<frame src='",
|
||||
["data:text/html,",
|
||||
"<!DOCTYPE html>",
|
||||
"<html>",
|
||||
"<body style='margin: 0;'>",
|
||||
"<iframe src='",
|
||||
["data:text/html,",
|
||||
"<!DOCTYPE html>",
|
||||
"<html>",
|
||||
"<body>",
|
||||
"<div></div>",
|
||||
"</body>",
|
||||
"</html>"
|
||||
].join(""),
|
||||
"'></iframe>",
|
||||
"</body>",
|
||||
"</html>"
|
||||
].join(""),
|
||||
"' />",
|
||||
"</body>",
|
||||
"</html>"
|
||||
].join(""));
|
||||
|
||||
gBrowser.parentNode.appendChild(iframe);
|
||||
}
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
ok(TiltUtils, "The TiltUtils object doesn't exist.");
|
||||
|
||||
let dom = TiltUtils.DOM;
|
||||
ok(dom, "The TiltUtils.DOM wasn't found.");
|
||||
|
||||
init(function(iframe) {
|
||||
let cwDimensions = dom.getContentWindowDimensions(iframe.contentWindow);
|
||||
|
||||
is(cwDimensions.width - iframe.contentWindow.scrollMaxX,
|
||||
iframe.contentWindow.innerWidth,
|
||||
"The content window width wasn't calculated correctly.");
|
||||
is(cwDimensions.height - iframe.contentWindow.scrollMaxY,
|
||||
iframe.contentWindow.innerHeight,
|
||||
"The content window height wasn't calculated correctly.");
|
||||
|
||||
let nodeCoordinates = LayoutHelpers.getRect(
|
||||
iframe.contentDocument.getElementById("test-div"), iframe.contentWindow);
|
||||
|
||||
let frameOffset = LayoutHelpers.getIframeContentOffset(iframe);
|
||||
let frameRect = iframe.getBoundingClientRect();
|
||||
|
||||
is(nodeCoordinates.top, frameRect.top + frameOffset[0],
|
||||
"The node coordinates top value wasn't calculated correctly.");
|
||||
is(nodeCoordinates.left, frameRect.left + frameOffset[1],
|
||||
"The node coordinates left value wasn't calculated correctly.");
|
||||
is(nodeCoordinates.width, 123,
|
||||
"The node coordinates width value wasn't calculated correctly.");
|
||||
is(nodeCoordinates.height, 456,
|
||||
"The node coordinates height value wasn't calculated correctly.");
|
||||
|
||||
|
||||
let store = dom.traverse(iframe.contentWindow);
|
||||
|
||||
is(store.nodes.length, 16,
|
||||
"The traverse() function didn't walk the correct number of nodes.");
|
||||
is(store.info.length, 16,
|
||||
"The traverse() function didn't examine the correct number of nodes.");
|
||||
is(store.info[0].name, "html",
|
||||
"the 1st traversed node isn't the expected one.");
|
||||
is(store.info[0].depth, 0,
|
||||
"the 1st traversed node doesn't have the expected depth.");
|
||||
is(store.info[1].name, "head",
|
||||
"the 2nd traversed node isn't the expected one.");
|
||||
is(store.info[1].depth, 1,
|
||||
"the 2nd traversed node doesn't have the expected depth.");
|
||||
is(store.info[2].name, "body",
|
||||
"the 3rd traversed node isn't the expected one.");
|
||||
is(store.info[2].depth, 1,
|
||||
"the 3rd traversed node doesn't have the expected depth.");
|
||||
is(store.info[3].name, "div",
|
||||
"the 4th traversed node isn't the expected one.");
|
||||
is(store.info[3].depth, 2,
|
||||
"the 4th traversed node doesn't have the expected depth.");
|
||||
is(store.info[4].name, "span",
|
||||
"the 5th traversed node isn't the expected one.");
|
||||
is(store.info[4].depth, 2,
|
||||
"the 5th traversed node doesn't have the expected depth.");
|
||||
is(store.info[5].name, "iframe",
|
||||
"the 6th traversed node isn't the expected one.");
|
||||
is(store.info[5].depth, 2,
|
||||
"the 6th traversed node doesn't have the expected depth.");
|
||||
is(store.info[6].name, "span",
|
||||
"the 7th traversed node isn't the expected one.");
|
||||
is(store.info[6].depth, 2,
|
||||
"the 7th traversed node doesn't have the expected depth.");
|
||||
is(store.info[7].name, "iframe",
|
||||
"the 8th traversed node isn't the expected one.");
|
||||
is(store.info[7].depth, 2,
|
||||
"the 8th traversed node doesn't have the expected depth.");
|
||||
is(store.info[8].name, "html",
|
||||
"the 9th traversed node isn't the expected one.");
|
||||
is(store.info[8].depth, 3,
|
||||
"the 9th traversed node doesn't have the expected depth.");
|
||||
is(store.info[9].name, "html",
|
||||
"the 10th traversed node isn't the expected one.");
|
||||
is(store.info[9].depth, 3,
|
||||
"the 10th traversed node doesn't have the expected depth.");
|
||||
is(store.info[10].name, "head",
|
||||
"the 11th traversed node isn't the expected one.");
|
||||
is(store.info[10].depth, 4,
|
||||
"the 11th traversed node doesn't have the expected depth.");
|
||||
is(store.info[11].name, "body",
|
||||
"the 12th traversed node isn't the expected one.");
|
||||
is(store.info[11].depth, 4,
|
||||
"the 12th traversed node doesn't have the expected depth.");
|
||||
is(store.info[12].name, "head",
|
||||
"the 13th traversed node isn't the expected one.");
|
||||
is(store.info[12].depth, 4,
|
||||
"the 13th traversed node doesn't have the expected depth.");
|
||||
is(store.info[13].name, "body",
|
||||
"the 14th traversed node isn't the expected one.");
|
||||
is(store.info[13].depth, 4,
|
||||
"the 14th traversed node doesn't have the expected depth.");
|
||||
is(store.info[14].name, "span",
|
||||
"the 15th traversed node isn't the expected one.");
|
||||
is(store.info[14].depth, 5,
|
||||
"the 15th traversed node doesn't have the expected depth.");
|
||||
is(store.info[15].name, "div",
|
||||
"the 16th traversed node isn't the expected one.");
|
||||
is(store.info[15].depth, 5,
|
||||
"the 16th traversed node doesn't have the expected depth.");
|
||||
});
|
||||
}
|
@ -67,4 +67,4 @@
|
||||
|
||||
<!-- LOCALIZATION NOTE (emptyScriptText): The text to display in the menulist when
|
||||
- there are no scripts. -->
|
||||
<!ENTITY debuggerUI.emptyScriptText "No scripts.">
|
||||
<!ENTITY debuggerUI.emptyScriptText "No scripts">
|
||||
|
@ -59,6 +59,14 @@ emptyStackText=No stacks to display.
|
||||
# breakpoints list when there are no breakpoints to display.
|
||||
emptyBreakpointsText=No breakpoints to display.
|
||||
|
||||
# LOCALIZATION NOTE (noScriptsText): The text to display in the menulist when
|
||||
# there are no scripts.
|
||||
noScriptsText=No scripts
|
||||
|
||||
# LOCALIZATION NOTE (noMatchingScriptsText): The text to display in the
|
||||
# menulist when there are no matching scripts after filtering.
|
||||
noMatchingScriptsText=No matching scripts
|
||||
|
||||
# LOCALIZATION NOTE (breakpointMenuItem): The text for all the elements that
|
||||
# are displayed in the breakpoints menu item popup.
|
||||
breakpointMenuItem.enableSelf=Enable breakpoint
|
||||
|
@ -1905,31 +1905,6 @@ toolbar[mode="text"] toolbarbutton.chevron > .toolbarbutton-icon {
|
||||
opacity: .3;
|
||||
}
|
||||
|
||||
/* Inspector / Highlighter */
|
||||
|
||||
#highlighter-panel {
|
||||
-moz-appearance: none;
|
||||
-moz-window-shadow: none;
|
||||
background: -moz-linear-gradient(top -1deg, #ffdd88, #ffeeaa);
|
||||
border: none;
|
||||
opacity: 0.35;
|
||||
}
|
||||
|
||||
listitem.style-selector {
|
||||
background-color: DarkGray;
|
||||
color: white;
|
||||
}
|
||||
|
||||
listitem.style-section {
|
||||
background-color: LightGray;
|
||||
color: black;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
panel[dimmed="true"] {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
/* Add-on bar */
|
||||
|
||||
#addon-bar {
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
#scripts {
|
||||
max-width: 350px;
|
||||
min-width: 150px;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -252,11 +253,11 @@
|
||||
*/
|
||||
|
||||
.details[open][animated] {
|
||||
-moz-animation-duration: 0.25s;
|
||||
-moz-animation-name: showblock;
|
||||
animation-duration: 0.25s;
|
||||
animation-name: showblock;
|
||||
}
|
||||
|
||||
@-moz-keyframes showblock {
|
||||
@keyframes showblock {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform-origin: top;
|
||||
|
@ -204,25 +204,25 @@ richlistitem[type="download"][state="1"] > .downloadInfo:hover {
|
||||
background-size: 16px;
|
||||
}
|
||||
|
||||
@-moz-keyframes downloadsIndicatorNotificationRight {
|
||||
@keyframes downloadsIndicatorNotificationRight {
|
||||
from { opacity: 0; transform: translate(-128px, 128px) scale(8); }
|
||||
20% { opacity: .85; -moz-animation-timing-function: ease-out; }
|
||||
20% { opacity: .85; animation-timing-function: ease-out; }
|
||||
to { opacity: 0; transform: translate(0) scale(1); }
|
||||
}
|
||||
|
||||
@-moz-keyframes downloadsIndicatorNotificationLeft {
|
||||
@keyframes downloadsIndicatorNotificationLeft {
|
||||
from { opacity: 0; transform: translate(128px, 128px) scale(8); }
|
||||
20% { opacity: .85; -moz-animation-timing-function: ease-out; }
|
||||
20% { opacity: .85; animation-timing-function: ease-out; }
|
||||
to { opacity: 0; transform: translate(0) scale(1); }
|
||||
}
|
||||
|
||||
#downloads-indicator[notification] > #downloads-indicator-anchor > #downloads-indicator-notification {
|
||||
-moz-animation-name: downloadsIndicatorNotificationRight;
|
||||
-moz-animation-duration: 1s;
|
||||
animation-name: downloadsIndicatorNotificationRight;
|
||||
animation-duration: 1s;
|
||||
}
|
||||
|
||||
#downloads-indicator[notification]:-moz-locale-dir(rtl) > #downloads-indicator-anchor > #downloads-indicator-notification {
|
||||
-moz-animation-name: downloadsIndicatorNotificationLeft;
|
||||
animation-name: downloadsIndicatorNotificationLeft;
|
||||
}
|
||||
|
||||
/*** Progress bar and text ***/
|
||||
|
@ -2624,31 +2624,6 @@ toolbarbutton.chevron > .toolbarbutton-menu-dropmarker {
|
||||
box-shadow: @focusRingShadow@;
|
||||
}
|
||||
|
||||
/* Inspector / Highlighter */
|
||||
|
||||
#highlighter-panel {
|
||||
-moz-appearance: none;
|
||||
-moz-window-shadow: none;
|
||||
background: -moz-linear-gradient(top -1deg, #ffdd88, #ffeeaa);
|
||||
border: none;
|
||||
opacity: 0.35;
|
||||
}
|
||||
|
||||
listitem.style-selector {
|
||||
background-color: DarkGray;
|
||||
color: white;
|
||||
}
|
||||
|
||||
listitem.style-section {
|
||||
background-color: LightGray;
|
||||
color: black;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
panel[dimmed="true"] {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
/* Add-on bar */
|
||||
|
||||
#addon-bar {
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#scripts {
|
||||
max-width: 350px;
|
||||
min-width: 150px;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -252,11 +253,11 @@
|
||||
*/
|
||||
|
||||
.details[open][animated] {
|
||||
-moz-animation-duration: 0.25s;
|
||||
-moz-animation-name: showblock;
|
||||
animation-duration: 0.25s;
|
||||
animation-name: showblock;
|
||||
}
|
||||
|
||||
@-moz-keyframes showblock {
|
||||
@keyframes showblock {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform-origin: top;
|
||||
|
@ -225,25 +225,25 @@ richlistitem[type="download"][state="1"] .downloadInfo:hover {
|
||||
background-size: 16px;
|
||||
}
|
||||
|
||||
@-moz-keyframes downloadsIndicatorNotificationRight {
|
||||
@keyframes downloadsIndicatorNotificationRight {
|
||||
from { opacity: 0; transform: translate(-128px, 128px) scale(8); }
|
||||
20% { opacity: .85; -moz-animation-timing-function: ease-out; }
|
||||
20% { opacity: .85; animation-timing-function: ease-out; }
|
||||
to { opacity: 0; transform: translate(0) scale(1); }
|
||||
}
|
||||
|
||||
@-moz-keyframes downloadsIndicatorNotificationLeft {
|
||||
@keyframes downloadsIndicatorNotificationLeft {
|
||||
from { opacity: 0; transform: translate(128px, 128px) scale(8); }
|
||||
20% { opacity: .85; -moz-animation-timing-function: ease-out; }
|
||||
20% { opacity: .85; animation-timing-function: ease-out; }
|
||||
to { opacity: 0; transform: translate(0) scale(1); }
|
||||
}
|
||||
|
||||
#downloads-indicator[notification] > #downloads-indicator-anchor > #downloads-indicator-notification {
|
||||
-moz-animation-name: downloadsIndicatorNotificationRight;
|
||||
-moz-animation-duration: 1s;
|
||||
animation-name: downloadsIndicatorNotificationRight;
|
||||
animation-duration: 1s;
|
||||
}
|
||||
|
||||
#downloads-indicator[notification]:-moz-locale-dir(rtl) > #downloads-indicator-anchor > #downloads-indicator-notification {
|
||||
-moz-animation-name: downloadsIndicatorNotificationLeft;
|
||||
animation-name: downloadsIndicatorNotificationLeft;
|
||||
}
|
||||
|
||||
/*** Progress bar and text ***/
|
||||
|
@ -2568,31 +2568,6 @@ toolbarbutton.bookmark-item[dragover="true"][open="true"] {
|
||||
outline: 1px dotted -moz-dialogText;
|
||||
}
|
||||
|
||||
/* Inspector / Highlighter */
|
||||
|
||||
#highlighter-panel {
|
||||
-moz-appearance: none;
|
||||
-moz-window-shadow: none;
|
||||
background: -moz-linear-gradient(top -1deg, #ffdd88, #ffeeaa);
|
||||
border: none;
|
||||
opacity: 0.35;
|
||||
}
|
||||
|
||||
listitem.style-selector {
|
||||
background-color: DarkGray;
|
||||
color: white;
|
||||
}
|
||||
|
||||
listitem.style-section {
|
||||
background-color: LightGray;
|
||||
color: black;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
panel[dimmed="true"] {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
/* Add-on bar */
|
||||
|
||||
#addon-bar {
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
#scripts {
|
||||
max-width: 350px;
|
||||
min-width: 150px;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -263,11 +264,11 @@
|
||||
*/
|
||||
|
||||
.details[open][animated] {
|
||||
-moz-animation-duration: 0.25s;
|
||||
-moz-animation-name: showblock;
|
||||
animation-duration: 0.25s;
|
||||
animation-name: showblock;
|
||||
}
|
||||
|
||||
@-moz-keyframes showblock {
|
||||
@keyframes showblock {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform-origin: top;
|
||||
|
@ -224,25 +224,25 @@ richlistitem[type="download"][state="1"] > .downloadInfo:hover {
|
||||
background-size: 16px;
|
||||
}
|
||||
|
||||
@-moz-keyframes downloadsIndicatorNotificationRight {
|
||||
@keyframes downloadsIndicatorNotificationRight {
|
||||
from { opacity: 0; transform: translate(-128px, 128px) scale(8); }
|
||||
20% { opacity: .85; -moz-animation-timing-function: ease-out; }
|
||||
20% { opacity: .85; animation-timing-function: ease-out; }
|
||||
to { opacity: 0; transform: translate(0) scale(1); }
|
||||
}
|
||||
|
||||
@-moz-keyframes downloadsIndicatorNotificationLeft {
|
||||
@keyframes downloadsIndicatorNotificationLeft {
|
||||
from { opacity: 0; transform: translate(128px, 128px) scale(8); }
|
||||
20% { opacity: .85; -moz-animation-timing-function: ease-out; }
|
||||
20% { opacity: .85; animation-timing-function: ease-out; }
|
||||
to { opacity: 0; transform: translate(0) scale(1); }
|
||||
}
|
||||
|
||||
#downloads-indicator[notification] > #downloads-indicator-anchor > #downloads-indicator-notification {
|
||||
-moz-animation-name: downloadsIndicatorNotificationRight;
|
||||
-moz-animation-duration: 1s;
|
||||
animation-name: downloadsIndicatorNotificationRight;
|
||||
animation-duration: 1s;
|
||||
}
|
||||
|
||||
#downloads-indicator[notification]:-moz-locale-dir(rtl) > #downloads-indicator-anchor > #downloads-indicator-notification {
|
||||
-moz-animation-name: downloadsIndicatorNotificationLeft;
|
||||
animation-name: downloadsIndicatorNotificationLeft;
|
||||
}
|
||||
|
||||
/*** Progress bar and text ***/
|
||||
|
@ -222,7 +222,7 @@ class DeviceManagerSUT(DeviceManager):
|
||||
self._sock = None
|
||||
# This error shows up with we have our tegra rebooted.
|
||||
if err[0] == errno.ECONNRESET:
|
||||
raise AgentError("Automation error: Error receiving data from socket (possible reboot). cmd=%s; err=%s" % (cmd, err), True)
|
||||
raise AgentError("Automation error: Error receiving data from socket (possible reboot). cmd=%s; err=%s" % (cmd, err))
|
||||
raise AgentError("Error receiving data from socket. cmd=%s; err=%s" % (cmd, err))
|
||||
|
||||
data += temp
|
||||
|
@ -12,7 +12,7 @@ include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = robocop
|
||||
|
||||
ROBOTIUM_PATH = $(srcdir)/robotium-solo-3.2.1.jar
|
||||
ROBOTIUM_PATH = $(srcdir)/robotium-solo-3.3.jar
|
||||
|
||||
JAVAFILES = \
|
||||
R.java \
|
||||
|
@ -4,6 +4,6 @@ Robotium is an open source tool licensed under the Apache 2.0 license and the or
|
||||
source can be found here:
|
||||
http://code.google.com/p/robotium/
|
||||
|
||||
We are including robotium-solo-3.2.1.jar as a binary and are not modifying it in anyway
|
||||
We are including robotium-solo-3.3.jar as a binary and are not modifying it in anyway
|
||||
from the original download found at:
|
||||
http://code.google.com/p/robotium/
|
||||
|
Binary file not shown.
BIN
build/mobile/robocop/robotium-solo-3.3.jar
Normal file
BIN
build/mobile/robocop/robotium-solo-3.3.jar
Normal file
Binary file not shown.
@ -7072,7 +7072,7 @@ if test "$OS_TARGET" = Android; then
|
||||
WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=dlopen,--wrap=dlclose,--wrap=dlerror,--wrap=dlsym,--wrap=dladdr"
|
||||
fi
|
||||
WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=getaddrinfo,--wrap=freeaddrinfo,--wrap=gai_strerror"
|
||||
WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=fork,--wrap=pthread_atfork,--wrap=raise"
|
||||
WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=fork,--wrap=pthread_atfork,--wrap=raise,--wrap=PR_GetEnv,--wrap=PR_SetEnv"
|
||||
fi
|
||||
|
||||
dnl ========================================================
|
||||
|
@ -1870,6 +1870,7 @@ public:
|
||||
static void GetShiftText(nsAString& text);
|
||||
static void GetControlText(nsAString& text);
|
||||
static void GetMetaText(nsAString& text);
|
||||
static void GetOSText(nsAString& text);
|
||||
static void GetAltText(nsAString& text);
|
||||
static void GetModifierSeparatorText(nsAString& text);
|
||||
|
||||
@ -2174,6 +2175,7 @@ private:
|
||||
static nsString* sShiftText;
|
||||
static nsString* sControlText;
|
||||
static nsString* sMetaText;
|
||||
static nsString* sOSText;
|
||||
static nsString* sAltText;
|
||||
static nsString* sModifierSeparator;
|
||||
};
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include "nsTObserverArray.h"
|
||||
#include "nsTHashtable.h"
|
||||
#include "nsHashKeys.h"
|
||||
#include "nsNodeInfoManager.h"
|
||||
#include "nsIVariant.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsGkAtoms.h"
|
||||
@ -126,28 +125,9 @@ public:
|
||||
NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW
|
||||
|
||||
#ifdef MOZILLA_INTERNAL_API
|
||||
nsIDocument()
|
||||
: nsINode(nsnull),
|
||||
mCharacterSet(NS_LITERAL_CSTRING("ISO-8859-1")),
|
||||
mNodeInfoManager(nsnull),
|
||||
mCompatMode(eCompatibility_FullStandards),
|
||||
mIsInitialDocumentInWindow(false),
|
||||
mMayStartLayout(true),
|
||||
mVisible(true),
|
||||
mRemovedFromDocShell(false),
|
||||
// mAllowDNSPrefetch starts true, so that we can always reliably && it
|
||||
// with various values that might disable it. Since we never prefetch
|
||||
// unless we get a window, and in that case the docshell value will get
|
||||
// &&-ed in, this is safe.
|
||||
mAllowDNSPrefetch(true),
|
||||
mIsBeingUsedAsImage(false),
|
||||
mHasLinksToUpdate(false),
|
||||
mPartID(0)
|
||||
{
|
||||
SetInDocument();
|
||||
}
|
||||
nsIDocument();
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* Let the document know that we're starting to load data into it.
|
||||
* @param aCommand The parser command. Must not be null.
|
||||
@ -1205,6 +1185,11 @@ public:
|
||||
return mLoadedAsData;
|
||||
}
|
||||
|
||||
bool IsLoadedAsInteractiveData()
|
||||
{
|
||||
return mLoadedAsInteractiveData;
|
||||
}
|
||||
|
||||
bool MayStartLayout()
|
||||
{
|
||||
return mMayStartLayout;
|
||||
@ -1683,14 +1668,7 @@ private:
|
||||
PRUint64 mWarnedAbout;
|
||||
|
||||
protected:
|
||||
~nsIDocument()
|
||||
{
|
||||
// XXX The cleanup of mNodeInfoManager (calling DropDocumentReference and
|
||||
// releasing it) happens in the nsDocument destructor. We'd prefer to
|
||||
// do it here but nsNodeInfoManager is a concrete class that we don't
|
||||
// want to expose to users of the nsIDocument API outside of Gecko.
|
||||
}
|
||||
|
||||
~nsIDocument();
|
||||
nsPropertyTable* GetExtraPropertyTable(PRUint16 aCategory);
|
||||
|
||||
// Never ever call this. Only call GetWindow!
|
||||
@ -1747,11 +1725,9 @@ protected:
|
||||
// A reference to the element last returned from GetRootElement().
|
||||
mozilla::dom::Element* mCachedRootElement;
|
||||
|
||||
// We'd like these to be nsRefPtrs, but that'd require us to include
|
||||
// additional headers that we don't want to expose.
|
||||
// The cleanup is handled by the nsDocument destructor.
|
||||
// We hold a strong reference to mNodeInfoManager through mNodeInfo
|
||||
nsNodeInfoManager* mNodeInfoManager; // [STRONG]
|
||||
mozilla::css::Loader* mCSSLoader; // [STRONG]
|
||||
nsRefPtr<mozilla::css::Loader> mCSSLoader;
|
||||
nsHTMLStyleSheet* mAttrStyleSheet;
|
||||
|
||||
// The set of all object, embed, applet, video and audio elements for
|
||||
@ -1759,7 +1735,7 @@ protected:
|
||||
// These are non-owning pointers, the elements are responsible for removing
|
||||
// themselves when they go away.
|
||||
nsAutoPtr<nsTHashtable<nsPtrHashKey<nsIContent> > > mFreezableElements;
|
||||
|
||||
|
||||
// The set of all links that need their status resolved. Links must add themselves
|
||||
// to this set by calling RegisterPendingLinkUpdate when added to a document and must
|
||||
// remove themselves by calling UnregisterPendingLinkUpdate when removed from a document.
|
||||
@ -1799,6 +1775,11 @@ protected:
|
||||
// as scripts and plugins, disabled.
|
||||
bool mLoadedAsData;
|
||||
|
||||
// This flag is only set in nsXMLDocument, for e.g. documents used in XBL. We
|
||||
// don't want animations to play in such documents, so we need to store the
|
||||
// flag here so that we can check it in nsDocument::GetAnimationController.
|
||||
bool mLoadedAsInteractiveData;
|
||||
|
||||
// If true, whoever is creating the document has gotten it to the
|
||||
// point where it's safe to start layout on it.
|
||||
bool mMayStartLayout;
|
||||
|
@ -216,6 +216,7 @@ bool nsContentUtils::sAllowXULXBL_for_file = false;
|
||||
nsString* nsContentUtils::sShiftText = nsnull;
|
||||
nsString* nsContentUtils::sControlText = nsnull;
|
||||
nsString* nsContentUtils::sMetaText = nsnull;
|
||||
nsString* nsContentUtils::sOSText = nsnull;
|
||||
nsString* nsContentUtils::sAltText = nsnull;
|
||||
nsString* nsContentUtils::sModifierSeparator = nsnull;
|
||||
|
||||
@ -435,6 +436,15 @@ nsContentUtils::GetMetaText(nsAString& text)
|
||||
text.Assign(*sMetaText);
|
||||
}
|
||||
|
||||
void
|
||||
nsContentUtils::GetOSText(nsAString& text)
|
||||
{
|
||||
if (!sOSText) {
|
||||
InitializeModifierStrings();
|
||||
}
|
||||
text.Assign(*sOSText);
|
||||
}
|
||||
|
||||
void
|
||||
nsContentUtils::GetAltText(nsAString& text)
|
||||
{
|
||||
@ -467,6 +477,7 @@ nsContentUtils::InitializeModifierStrings()
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv) && bundle, "chrome://global/locale/platformKeys.properties could not be loaded");
|
||||
nsXPIDLString shiftModifier;
|
||||
nsXPIDLString metaModifier;
|
||||
nsXPIDLString osModifier;
|
||||
nsXPIDLString altModifier;
|
||||
nsXPIDLString controlModifier;
|
||||
nsXPIDLString modifierSeparator;
|
||||
@ -474,6 +485,7 @@ nsContentUtils::InitializeModifierStrings()
|
||||
//macs use symbols for each modifier key, so fetch each from the bundle, which also covers i18n
|
||||
bundle->GetStringFromName(NS_LITERAL_STRING("VK_SHIFT").get(), getter_Copies(shiftModifier));
|
||||
bundle->GetStringFromName(NS_LITERAL_STRING("VK_META").get(), getter_Copies(metaModifier));
|
||||
bundle->GetStringFromName(NS_LITERAL_STRING("VK_WIN").get(), getter_Copies(osModifier));
|
||||
bundle->GetStringFromName(NS_LITERAL_STRING("VK_ALT").get(), getter_Copies(altModifier));
|
||||
bundle->GetStringFromName(NS_LITERAL_STRING("VK_CONTROL").get(), getter_Copies(controlModifier));
|
||||
bundle->GetStringFromName(NS_LITERAL_STRING("MODIFIER_SEPARATOR").get(), getter_Copies(modifierSeparator));
|
||||
@ -481,6 +493,7 @@ nsContentUtils::InitializeModifierStrings()
|
||||
//if any of these don't exist, we get an empty string
|
||||
sShiftText = new nsString(shiftModifier);
|
||||
sMetaText = new nsString(metaModifier);
|
||||
sOSText = new nsString(osModifier);
|
||||
sAltText = new nsString(altModifier);
|
||||
sControlText = new nsString(controlModifier);
|
||||
sModifierSeparator = new nsString(modifierSeparator);
|
||||
@ -1453,6 +1466,8 @@ nsContentUtils::Shutdown()
|
||||
sControlText = nsnull;
|
||||
delete sMetaText;
|
||||
sMetaText = nsnull;
|
||||
delete sOSText;
|
||||
sOSText = nsnull;
|
||||
delete sAltText;
|
||||
sAltText = nsnull;
|
||||
delete sModifierSeparator;
|
||||
@ -2774,17 +2789,9 @@ nsContentUtils::IsDraggableLink(const nsIContent* aContent) {
|
||||
static bool
|
||||
TestSitePerm(nsIPrincipal* aPrincipal, const char* aType, PRUint32 aPerm)
|
||||
{
|
||||
if (nsContentUtils::IsSystemPrincipal(aPrincipal)) {
|
||||
// System principal is always allowed and never denied permission.
|
||||
return aPerm == nsIPermissionManager::ALLOW_ACTION;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
if (NS_FAILED(!aPrincipal ||
|
||||
aPrincipal->GetURI(getter_AddRefs(uri))) ||
|
||||
!uri) {
|
||||
// We always deny (i.e. don't allow) the permission if we don't
|
||||
// have a principal or we don't know the URI.
|
||||
if (!aPrincipal) {
|
||||
// We always deny (i.e. don't allow) the permission if we don't have a
|
||||
// principal.
|
||||
return aPerm != nsIPermissionManager::ALLOW_ACTION;
|
||||
}
|
||||
|
||||
@ -2793,9 +2800,9 @@ TestSitePerm(nsIPrincipal* aPrincipal, const char* aType, PRUint32 aPerm)
|
||||
NS_ENSURE_TRUE(permMgr, false);
|
||||
|
||||
PRUint32 perm;
|
||||
nsresult rv = permMgr->TestPermission(uri, aType, &perm);
|
||||
nsresult rv = permMgr->TestPermissionFromPrincipal(aPrincipal, aType, &perm);
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
|
||||
|
||||
return perm == aPerm;
|
||||
}
|
||||
|
||||
|
@ -1494,9 +1494,29 @@ nsDOMImplementation::CreateHTMLDocument(const nsAString& aTitle,
|
||||
// ==================================================================
|
||||
// =
|
||||
// ==================================================================
|
||||
nsIDocument::nsIDocument()
|
||||
: nsINode(nsnull),
|
||||
mCharacterSet(NS_LITERAL_CSTRING("ISO-8859-1")),
|
||||
mNodeInfoManager(nsnull),
|
||||
mCompatMode(eCompatibility_FullStandards),
|
||||
mIsInitialDocumentInWindow(false),
|
||||
mMayStartLayout(true),
|
||||
mVisible(true),
|
||||
mRemovedFromDocShell(false),
|
||||
// mAllowDNSPrefetch starts true, so that we can always reliably && it
|
||||
// with various values that might disable it. Since we never prefetch
|
||||
// unless we get a window, and in that case the docshell value will get
|
||||
// &&-ed in, this is safe.
|
||||
mAllowDNSPrefetch(true),
|
||||
mIsBeingUsedAsImage(false),
|
||||
mHasLinksToUpdate(false),
|
||||
mPartID(0)
|
||||
{
|
||||
SetInDocument();
|
||||
}
|
||||
|
||||
// NOTE! nsDocument::operator new() zeroes out all members, so don't
|
||||
// bother initializing members to 0.
|
||||
// NOTE! nsDocument::operator new() zeroes out all members, so don't
|
||||
// bother initializing members to 0.
|
||||
|
||||
nsDocument::nsDocument(const char* aContentType)
|
||||
: nsIDocument()
|
||||
@ -1504,7 +1524,7 @@ nsDocument::nsDocument(const char* aContentType)
|
||||
, mVisibilityState(eHidden)
|
||||
{
|
||||
SetContentTypeInternal(nsDependentCString(aContentType));
|
||||
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
if (!gDocumentLeakPRLog)
|
||||
gDocumentLeakPRLog = PR_NewLogModule("DocumentLeak");
|
||||
@ -1519,7 +1539,7 @@ nsDocument::nsDocument(const char* aContentType)
|
||||
|
||||
// Start out mLastStyleSheetSet as null, per spec
|
||||
SetDOMStringToNull(mLastStyleSheetSet);
|
||||
|
||||
|
||||
mLinksToUpdate.Init();
|
||||
}
|
||||
|
||||
@ -1532,6 +1552,14 @@ ClearAllBoxObjects(nsIContent* aKey, nsPIBoxObject* aBoxObject, void* aUserArg)
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
nsIDocument::~nsIDocument()
|
||||
{
|
||||
if (mNodeInfoManager) {
|
||||
mNodeInfoManager->DropDocumentReference();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
nsDocument::~nsDocument()
|
||||
{
|
||||
#ifdef PR_LOGGING
|
||||
@ -1613,12 +1641,6 @@ nsDocument::~nsDocument()
|
||||
if (mCSSLoader) {
|
||||
// Could be null here if Init() failed
|
||||
mCSSLoader->DropDocumentReference();
|
||||
NS_RELEASE(mCSSLoader);
|
||||
}
|
||||
|
||||
// XXX Ideally we'd do this cleanup in the nsIDocument destructor.
|
||||
if (mNodeInfoManager) {
|
||||
mNodeInfoManager->DropDocumentReference();
|
||||
}
|
||||
|
||||
delete mHeaderData;
|
||||
@ -1910,7 +1932,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDocument)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMARRAY(mPreloadingImages)
|
||||
|
||||
|
||||
|
||||
if (tmp->mBoxObjectTable) {
|
||||
tmp->mBoxObjectTable->EnumerateRead(ClearAllBoxObjects, nsnull);
|
||||
delete tmp->mBoxObjectTable;
|
||||
@ -1931,7 +1953,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDocument)
|
||||
tmp->mFrameRequestCallbacks.Clear();
|
||||
|
||||
tmp->mRadioGroups.Clear();
|
||||
|
||||
|
||||
// nsDocument has a pretty complex destructor, so we're going to
|
||||
// assume that *most* cycles you actually want to break somewhere
|
||||
// else, and not unlink an awful lot here.
|
||||
@ -1943,7 +1965,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDocument)
|
||||
}
|
||||
|
||||
tmp->mPendingTitleChangeEvent.Revoke();
|
||||
|
||||
|
||||
tmp->mInUnlinkOrDeletion = false;
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
@ -1961,7 +1983,6 @@ nsDocument::Init()
|
||||
|
||||
// Force initialization.
|
||||
nsINode::nsSlots* slots = GetSlots();
|
||||
NS_ENSURE_TRUE(slots,NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
// Prepend self as mutation-observer whether we need it or not (some
|
||||
// subclasses currently do, other don't). This is because the code in
|
||||
@ -1972,17 +1993,11 @@ nsDocument::Init()
|
||||
|
||||
|
||||
mOnloadBlocker = new nsOnloadBlocker();
|
||||
NS_ENSURE_TRUE(mOnloadBlocker, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
mCSSLoader = new mozilla::css::Loader(this);
|
||||
NS_ENSURE_TRUE(mCSSLoader, NS_ERROR_OUT_OF_MEMORY);
|
||||
NS_ADDREF(mCSSLoader);
|
||||
// Assume we're not quirky, until we know otherwise
|
||||
mCSSLoader->SetCompatibilityMode(eCompatibility_FullStandards);
|
||||
|
||||
mNodeInfoManager = new nsNodeInfoManager();
|
||||
NS_ENSURE_TRUE(mNodeInfoManager, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
nsresult rv = mNodeInfoManager->Init(this);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
@ -1995,7 +2010,6 @@ nsDocument::Init()
|
||||
NS_ASSERTION(OwnerDoc() == this, "Our nodeinfo is busted!");
|
||||
|
||||
mScriptLoader = new nsScriptLoader(this);
|
||||
NS_ENSURE_TRUE(mScriptLoader, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
mImageTracker.Init();
|
||||
mPlugins.Init();
|
||||
@ -2003,7 +2017,7 @@ nsDocument::Init()
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
nsIDocument::DeleteAllProperties()
|
||||
{
|
||||
for (PRUint32 i = 0; i < GetPropertyTableCount(); ++i) {
|
||||
|
@ -1173,11 +1173,6 @@ protected:
|
||||
|
||||
bool mInXBLUpdate:1;
|
||||
|
||||
// This flag is only set in nsXMLDocument, for e.g. documents used in XBL. We
|
||||
// don't want animations to play in such documents, so we need to store the
|
||||
// flag here so that we can check it in nsDocument::GetAnimationController.
|
||||
bool mLoadedAsInteractiveData:1;
|
||||
|
||||
// Whether we're currently holding a lock on all of our images.
|
||||
bool mLockingImages:1;
|
||||
|
||||
|
@ -19,9 +19,9 @@
|
||||
#include "nsIURI.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsFrameMessageManager.h"
|
||||
#include "Layers.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "Layers.h"
|
||||
|
||||
class nsIURI;
|
||||
class nsSubDocumentFrame;
|
||||
|
@ -1536,21 +1536,6 @@ nsresult
|
||||
nsGenericElement::GetAttribute(const nsAString& aName,
|
||||
nsAString& aReturn)
|
||||
{
|
||||
// I hate XUL
|
||||
if (IsXUL()) {
|
||||
const nsAttrValue* val =
|
||||
nsXULElement::FromContent(this)->GetAttrValue(aName);
|
||||
if (val) {
|
||||
val->ToString(aReturn);
|
||||
}
|
||||
else {
|
||||
// XXX should be SetDOMStringToNull(aReturn);
|
||||
// See bug 232598
|
||||
aReturn.Truncate();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
const nsAttrValue* val =
|
||||
mAttrsAndChildren.GetAttr(aName,
|
||||
IsHTML() && IsInHTMLDocument() ?
|
||||
@ -1558,7 +1543,13 @@ nsGenericElement::GetAttribute(const nsAString& aName,
|
||||
if (val) {
|
||||
val->ToString(aReturn);
|
||||
} else {
|
||||
SetDOMStringToNull(aReturn);
|
||||
if (IsXUL()) {
|
||||
// XXX should be SetDOMStringToNull(aReturn);
|
||||
// See bug 232598
|
||||
aReturn.Truncate();
|
||||
} else {
|
||||
SetDOMStringToNull(aReturn);
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -575,8 +575,7 @@ nsNodeUtils::CloneAndAdopt(nsINode *aNode, bool aClone, bool aDeep,
|
||||
#ifdef MOZ_XUL
|
||||
if (aClone && !aParent && aNode->IsElement() &&
|
||||
aNode->AsElement()->IsXUL()) {
|
||||
nsXULElement *xulElem = static_cast<nsXULElement*>(elem);
|
||||
if (!xulElem->mPrototype || xulElem->IsInDoc()) {
|
||||
if (!aNode->OwnerDoc()->IsLoadedAsInteractiveData()) {
|
||||
clone->SetFlags(NODE_FORCE_XBL_BINDINGS);
|
||||
}
|
||||
}
|
||||
|
@ -193,15 +193,6 @@ nsStyledElementNotElementCSSInlineStyle::GetInlineStyleRule()
|
||||
nsIDOMCSSStyleDeclaration*
|
||||
nsStyledElementNotElementCSSInlineStyle::GetStyle(nsresult* retval)
|
||||
{
|
||||
nsXULElement* xulElement = nsXULElement::FromContent(this);
|
||||
if (xulElement) {
|
||||
nsresult rv = xulElement->EnsureLocalStyle();
|
||||
if (NS_FAILED(rv)) {
|
||||
*retval = rv;
|
||||
return nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
nsGenericElement::nsDOMSlots *slots = DOMSlots();
|
||||
|
||||
if (!slots->mStyle) {
|
||||
|
21
content/canvas/crashtests/767337-1.html
Normal file
21
content/canvas/crashtests/767337-1.html
Normal file
@ -0,0 +1,21 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<canvas id="c" width="500" height="1000">
|
||||
</canvas>
|
||||
<script>
|
||||
var ctxt = document.getElementById('c').getContext('2d');
|
||||
for (var k = 0; k < 100; ++j) {
|
||||
for (var j = 0; j < 10; ++j) {
|
||||
for (var i = 0; i < 1000; ++i) {
|
||||
gradient = ctxt.createLinearGradient(0,0,200,i);
|
||||
gradient.addColorStop(0,'black');
|
||||
gradient.addColorStop(1,'rgba(0, 255*k/100, 0, 0.1)');
|
||||
ctxt.fillStyle = gradient;
|
||||
ctxt.fillRect(j*50, 2*i, 50, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -10,3 +10,4 @@ load 746813-1.html
|
||||
# this test crashes in a bunch places still
|
||||
#load 745818-large-source.html
|
||||
load 743499-negative-size.html
|
||||
load 767337-1.html
|
||||
|
@ -25,7 +25,6 @@
|
||||
#include "nsIObserver.h"
|
||||
|
||||
#include "GLContextProvider.h"
|
||||
#include "Layers.h"
|
||||
|
||||
#include "mozilla/LinkedList.h"
|
||||
#include "mozilla/CheckedInt.h"
|
||||
|
@ -40,7 +40,6 @@
|
||||
#include "nsMutationEvent.h"
|
||||
#include "nsIXPConnect.h"
|
||||
#include "nsDOMCID.h"
|
||||
#include "nsIScriptEventHandlerOwner.h"
|
||||
#include "nsFocusManager.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsContentUtils.h"
|
||||
@ -662,21 +661,8 @@ nsEventListenerManager::CompileEventHandlerInternal(nsListenerStruct *aListenerS
|
||||
NS_ASSERTION(!listener->GetHandler(), "What is there to compile?");
|
||||
|
||||
nsIScriptContext *context = listener->GetEventContext();
|
||||
nsCOMPtr<nsIScriptEventHandlerOwner> handlerOwner =
|
||||
do_QueryInterface(mTarget);
|
||||
nsScriptObjectHolder<JSObject> handler(context);
|
||||
|
||||
if (handlerOwner) {
|
||||
result = handlerOwner->GetCompiledEventHandler(aListenerStruct->mTypeAtom,
|
||||
handler);
|
||||
if (NS_SUCCEEDED(result) && handler) {
|
||||
aListenerStruct->mHandlerIsString = false;
|
||||
} else {
|
||||
// Make sure there's nothing in the holder in the failure case
|
||||
handler.set(nsnull);
|
||||
}
|
||||
}
|
||||
|
||||
if (aListenerStruct->mHandlerIsString) {
|
||||
// OK, we didn't find an existing compiled event handler. Flag us
|
||||
// as not a string so we don't keep trying to compile strings
|
||||
@ -745,41 +731,29 @@ nsEventListenerManager::CompileEventHandlerInternal(nsListenerStruct *aListenerS
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
PRUint32 argCount;
|
||||
const char **argNames;
|
||||
// If no content, then just use kNameSpaceID_None for the
|
||||
// namespace ID. In practice, it doesn't matter since SVG is
|
||||
// the only thing with weird arg names and SVG doesn't map event
|
||||
// listeners to the window.
|
||||
nsContentUtils::GetEventArgNames(content ?
|
||||
content->GetNameSpaceID() :
|
||||
kNameSpaceID_None,
|
||||
aListenerStruct->mTypeAtom,
|
||||
&argCount, &argNames);
|
||||
|
||||
if (handlerOwner) {
|
||||
// Always let the handler owner compile the event
|
||||
// handler, as it may want to use a special
|
||||
// context or scope object.
|
||||
result = handlerOwner->CompileEventHandler(context,
|
||||
aListenerStruct->mTypeAtom,
|
||||
*body,
|
||||
url.get(), lineNo,
|
||||
handler);
|
||||
} else {
|
||||
PRUint32 argCount;
|
||||
const char **argNames;
|
||||
// If no content, then just use kNameSpaceID_None for the
|
||||
// namespace ID. In practice, it doesn't matter since SVG is
|
||||
// the only thing with weird arg names and SVG doesn't map event
|
||||
// listeners to the window.
|
||||
nsContentUtils::GetEventArgNames(content ?
|
||||
content->GetNameSpaceID() :
|
||||
kNameSpaceID_None,
|
||||
aListenerStruct->mTypeAtom,
|
||||
&argCount, &argNames);
|
||||
|
||||
result = context->CompileEventHandler(aListenerStruct->mTypeAtom,
|
||||
argCount, argNames,
|
||||
*body,
|
||||
url.get(), lineNo,
|
||||
SCRIPTVERSION_DEFAULT, // for now?
|
||||
handler);
|
||||
if (result == NS_ERROR_ILLEGAL_VALUE) {
|
||||
NS_WARNING("Probably a syntax error in the event handler!");
|
||||
return NS_SUCCESS_LOSS_OF_INSIGNIFICANT_DATA;
|
||||
}
|
||||
NS_ENSURE_SUCCESS(result, result);
|
||||
result = context->CompileEventHandler(aListenerStruct->mTypeAtom,
|
||||
argCount, argNames,
|
||||
*body,
|
||||
url.get(), lineNo,
|
||||
SCRIPTVERSION_DEFAULT, // for now?
|
||||
handler);
|
||||
if (result == NS_ERROR_ILLEGAL_VALUE) {
|
||||
NS_WARNING("Probably a syntax error in the event handler!");
|
||||
return NS_SUCCESS_LOSS_OF_INSIGNIFICANT_DATA;
|
||||
}
|
||||
NS_ENSURE_SUCCESS(result, result);
|
||||
}
|
||||
|
||||
if (handler) {
|
||||
|
@ -266,6 +266,7 @@ enum {
|
||||
#define NS_MODIFIER_CONTROL 2
|
||||
#define NS_MODIFIER_ALT 4
|
||||
#define NS_MODIFIER_META 8
|
||||
#define NS_MODIFIER_OS 16
|
||||
|
||||
static nsIDocument *
|
||||
GetDocumentFromWindow(nsIDOMWindow *aWindow)
|
||||
@ -290,6 +291,7 @@ GetAccessModifierMaskFromPref(PRInt32 aItemType)
|
||||
case nsIDOMKeyEvent::DOM_VK_CONTROL: return NS_MODIFIER_CONTROL;
|
||||
case nsIDOMKeyEvent::DOM_VK_ALT: return NS_MODIFIER_ALT;
|
||||
case nsIDOMKeyEvent::DOM_VK_META: return NS_MODIFIER_META;
|
||||
case nsIDOMKeyEvent::DOM_VK_WIN: return NS_MODIFIER_OS;
|
||||
default: return 0;
|
||||
}
|
||||
|
||||
@ -1167,6 +1169,8 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
|
||||
modifierMask |= NS_MODIFIER_ALT;
|
||||
if (keyEvent->IsMeta())
|
||||
modifierMask |= NS_MODIFIER_META;
|
||||
if (keyEvent->IsOS())
|
||||
modifierMask |= NS_MODIFIER_OS;
|
||||
|
||||
// Prevent keyboard scrolling while an accesskey modifier is in use.
|
||||
if (modifierMask && (modifierMask == sChromeAccessModifier ||
|
||||
@ -1524,6 +1528,10 @@ nsEventStateManager::GetAccessKeyLabelPrefix(nsAString& aPrefix)
|
||||
nsContentUtils::GetMetaText(modifierText);
|
||||
aPrefix.Append(modifierText + separator);
|
||||
}
|
||||
if (modifier & NS_MODIFIER_OS) {
|
||||
nsContentUtils::GetOSText(modifierText);
|
||||
aPrefix.Append(modifierText + separator);
|
||||
}
|
||||
if (modifier & NS_MODIFIER_ALT) {
|
||||
nsContentUtils::GetAltText(modifierText);
|
||||
aPrefix.Append(modifierText + separator);
|
||||
@ -1637,10 +1645,9 @@ nsEventStateManager::HandleAccessKey(nsPresContext* aPresContext,
|
||||
|
||||
bool
|
||||
nsEventStateManager::DispatchCrossProcessEvent(nsEvent* aEvent,
|
||||
nsIFrameLoader* aFrameLoader,
|
||||
nsFrameLoader* aFrameLoader,
|
||||
nsEventStatus *aStatus) {
|
||||
nsFrameLoader* fml = static_cast<nsFrameLoader*>(aFrameLoader);
|
||||
PBrowserParent* remoteBrowser = fml->GetRemoteBrowser();
|
||||
PBrowserParent* remoteBrowser = aFrameLoader->GetRemoteBrowser();
|
||||
TabParent* remote = static_cast<TabParent*>(remoteBrowser);
|
||||
if (!remote) {
|
||||
return false;
|
||||
@ -1788,6 +1795,10 @@ nsEventStateManager::HandleCrossProcessEvent(nsEvent *aEvent,
|
||||
}
|
||||
}
|
||||
|
||||
if (targets.Length() == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Look up the frame loader for all the remote targets we found, and
|
||||
// then dispatch the event to the remote content they represent.
|
||||
bool dispatched = false;
|
||||
@ -1795,22 +1806,46 @@ nsEventStateManager::HandleCrossProcessEvent(nsEvent *aEvent,
|
||||
nsIContent* target = targets[i];
|
||||
nsCOMPtr<nsIFrameLoaderOwner> loaderOwner = do_QueryInterface(target);
|
||||
if (!loaderOwner) {
|
||||
return false;
|
||||
continue;
|
||||
}
|
||||
|
||||
nsRefPtr<nsFrameLoader> frameLoader = loaderOwner->GetFrameLoader();
|
||||
if (!frameLoader) {
|
||||
return false;
|
||||
continue;
|
||||
}
|
||||
|
||||
PRUint32 eventMode;
|
||||
frameLoader->GetEventMode(&eventMode);
|
||||
if (eventMode == nsIFrameLoader::EVENT_MODE_DONT_FORWARD_TO_CHILD) {
|
||||
return false;
|
||||
continue;
|
||||
}
|
||||
|
||||
nsPoint pt = nsLayoutUtils::GetEventCoordinatesRelativeTo(aEvent, aTargetFrame);
|
||||
aEvent->refPoint = pt.ToNearestPixels(mPresContext->AppUnitsPerDevPixel());
|
||||
// The "toplevel widget" in content processes is always at position
|
||||
// 0,0. Map the event coordinates to match that.
|
||||
if (aEvent->eventStructType != NS_TOUCH_EVENT) {
|
||||
nsPoint pt = nsLayoutUtils::GetEventCoordinatesRelativeTo(aEvent,
|
||||
aTargetFrame);
|
||||
aEvent->refPoint =
|
||||
pt.ToNearestPixels(mPresContext->AppUnitsPerDevPixel());
|
||||
} else {
|
||||
nsIFrame* targetFrame = frameLoader->GetPrimaryFrameOfOwningContent();
|
||||
aEvent->refPoint = nsIntPoint();
|
||||
// Find out how far we're offset from the nearest widget.
|
||||
nsPoint offset =
|
||||
nsLayoutUtils::GetEventCoordinatesRelativeTo(aEvent, targetFrame);
|
||||
nsIntPoint intOffset =
|
||||
offset.ToNearestPixels(mPresContext->AppUnitsPerDevPixel());
|
||||
nsTouchEvent* touchEvent = static_cast<nsTouchEvent*>(aEvent);
|
||||
// Then offset all the touch points by that distance, to put them
|
||||
// in the space where top-left is 0,0.
|
||||
const nsTArray<nsCOMPtr<nsIDOMTouch> >& touches = touchEvent->touches;
|
||||
for (PRUint32 i = 0; i < touches.Length(); ++i) {
|
||||
nsIDOMTouch* touch = touches[i];
|
||||
if (touch) {
|
||||
touch->mRefPoint += intOffset;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dispatched |= DispatchCrossProcessEvent(aEvent, frameLoader, aStatus);
|
||||
}
|
||||
|
@ -447,7 +447,7 @@ protected:
|
||||
mozilla::dom::TabParent *GetCrossProcessTarget();
|
||||
bool IsTargetCrossProcess(nsGUIEvent *aEvent);
|
||||
|
||||
bool DispatchCrossProcessEvent(nsEvent* aEvent, nsIFrameLoader* remote,
|
||||
bool DispatchCrossProcessEvent(nsEvent* aEvent, nsFrameLoader* remote,
|
||||
nsEventStatus *aStatus);
|
||||
bool HandleCrossProcessEvent(nsEvent *aEvent,
|
||||
nsIFrame* aTargetFrame,
|
||||
|
@ -130,8 +130,13 @@ nsresult nsGStreamerReader::Init(nsBuiltinDecoderReader* aCloneDonor)
|
||||
gst_object_unref(sinkpad);
|
||||
|
||||
mAudioSink = gst_parse_bin_from_description("capsfilter name=filter ! "
|
||||
#ifdef MOZ_SAMPLE_TYPE_FLOAT32
|
||||
"appsink name=audiosink sync=true caps=audio/x-raw-float,"
|
||||
"channels={1,2},rate=44100,width=32,endianness=1234", TRUE, NULL);
|
||||
#else
|
||||
"appsink name=audiosink sync=true caps=audio/x-raw-int,"
|
||||
"channels={1,2},rate=48000,width=16,endianness=1234", TRUE, NULL);
|
||||
#endif
|
||||
mAudioAppSink = GST_APP_SINK(gst_bin_get_by_name(GST_BIN(mAudioSink),
|
||||
"audiosink"));
|
||||
gst_app_sink_set_callbacks(mAudioAppSink, &mSinkCallbacks,
|
||||
|
@ -196,9 +196,12 @@ destroying the nsBuiltinDecoder object.
|
||||
#include "nsMediaDecoder.h"
|
||||
#include "nsHTMLMediaElement.h"
|
||||
#include "mozilla/ReentrantMonitor.h"
|
||||
|
||||
#include "ImageLayers.h"
|
||||
class nsAudioStream;
|
||||
|
||||
typedef mozilla::layers::Image Image;
|
||||
typedef mozilla::layers::ImageContainer ImageContainer;
|
||||
|
||||
static inline bool IsCurrentThread(nsIThread* aThread) {
|
||||
return NS_GetCurrentThread() == aThread;
|
||||
}
|
||||
|
@ -7,7 +7,6 @@
|
||||
#define nsBuiltinDecoderReader_h_
|
||||
|
||||
#include <nsDeque.h>
|
||||
#include "ImageLayers.h"
|
||||
#include "nsSize.h"
|
||||
#include "mozilla/ReentrantMonitor.h"
|
||||
#include "MediaStreamGraph.h"
|
||||
|
@ -550,11 +550,11 @@ void nsBuiltinDecoderStateMachine::SendOutputStreamAudio(AudioData* aAudio,
|
||||
aStream->mAudioFramesWritten += aAudio->mFrames - PRInt32(offset);
|
||||
}
|
||||
|
||||
static void WriteVideoToMediaStream(Image* aImage,
|
||||
static void WriteVideoToMediaStream(mozilla::layers::Image* aImage,
|
||||
PRInt64 aDuration, const gfxIntSize& aIntrinsicSize,
|
||||
VideoSegment* aOutput)
|
||||
{
|
||||
nsRefPtr<Image> image = aImage;
|
||||
nsRefPtr<mozilla::layers::Image> image = aImage;
|
||||
aOutput->AppendFrame(image.forget(), aDuration, aIntrinsicSize);
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,6 @@
|
||||
#if !defined(nsMediaDecoder_h_)
|
||||
#define nsMediaDecoder_h_
|
||||
|
||||
#include "ImageLayers.h"
|
||||
#include "mozilla/ReentrantMonitor.h"
|
||||
#include "VideoFrameContainer.h"
|
||||
#include "MediaStreamGraph.h"
|
||||
@ -38,8 +37,6 @@ static const PRUint32 FRAMEBUFFER_LENGTH_MAX = 16384;
|
||||
class nsMediaDecoder : public nsIObserver
|
||||
{
|
||||
public:
|
||||
typedef mozilla::layers::Image Image;
|
||||
typedef mozilla::layers::ImageContainer ImageContainer;
|
||||
typedef mozilla::MediaResource MediaResource;
|
||||
typedef mozilla::ReentrantMonitor ReentrantMonitor;
|
||||
typedef mozilla::SourceMediaStream SourceMediaStream;
|
||||
@ -341,7 +338,7 @@ public:
|
||||
|
||||
// Returns the current size of the framebuffer used in
|
||||
// MozAudioAvailable events.
|
||||
PRUint32 GetFrameBufferLength() { return mFrameBufferLength; };
|
||||
PRUint32 GetFrameBufferLength() { return mFrameBufferLength; }
|
||||
|
||||
// Sets the length of the framebuffer used in MozAudioAvailable events.
|
||||
// The new size must be between 512 and 16384.
|
||||
@ -368,7 +365,7 @@ public:
|
||||
virtual PRInt64 AudioQueueMemoryInUse() = 0;
|
||||
|
||||
VideoFrameContainer* GetVideoFrameContainer() { return mVideoFrameContainer; }
|
||||
ImageContainer* GetImageContainer()
|
||||
mozilla::layers::ImageContainer* GetImageContainer()
|
||||
{
|
||||
return mVideoFrameContainer ? mVideoFrameContainer->GetImageContainer() : nsnull;
|
||||
}
|
||||
|
@ -41,9 +41,14 @@ namespace mozilla {
|
||||
// the cycle, as NS_SVG_VAL_IMPL_CYCLE_COLLECTION does.)
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(DOMSVGLengthList)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(DOMSVGLengthList)
|
||||
// No need to null check tmp - script/SMIL can't detach us from mAList
|
||||
( tmp->IsAnimValList() ? tmp->mAList->mAnimVal : tmp->mAList->mBaseVal ) = nsnull;
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mAList)
|
||||
if (tmp->mAList) {
|
||||
if (tmp->IsAnimValList()) {
|
||||
tmp->mAList->mAnimVal = nsnull;
|
||||
} else {
|
||||
tmp->mAList->mBaseVal = nsnull;
|
||||
}
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mAList)
|
||||
}
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(DOMSVGLengthList)
|
||||
|
@ -41,9 +41,14 @@ void UpdateListIndicesFromIndex(nsTArray<DOMSVGNumber*>& aItemsArray,
|
||||
// the cycle, as NS_SVG_VAL_IMPL_CYCLE_COLLECTION does.)
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(DOMSVGNumberList)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(DOMSVGNumberList)
|
||||
// No need to null check tmp - script/SMIL can't detach us from mAList
|
||||
( tmp->IsAnimValList() ? tmp->mAList->mAnimVal : tmp->mAList->mBaseVal ) = nsnull;
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mAList)
|
||||
if (tmp->mAList) {
|
||||
if (tmp->IsAnimValList()) {
|
||||
tmp->mAList->mAnimVal = nsnull;
|
||||
} else {
|
||||
tmp->mAList->mBaseVal = nsnull;
|
||||
}
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mAList)
|
||||
}
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(DOMSVGNumberList)
|
||||
|
@ -37,10 +37,14 @@ namespace mozilla {
|
||||
// the cycle, as NS_SVG_VAL_IMPL_CYCLE_COLLECTION does.)
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(DOMSVGTransformList)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(DOMSVGTransformList)
|
||||
// No need to null check tmp - script/SMIL can't detach us from mAList
|
||||
( tmp->IsAnimValList() ? tmp->mAList->mAnimVal : tmp->mAList->mBaseVal ) =
|
||||
nsnull;
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mAList)
|
||||
if (tmp->mAList) {
|
||||
if (tmp->IsAnimValList()) {
|
||||
tmp->mAList->mAnimVal = nsnull;
|
||||
} else {
|
||||
tmp->mAList->mBaseVal = nsnull;
|
||||
}
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mAList)
|
||||
}
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(DOMSVGTransformList)
|
||||
|
@ -237,7 +237,7 @@ void
|
||||
nsSVGGraphicElement::SetAnimateMotionTransform(const gfxMatrix* aMatrix)
|
||||
{
|
||||
if ((!aMatrix && !mAnimateMotionTransform) ||
|
||||
aMatrix && mAnimateMotionTransform && *aMatrix == *mAnimateMotionTransform) {
|
||||
(aMatrix && mAnimateMotionTransform && *aMatrix == *mAnimateMotionTransform)) {
|
||||
return;
|
||||
}
|
||||
mAnimateMotionTransform = aMatrix ? new gfxMatrix(*aMatrix) : nsnull;
|
||||
|
@ -61,13 +61,16 @@ const PRInt32 nsXBLPrototypeHandler::cShift = (1<<0);
|
||||
const PRInt32 nsXBLPrototypeHandler::cAlt = (1<<1);
|
||||
const PRInt32 nsXBLPrototypeHandler::cControl = (1<<2);
|
||||
const PRInt32 nsXBLPrototypeHandler::cMeta = (1<<3);
|
||||
const PRInt32 nsXBLPrototypeHandler::cOS = (1<<4);
|
||||
|
||||
const PRInt32 nsXBLPrototypeHandler::cShiftMask = (1<<4);
|
||||
const PRInt32 nsXBLPrototypeHandler::cAltMask = (1<<5);
|
||||
const PRInt32 nsXBLPrototypeHandler::cControlMask = (1<<6);
|
||||
const PRInt32 nsXBLPrototypeHandler::cMetaMask = (1<<7);
|
||||
const PRInt32 nsXBLPrototypeHandler::cShiftMask = (1<<5);
|
||||
const PRInt32 nsXBLPrototypeHandler::cAltMask = (1<<6);
|
||||
const PRInt32 nsXBLPrototypeHandler::cControlMask = (1<<7);
|
||||
const PRInt32 nsXBLPrototypeHandler::cMetaMask = (1<<8);
|
||||
const PRInt32 nsXBLPrototypeHandler::cOSMask = (1<<9);
|
||||
|
||||
const PRInt32 nsXBLPrototypeHandler::cAllModifiers = cShiftMask | cAltMask | cControlMask | cMetaMask;
|
||||
const PRInt32 nsXBLPrototypeHandler::cAllModifiers =
|
||||
cShiftMask | cAltMask | cControlMask | cMetaMask | cOSMask;
|
||||
|
||||
nsXBLPrototypeHandler::nsXBLPrototypeHandler(const PRUnichar* aEvent,
|
||||
const PRUnichar* aPhase,
|
||||
@ -496,6 +499,8 @@ nsXBLPrototypeHandler::DispatchXULKeyCommand(nsIDOMEvent* aEvent)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// XXX We should use widget::Modifiers for supporting all modifiers.
|
||||
|
||||
bool isAlt = false;
|
||||
bool isControl = false;
|
||||
bool isShift = false;
|
||||
@ -646,11 +651,12 @@ PRInt32 nsXBLPrototypeHandler::KeyToMask(PRInt32 key)
|
||||
{
|
||||
case nsIDOMKeyEvent::DOM_VK_META:
|
||||
return cMeta | cMetaMask;
|
||||
break;
|
||||
|
||||
case nsIDOMKeyEvent::DOM_VK_WIN:
|
||||
return cOS | cOSMask;
|
||||
|
||||
case nsIDOMKeyEvent::DOM_VK_ALT:
|
||||
return cAlt | cAltMask;
|
||||
break;
|
||||
|
||||
case nsIDOMKeyEvent::DOM_VK_CONTROL:
|
||||
default:
|
||||
@ -757,6 +763,8 @@ nsXBLPrototypeHandler::ConstructPrototype(nsIContent* aKeyElement,
|
||||
mKeyMask |= cAlt | cAltMask;
|
||||
else if (PL_strcmp(token, "meta") == 0)
|
||||
mKeyMask |= cMeta | cMetaMask;
|
||||
else if (PL_strcmp(token, "os") == 0)
|
||||
mKeyMask |= cOS | cOSMask;
|
||||
else if (PL_strcmp(token, "control") == 0)
|
||||
mKeyMask |= cControl | cControlMask;
|
||||
else if (PL_strcmp(token, "accel") == 0)
|
||||
@ -764,7 +772,7 @@ nsXBLPrototypeHandler::ConstructPrototype(nsIContent* aKeyElement,
|
||||
else if (PL_strcmp(token, "access") == 0)
|
||||
mKeyMask |= KeyToMask(kMenuAccessKey);
|
||||
else if (PL_strcmp(token, "any") == 0)
|
||||
mKeyMask &= ~(mKeyMask << 4);
|
||||
mKeyMask &= ~(mKeyMask << 5);
|
||||
|
||||
token = nsCRT::strtok( newStr, ", \t", &newStr );
|
||||
}
|
||||
@ -853,32 +861,38 @@ bool
|
||||
nsXBLPrototypeHandler::ModifiersMatchMask(nsIDOMUIEvent* aEvent,
|
||||
bool aIgnoreShiftKey)
|
||||
{
|
||||
nsCOMPtr<nsIDOMKeyEvent> key(do_QueryInterface(aEvent));
|
||||
nsCOMPtr<nsIDOMMouseEvent> mouse(do_QueryInterface(aEvent));
|
||||
nsEvent* event = aEvent->GetInternalNSEvent();
|
||||
NS_ENSURE_TRUE(event && NS_IS_INPUT_EVENT(event), false);
|
||||
nsInputEvent* inputEvent = static_cast<nsInputEvent*>(event);
|
||||
|
||||
bool keyPresent;
|
||||
if (mKeyMask & cMetaMask) {
|
||||
key ? key->GetMetaKey(&keyPresent) : mouse->GetMetaKey(&keyPresent);
|
||||
if (keyPresent != ((mKeyMask & cMeta) != 0))
|
||||
if (inputEvent->IsMeta() != ((mKeyMask & cMeta) != 0)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (mKeyMask & cOSMask) {
|
||||
if (inputEvent->IsOS() != ((mKeyMask & cOS) != 0)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (mKeyMask & cShiftMask && !aIgnoreShiftKey) {
|
||||
key ? key->GetShiftKey(&keyPresent) : mouse->GetShiftKey(&keyPresent);
|
||||
if (keyPresent != ((mKeyMask & cShift) != 0))
|
||||
if (inputEvent->IsShift() != ((mKeyMask & cShift) != 0)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (mKeyMask & cAltMask) {
|
||||
key ? key->GetAltKey(&keyPresent) : mouse->GetAltKey(&keyPresent);
|
||||
if (keyPresent != ((mKeyMask & cAlt) != 0))
|
||||
if (inputEvent->IsAlt() != ((mKeyMask & cAlt) != 0)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (mKeyMask & cControlMask) {
|
||||
key ? key->GetCtrlKey(&keyPresent) : mouse->GetCtrlKey(&keyPresent);
|
||||
if (keyPresent != ((mKeyMask & cControl) != 0))
|
||||
if (inputEvent->IsControl() != ((mKeyMask & cControl) != 0)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -889,13 +903,13 @@ nsXBLPrototypeHandler::Read(nsIScriptContext* aContext, nsIObjectInputStream* aS
|
||||
{
|
||||
nsresult rv = aStream->Read8(&mPhase);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = aStream->Read8(&mKeyMask);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = aStream->Read8(&mType);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = aStream->Read8(&mMisc);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = aStream->Read32(reinterpret_cast<PRUint32*>(&mKeyMask));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
PRUint32 detail;
|
||||
rv = aStream->Read32(&detail);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
@ -931,12 +945,12 @@ nsXBLPrototypeHandler::Write(nsIScriptContext* aContext, nsIObjectOutputStream*
|
||||
nsresult rv = aStream->Write8(type);
|
||||
rv = aStream->Write8(mPhase);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = aStream->Write8(mKeyMask);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = aStream->Write8(mType);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = aStream->Write8(mMisc);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = aStream->Write32(static_cast<PRUint32>(mKeyMask));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = aStream->Write32(mDetail);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -172,11 +172,13 @@ protected:
|
||||
static const PRInt32 cAlt;
|
||||
static const PRInt32 cControl;
|
||||
static const PRInt32 cMeta;
|
||||
static const PRInt32 cOS;
|
||||
|
||||
static const PRInt32 cShiftMask;
|
||||
static const PRInt32 cAltMask;
|
||||
static const PRInt32 cControlMask;
|
||||
static const PRInt32 cMetaMask;
|
||||
static const PRInt32 cOSMask;
|
||||
|
||||
static const PRInt32 cAllModifiers;
|
||||
|
||||
@ -193,8 +195,6 @@ protected:
|
||||
|
||||
// The following four values make up 32 bits.
|
||||
PRUint8 mPhase; // The phase (capturing, bubbling)
|
||||
PRUint8 mKeyMask; // Which modifier keys this event handler expects to have down
|
||||
// in order to be matched.
|
||||
PRUint8 mType; // The type of the handler. The handler is either a XUL key
|
||||
// handler, an XBL "command" event, or a normal XBL event with
|
||||
// accompanying JavaScript. The high bit is used to indicate
|
||||
@ -203,6 +203,9 @@ protected:
|
||||
// stores whether or not we're a key code or char code.
|
||||
// For mouse events, stores the clickCount.
|
||||
|
||||
PRInt32 mKeyMask; // Which modifier keys this event handler expects to have down
|
||||
// in order to be matched.
|
||||
|
||||
// The primary filter information for mouse/key events.
|
||||
PRInt32 mDetail; // For key events, contains a charcode or keycode. For
|
||||
// mouse events, stores the button info.
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -25,7 +25,6 @@
|
||||
#include "nsEventListenerManager.h"
|
||||
#include "nsIRDFCompositeDataSource.h"
|
||||
#include "nsIRDFResource.h"
|
||||
#include "nsIScriptEventHandlerOwner.h"
|
||||
#include "nsBindingManager.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsIXULTemplateBuilder.h"
|
||||
@ -74,8 +73,7 @@ class nsXULPrototypeAttribute
|
||||
{
|
||||
public:
|
||||
nsXULPrototypeAttribute()
|
||||
: mName(nsGkAtoms::id), // XXX this is a hack, but names have to have a value
|
||||
mEventHandler(nsnull)
|
||||
: mName(nsGkAtoms::id) // XXX this is a hack, but names have to have a value
|
||||
{
|
||||
XUL_PROTOTYPE_ATTRIBUTE_METER(gNumAttributes);
|
||||
MOZ_COUNT_CTOR(nsXULPrototypeAttribute);
|
||||
@ -85,53 +83,10 @@ public:
|
||||
|
||||
nsAttrName mName;
|
||||
nsAttrValue mValue;
|
||||
// mEventHandler is only valid for the language ID specified in the
|
||||
// containing nsXULPrototypeElement. We would ideally use
|
||||
// nsScriptObjectHolder, but want to avoid the extra lang ID.
|
||||
JSObject* mEventHandler;
|
||||
|
||||
#ifdef XUL_PROTOTYPE_ATTRIBUTE_METERING
|
||||
/**
|
||||
If enough attributes, on average, are event handlers, it pays to keep
|
||||
mEventHandler here, instead of maintaining a separate mapping in each
|
||||
nsXULElement associating those mName values with their mEventHandlers.
|
||||
Assume we don't need to keep mNameSpaceID along with mName in such an
|
||||
event-handler-only name-to-function-pointer mapping.
|
||||
|
||||
Let
|
||||
minAttrSize = sizeof(mNodeInof) + sizeof(mValue)
|
||||
mappingSize = sizeof(mNodeInfo) + sizeof(mEventHandler)
|
||||
elemOverhead = nElems * sizeof(MappingPtr)
|
||||
|
||||
Then
|
||||
nAttrs * minAttrSize + nEventHandlers * mappingSize + elemOverhead
|
||||
> nAttrs * (minAttrSize + mappingSize - sizeof(mNodeInfo))
|
||||
which simplifies to
|
||||
nEventHandlers * mappingSize + elemOverhead
|
||||
> nAttrs * (mappingSize - sizeof(mNodeInfo))
|
||||
or
|
||||
nEventHandlers + (nElems * sizeof(MappingPtr)) / mappingSize
|
||||
> nAttrs * (1 - sizeof(mNodeInfo) / mappingSize)
|
||||
|
||||
If nsCOMPtr and all other pointers are the same size, this reduces to
|
||||
nEventHandlers + nElems / 2 > nAttrs / 2
|
||||
|
||||
To measure how many attributes are event handlers, compile XUL source
|
||||
with XUL_PROTOTYPE_ATTRIBUTE_METERING and watch the counters below.
|
||||
Plug into the above relation -- if true, it pays to put mEventHandler
|
||||
in nsXULPrototypeAttribute rather than to keep a separate mapping.
|
||||
|
||||
Recent numbers after opening four browser windows:
|
||||
nElems 3537, nAttrs 2528, nEventHandlers 1042
|
||||
giving 1042 + 3537/2 > 2528/2 or 2810 > 1264.
|
||||
|
||||
As it happens, mEventHandler also makes this struct power-of-2 sized,
|
||||
8 words on most architectures, which makes for strength-reduced array
|
||||
index-to-pointer calculations.
|
||||
*/
|
||||
static PRUint32 gNumElements;
|
||||
static PRUint32 gNumAttributes;
|
||||
static PRUint32 gNumEventHandlers;
|
||||
static PRUint32 gNumCacheTests;
|
||||
static PRUint32 gNumCacheHits;
|
||||
static PRUint32 gNumCacheSets;
|
||||
@ -143,9 +98,7 @@ public:
|
||||
/**
|
||||
|
||||
A prototype content model element that holds the "primordial" values
|
||||
that have been parsed from the original XUL document. A
|
||||
'lightweight' nsXULElement may delegate its representation to this
|
||||
structure, which is shared.
|
||||
that have been parsed from the original XUL document.
|
||||
|
||||
*/
|
||||
|
||||
@ -195,11 +148,10 @@ public:
|
||||
nsXULPrototypeElement()
|
||||
: nsXULPrototypeNode(eType_Element),
|
||||
mNumAttributes(0),
|
||||
mAttributes(nsnull),
|
||||
mHasIdAttribute(false),
|
||||
mHasClassAttribute(false),
|
||||
mHasStyleAttribute(false),
|
||||
mHoldsScriptObject(false)
|
||||
mAttributes(nsnull)
|
||||
{
|
||||
}
|
||||
|
||||
@ -239,14 +191,11 @@ public:
|
||||
|
||||
nsCOMPtr<nsINodeInfo> mNodeInfo; // [OWNER]
|
||||
|
||||
PRUint32 mNumAttributes;
|
||||
PRUint32 mNumAttributes:29;
|
||||
PRUint32 mHasIdAttribute:1;
|
||||
PRUint32 mHasClassAttribute:1;
|
||||
PRUint32 mHasStyleAttribute:1;
|
||||
nsXULPrototypeAttribute* mAttributes; // [OWNER]
|
||||
|
||||
bool mHasIdAttribute:1;
|
||||
bool mHasClassAttribute:1;
|
||||
bool mHasStyleAttribute:1;
|
||||
bool mHoldsScriptObject:1;
|
||||
|
||||
};
|
||||
|
||||
class nsXULDocument;
|
||||
@ -409,23 +358,6 @@ public:
|
||||
bool aCompileEventHandlers);
|
||||
virtual void UnbindFromTree(bool aDeep, bool aNullParent);
|
||||
virtual void RemoveChildAt(PRUint32 aIndex, bool aNotify);
|
||||
virtual bool GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||
nsAString& aResult) const;
|
||||
virtual bool HasAttr(PRInt32 aNameSpaceID, nsIAtom* aName) const;
|
||||
virtual bool AttrValueIs(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||
const nsAString& aValue,
|
||||
nsCaseTreatment aCaseSensitive) const;
|
||||
virtual bool AttrValueIs(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||
nsIAtom* aValue,
|
||||
nsCaseTreatment aCaseSensitive) const;
|
||||
virtual PRInt32 FindAttrValueIn(PRInt32 aNameSpaceID,
|
||||
nsIAtom* aName,
|
||||
AttrValuesArray* aValues,
|
||||
nsCaseTreatment aCaseSensitive) const;
|
||||
virtual nsresult UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||
bool aNotify);
|
||||
virtual const nsAttrName* GetAttrNameAt(PRUint32 aIndex) const;
|
||||
virtual PRUint32 GetAttrCount() const;
|
||||
virtual void DestroyContent();
|
||||
|
||||
#ifdef DEBUG
|
||||
@ -442,11 +374,8 @@ public:
|
||||
virtual nsIContent *GetBindingParent() const;
|
||||
virtual bool IsNodeOfType(PRUint32 aFlags) const;
|
||||
virtual bool IsFocusable(PRInt32 *aTabIndex = nsnull, bool aWithMouse = false);
|
||||
virtual nsIAtom* DoGetID() const;
|
||||
virtual const nsAttrValue* DoGetClasses() const;
|
||||
|
||||
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker);
|
||||
virtual mozilla::css::StyleRule* GetInlineStyleRule();
|
||||
virtual nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute,
|
||||
PRInt32 aModType) const;
|
||||
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const;
|
||||
@ -472,8 +401,6 @@ public:
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
virtual nsEventStates IntrinsicState() const;
|
||||
|
||||
nsresult EnsureLocalStyle();
|
||||
|
||||
nsresult GetFrameLoader(nsIFrameLoader** aFrameLoader);
|
||||
already_AddRefed<nsFrameLoader> GetFrameLoader();
|
||||
nsresult SwapFrameLoaders(nsIFrameLoaderOwner* aOtherOwner);
|
||||
@ -488,22 +415,10 @@ public:
|
||||
mBindingParent = aBindingParent;
|
||||
}
|
||||
|
||||
const nsAttrValue* GetAttrValue(const nsAString& aName);
|
||||
|
||||
/**
|
||||
* Get the attr info for the given namespace ID and attribute name.
|
||||
* The namespace ID must not be kNameSpaceID_Unknown and the name
|
||||
* must not be null.
|
||||
*/
|
||||
virtual nsAttrInfo GetAttrInfo(PRInt32 aNamespaceID, nsIAtom* aName) const;
|
||||
|
||||
virtual nsXPCClassInfo* GetClassInfo();
|
||||
|
||||
virtual nsIDOMNode* AsDOMNode() { return this; }
|
||||
protected:
|
||||
// XXX This can be removed when nsNodeUtils::CloneAndAdopt doesn't need
|
||||
// access to mPrototype anymore.
|
||||
friend class nsNodeUtils;
|
||||
|
||||
// This can be removed if EnsureContentsGenerated dies.
|
||||
friend class nsNSElementTearoff;
|
||||
@ -536,9 +451,6 @@ protected:
|
||||
|
||||
nsresult LoadSrc();
|
||||
|
||||
// Required fields
|
||||
nsRefPtr<nsXULPrototypeElement> mPrototype;
|
||||
|
||||
/**
|
||||
* The nearest enclosing content node with a binding
|
||||
* that created us. [Weak]
|
||||
@ -548,12 +460,7 @@ protected:
|
||||
/**
|
||||
* Abandon our prototype linkage, and copy all attributes locally
|
||||
*/
|
||||
nsresult MakeHeavyweight();
|
||||
|
||||
const nsAttrValue* FindLocalOrProtoAttr(PRInt32 aNameSpaceID,
|
||||
nsIAtom *aName) const {
|
||||
return nsXULElement::GetAttrInfo(aNameSpaceID, aName).mValue;
|
||||
}
|
||||
nsresult MakeHeavyweight(nsXULPrototypeElement* aPrototype);
|
||||
|
||||
virtual nsresult BeforeSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
||||
const nsAttrValueOrString* aValue,
|
||||
@ -571,11 +478,6 @@ protected:
|
||||
virtual nsEventListenerManager*
|
||||
GetEventListenerManagerForAttr(nsIAtom* aAttrName, bool* aDefer);
|
||||
|
||||
/**
|
||||
* Return our prototype's attribute, if one exists.
|
||||
*/
|
||||
nsXULPrototypeAttribute *FindPrototypeAttribute(PRInt32 aNameSpaceID,
|
||||
nsIAtom *aName) const;
|
||||
/**
|
||||
* Add a listener for the specified attribute, if appropriate.
|
||||
*/
|
||||
@ -593,8 +495,6 @@ protected:
|
||||
|
||||
void SetDrawsInTitlebar(bool aState);
|
||||
|
||||
const nsAttrName* InternalGetExistingAttrNameFromQName(const nsAString& aStr) const;
|
||||
|
||||
void RemoveBroadcaster(const nsAString & broadcasterId);
|
||||
|
||||
protected:
|
||||
@ -617,8 +517,6 @@ protected:
|
||||
Create(nsXULPrototypeElement* aPrototype, nsINodeInfo *aNodeInfo,
|
||||
bool aIsScriptable);
|
||||
|
||||
friend class nsScriptEventHandlerOwnerTearoff;
|
||||
|
||||
bool IsReadWriteTextElement() const
|
||||
{
|
||||
const nsIAtom* tag = Tag();
|
||||
|
@ -14,7 +14,6 @@ const Cu = Components.utils;
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Webapps.jsm");
|
||||
|
||||
const APPS_SERVICE_CONTRACTID = "@mozilla.org/AppsService;1";
|
||||
const APPS_SERVICE_CID = Components.ID("{05072afa-92fe-45bf-ae22-39b69c117058}");
|
||||
|
||||
function AppsService()
|
||||
@ -35,12 +34,6 @@ AppsService.prototype = {
|
||||
|
||||
classID : APPS_SERVICE_CID,
|
||||
QueryInterface : XPCOMUtils.generateQI([Ci.nsIAppsService]),
|
||||
|
||||
classInfo : XPCOMUtils.generateCI({classID: APPS_SERVICE_CID,
|
||||
contractID: APPS_SERVICE_CONTRACTID,
|
||||
classDescription: "AppsService",
|
||||
interfaces: [Ci.nsIAppsService],
|
||||
flags: Ci.nsIClassInfo.DOM_OBJECT})
|
||||
}
|
||||
|
||||
const NSGetFactory = XPCOMUtils.generateNSGetFactory([AppsService])
|
||||
|
@ -56,7 +56,6 @@ EXPORTS = \
|
||||
nsIScriptGlobalObject.h \
|
||||
nsIScriptGlobalObjectOwner.h \
|
||||
nsIScriptNameSpaceManager.h \
|
||||
nsIScriptEventHandlerOwner.h \
|
||||
nsIScriptObjectPrincipal.h \
|
||||
nsIScriptRuntime.h \
|
||||
nsIScriptTimeoutHandler.h \
|
||||
|
@ -158,6 +158,10 @@ Navigator::Invalidate()
|
||||
if (mTelephony) {
|
||||
mTelephony = nsnull;
|
||||
}
|
||||
|
||||
if (mVoicemail) {
|
||||
mVoicemail = nsnull;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (mConnection) {
|
||||
@ -1180,6 +1184,37 @@ Navigator::GetMozTelephony(nsIDOMTelephony** aTelephony)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
Navigator::GetMozVoicemail(nsIDOMMozVoicemail** aVoicemail)
|
||||
{
|
||||
*aVoicemail = nsnull;
|
||||
|
||||
if (!mVoicemail) {
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
|
||||
NS_ENSURE_TRUE(window && window->GetDocShell(), NS_OK);
|
||||
|
||||
// Chrome is always allowed access, so do the permission check only
|
||||
// for non-chrome pages.
|
||||
if (!nsContentUtils::IsCallerChrome()) {
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryInterface(window->GetExtantDocument());
|
||||
NS_ENSURE_TRUE(doc, NS_OK);
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
doc->NodePrincipal()->GetURI(getter_AddRefs(uri));
|
||||
|
||||
if (!nsContentUtils::URIIsChromeOrInPref(uri, "dom.voicemail.whitelist")) {
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
nsresult rv = NS_NewVoicemail(window, getter_AddRefs(mVoicemail));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
NS_ADDREF(*aVoicemail = mVoicemail);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#endif // MOZ_B2G_RIL
|
||||
|
||||
//*****************************************************************************
|
||||
|
@ -32,6 +32,7 @@ class nsIDOMMozConnection;
|
||||
#ifdef MOZ_B2G_RIL
|
||||
#include "nsIDOMNavigatorTelephony.h"
|
||||
class nsIDOMTelephony;
|
||||
class nsIDOMMozVoicemail;
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_B2G_BT
|
||||
@ -147,6 +148,7 @@ private:
|
||||
nsRefPtr<sms::SmsManager> mSmsManager;
|
||||
#ifdef MOZ_B2G_RIL
|
||||
nsCOMPtr<nsIDOMTelephony> mTelephony;
|
||||
nsCOMPtr<nsIDOMMozVoicemail> mVoicemail;
|
||||
#endif
|
||||
nsRefPtr<network::Connection> mConnection;
|
||||
nsRefPtr<network::MobileConnection> mMobileConnection;
|
||||
|
@ -85,7 +85,6 @@
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsScriptNameSpaceManager.h"
|
||||
#include "nsIScriptEventHandlerOwner.h"
|
||||
#include "nsIJSNativeInitializer.h"
|
||||
#include "nsJSEnvironment.h"
|
||||
|
||||
@ -512,6 +511,8 @@ using mozilla::dom::indexedDB::IDBWrapperCache;
|
||||
#include "Telephony.h"
|
||||
#include "TelephonyCall.h"
|
||||
#include "CallEvent.h"
|
||||
#include "nsIDOMVoicemail.h"
|
||||
#include "nsIDOMVoicemailEvent.h"
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_B2G_BT
|
||||
@ -1667,6 +1668,10 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
||||
EVENTTARGET_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(CallEvent, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(MozVoicemail, nsEventTargetSH,
|
||||
EVENTTARGET_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(MozVoicemailEvent, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_B2G_BT
|
||||
@ -4480,6 +4485,16 @@ nsDOMClassInfo::Init()
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMCallEvent)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEvent)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(MozVoicemail, nsIDOMMozVoicemail)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozVoicemail)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(MozVoicemailEvent, nsIDOMMozVoicemailEvent)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozVoicemailEvent)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEvent)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_B2G_BT
|
||||
|
@ -523,6 +523,8 @@ DOMCI_CLASS(MozWifiConnectionInfoEvent)
|
||||
DOMCI_CLASS(Telephony)
|
||||
DOMCI_CLASS(TelephonyCall)
|
||||
DOMCI_CLASS(CallEvent)
|
||||
DOMCI_CLASS(MozVoicemail)
|
||||
DOMCI_CLASS(MozVoicemailEvent)
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_B2G_BT
|
||||
|
@ -1,64 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nsIScriptEventHandlerOwner_h__
|
||||
#define nsIScriptEventHandlerOwner_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsAString.h"
|
||||
|
||||
template<class> class nsScriptObjectHolder;
|
||||
|
||||
class nsIAtom;
|
||||
|
||||
#define NS_ISCRIPTEVENTHANDLEROWNER_IID \
|
||||
{ 0xc8f35f71, 0x07d1, 0x4ff3, \
|
||||
{ 0xa3, 0x2f, 0x65, 0xcb, 0x35, 0x64, 0xac, 0xe0 } }
|
||||
|
||||
/**
|
||||
* Associate a compiled event handler with its target object, which owns it
|
||||
* This is an adjunct to nsIScriptObjectOwner that nsEventListenerManager's
|
||||
* implementation queries for, in order to avoid recompiling a recurrent or
|
||||
* prototype-inherited event handler.
|
||||
*/
|
||||
class nsIScriptEventHandlerOwner : public nsISupports
|
||||
{
|
||||
public:
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISCRIPTEVENTHANDLEROWNER_IID)
|
||||
|
||||
/**
|
||||
* Compile the specified event handler. This does NOT bind it to
|
||||
* anything. That's the caller's responsibility.
|
||||
*
|
||||
* @param aContext the context to use when creating event handler
|
||||
* @param aName the name of the handler
|
||||
* @param aBody the handler script body
|
||||
* @param aURL the URL or filename for error messages
|
||||
* @param aLineNo the starting line number of the script for error messages
|
||||
* @param aHandler the holder for the compiled handler object
|
||||
*/
|
||||
virtual nsresult CompileEventHandler(nsIScriptContext* aContext,
|
||||
nsIAtom *aName,
|
||||
const nsAString& aBody,
|
||||
const char* aURL,
|
||||
PRUint32 aLineNo,
|
||||
nsScriptObjectHolder<JSObject>& aHandler) = 0;
|
||||
|
||||
/**
|
||||
* Retrieve an already-compiled event handler that can be bound to a
|
||||
* target object using a script context.
|
||||
*
|
||||
* @param aName the name of the event handler to retrieve
|
||||
* @param aHandler the holder for the compiled event handler.
|
||||
*/
|
||||
virtual nsresult GetCompiledEventHandler(nsIAtom *aName,
|
||||
nsScriptObjectHolder<JSObject>& aHandler) = 0;
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsIScriptEventHandlerOwner,
|
||||
NS_ISCRIPTEVENTHANDLEROWNER_IID)
|
||||
|
||||
#endif // nsIScriptEventHandlerOwner_h__
|
@ -37,6 +37,7 @@
|
||||
#include "nsITextToSubURI.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "jsfriendapi.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
||||
static nsresult
|
||||
GetContextFromStack(nsIJSContextStack *aStack, JSContext **aContext)
|
||||
@ -168,6 +169,14 @@ nsresult
|
||||
nsLocation::CheckURL(nsIURI* aURI, nsIDocShellLoadInfo** aLoadInfo)
|
||||
{
|
||||
*aLoadInfo = nsnull;
|
||||
JSContext* cx;
|
||||
if ((cx = nsContentUtils::GetCurrentJSContext())) {
|
||||
nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager();
|
||||
NS_ENSURE_STATE(ssm);
|
||||
// Check to see if URI is allowed.
|
||||
nsresult rv = ssm->CheckLoadURIFromScript(cx, aURI);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocShell> docShell(do_QueryReferent(mDocShell));
|
||||
NS_ENSURE_TRUE(docShell, NS_ERROR_NOT_AVAILABLE);
|
||||
@ -178,8 +187,6 @@ nsLocation::CheckURL(nsIURI* aURI, nsIDocShellLoadInfo** aLoadInfo)
|
||||
stack(do_GetService("@mozilla.org/js/xpc/ContextStack;1", &rv));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
JSContext *cx;
|
||||
|
||||
NS_ENSURE_SUCCESS(GetContextFromStack(stack, &cx), NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsISupports> owner;
|
||||
|
@ -425,5 +425,147 @@ ThrowingConstructorWorkers(JSContext* cx, unsigned argc, JS::Value* vp)
|
||||
return Throw<false>(cx, NS_ERROR_FAILURE);
|
||||
}
|
||||
|
||||
bool
|
||||
XrayResolveProperty(JSContext* cx, JSObject* wrapper, jsid id,
|
||||
JSPropertyDescriptor* desc,
|
||||
// And the things we need to determine the descriptor
|
||||
Prefable<JSFunctionSpec>* methods,
|
||||
jsid* methodIds,
|
||||
JSFunctionSpec* methodSpecs,
|
||||
size_t methodCount,
|
||||
Prefable<JSPropertySpec>* attributes,
|
||||
jsid* attributeIds,
|
||||
JSPropertySpec* attributeSpecs,
|
||||
size_t attributeCount,
|
||||
Prefable<ConstantSpec>* constants,
|
||||
jsid* constantIds,
|
||||
ConstantSpec* constantSpecs,
|
||||
size_t constantCount)
|
||||
{
|
||||
for (size_t prefIdx = 0; prefIdx < methodCount; ++prefIdx) {
|
||||
MOZ_ASSERT(methods[prefIdx].specs);
|
||||
if (methods[prefIdx].enabled) {
|
||||
// Set i to be the index into our full list of ids/specs that we're
|
||||
// looking at now.
|
||||
size_t i = methods[prefIdx].specs - methodSpecs;
|
||||
for ( ; methodIds[i] != JSID_VOID; ++i) {
|
||||
if (id == methodIds[i]) {
|
||||
JSFunction *fun = JS_NewFunctionById(cx, methodSpecs[i].call,
|
||||
methodSpecs[i].nargs, 0,
|
||||
wrapper, id);
|
||||
if (!fun)
|
||||
return false;
|
||||
JSObject *funobj = JS_GetFunctionObject(fun);
|
||||
desc->value.setObject(*funobj);
|
||||
desc->attrs = methodSpecs[i].flags;
|
||||
desc->obj = wrapper;
|
||||
desc->setter = nsnull;
|
||||
desc->getter = nsnull;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t prefIdx = 0; prefIdx < attributeCount; ++prefIdx) {
|
||||
MOZ_ASSERT(attributes[prefIdx].specs);
|
||||
if (attributes[prefIdx].enabled) {
|
||||
// Set i to be the index into our full list of ids/specs that we're
|
||||
// looking at now.
|
||||
size_t i = attributes[prefIdx].specs - attributeSpecs;
|
||||
for ( ; attributeIds[i] != JSID_VOID; ++i) {
|
||||
if (id == attributeIds[i]) {
|
||||
desc->attrs = attributeSpecs[i].flags;
|
||||
desc->obj = wrapper;
|
||||
desc->setter = attributeSpecs[i].setter;
|
||||
desc->getter = attributeSpecs[i].getter;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t prefIdx = 0; prefIdx < constantCount; ++prefIdx) {
|
||||
MOZ_ASSERT(constants[prefIdx].specs);
|
||||
if (constants[prefIdx].enabled) {
|
||||
// Set i to be the index into our full list of ids/specs that we're
|
||||
// looking at now.
|
||||
size_t i = constants[prefIdx].specs - constantSpecs;
|
||||
for ( ; constantIds[i] != JSID_VOID; ++i) {
|
||||
if (id == constantIds[i]) {
|
||||
desc->attrs = JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT;
|
||||
desc->obj = wrapper;
|
||||
desc->value = constantSpecs[i].value;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
XrayEnumerateProperties(JS::AutoIdVector& props,
|
||||
Prefable<JSFunctionSpec>* methods,
|
||||
jsid* methodIds,
|
||||
JSFunctionSpec* methodSpecs,
|
||||
size_t methodCount,
|
||||
Prefable<JSPropertySpec>* attributes,
|
||||
jsid* attributeIds,
|
||||
JSPropertySpec* attributeSpecs,
|
||||
size_t attributeCount,
|
||||
Prefable<ConstantSpec>* constants,
|
||||
jsid* constantIds,
|
||||
ConstantSpec* constantSpecs,
|
||||
size_t constantCount)
|
||||
{
|
||||
for (size_t prefIdx = 0; prefIdx < methodCount; ++prefIdx) {
|
||||
MOZ_ASSERT(methods[prefIdx].specs);
|
||||
if (methods[prefIdx].enabled) {
|
||||
// Set i to be the index into our full list of ids/specs that we're
|
||||
// looking at now.
|
||||
size_t i = methods[prefIdx].specs - methodSpecs;
|
||||
for ( ; methodIds[i] != JSID_VOID; ++i) {
|
||||
if ((methodSpecs[i].flags & JSPROP_ENUMERATE) &&
|
||||
!props.append(methodIds[i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t prefIdx = 0; prefIdx < attributeCount; ++prefIdx) {
|
||||
MOZ_ASSERT(attributes[prefIdx].specs);
|
||||
if (attributes[prefIdx].enabled) {
|
||||
// Set i to be the index into our full list of ids/specs that we're
|
||||
// looking at now.
|
||||
size_t i = attributes[prefIdx].specs - attributeSpecs;
|
||||
for ( ; attributeIds[i] != JSID_VOID; ++i) {
|
||||
if ((attributeSpecs[i].flags & JSPROP_ENUMERATE) &&
|
||||
!props.append(attributeIds[i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t prefIdx = 0; prefIdx < constantCount; ++prefIdx) {
|
||||
MOZ_ASSERT(constants[prefIdx].specs);
|
||||
if (constants[prefIdx].enabled) {
|
||||
// Set i to be the index into our full list of ids/specs that we're
|
||||
// looking at now.
|
||||
size_t i = constants[prefIdx].specs - constantSpecs;
|
||||
for ( ; constantIds[i] != JSID_VOID; ++i) {
|
||||
if (!props.append(constantIds[i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
@ -1008,6 +1008,39 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
// Implementation of the bits that XrayWrapper needs
|
||||
bool
|
||||
XrayResolveProperty(JSContext* cx, JSObject* wrapper, jsid id,
|
||||
JSPropertyDescriptor* desc,
|
||||
// And the things we need to determine the descriptor
|
||||
Prefable<JSFunctionSpec>* methods,
|
||||
jsid* methodIds,
|
||||
JSFunctionSpec* methodSpecs,
|
||||
size_t methodCount,
|
||||
Prefable<JSPropertySpec>* attributes,
|
||||
jsid* attributeIds,
|
||||
JSPropertySpec* attributeSpecs,
|
||||
size_t attributeCount,
|
||||
Prefable<ConstantSpec>* constants,
|
||||
jsid* constantIds,
|
||||
ConstantSpec* constantSpecs,
|
||||
size_t constantCount);
|
||||
|
||||
bool
|
||||
XrayEnumerateProperties(JS::AutoIdVector& props,
|
||||
Prefable<JSFunctionSpec>* methods,
|
||||
jsid* methodIds,
|
||||
JSFunctionSpec* methodSpecs,
|
||||
size_t methodCount,
|
||||
Prefable<JSPropertySpec>* attributes,
|
||||
jsid* attributeIds,
|
||||
JSPropertySpec* attributeSpecs,
|
||||
size_t attributeCount,
|
||||
Prefable<ConstantSpec>* constants,
|
||||
jsid* constantIds,
|
||||
ConstantSpec* constantSpecs,
|
||||
size_t constantCount);
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
|
@ -769,11 +769,12 @@ class PropertyDefiner:
|
||||
return "s" + self.name
|
||||
return "NULL"
|
||||
def usedForXrays(self, chrome):
|
||||
# We only need Xrays for methods and attributes. And we only need them
|
||||
# for the non-chrome ones if we have no chromeonly things. Otherwise
|
||||
# (we have chromeonly attributes) we need Xrays for the chrome
|
||||
# methods/attributes. Finally, in workers there are no Xrays.
|
||||
return ((self.name is "Methods" or self.name is "Attributes") and
|
||||
# We only need Xrays for methods, attributes and constants. And we only
|
||||
# need them for the non-chrome ones if we have no chromeonly things.
|
||||
# Otherwise (we have chromeonly attributes) we need Xrays for the chrome
|
||||
# methods/attributes/constants. Finally, in workers there are no Xrays.
|
||||
return ((self.name is "Methods" or self.name is "Attributes" or
|
||||
self.name is "Constants") and
|
||||
chrome == self.hasChromeOnly() and
|
||||
not self.descriptor.workers)
|
||||
|
||||
@ -1012,7 +1013,7 @@ class PropertyArrays():
|
||||
|
||||
@staticmethod
|
||||
def xrayRelevantArrayNames():
|
||||
return [ "methods", "attrs" ]
|
||||
return [ "methods", "attrs", "consts" ]
|
||||
|
||||
def hasChromeOnly(self):
|
||||
return reduce(lambda b, a: b or getattr(self, a).hasChromeOnly(),
|
||||
@ -3793,122 +3794,66 @@ class CGClass(CGThing):
|
||||
result = result + memberString
|
||||
return result
|
||||
|
||||
class CGResolveProperty(CGAbstractMethod):
|
||||
class CGXrayHelper(CGAbstractMethod):
|
||||
def __init__(self, descriptor, name, args, properties):
|
||||
CGAbstractMethod.__init__(self, descriptor, name, "bool", args)
|
||||
self.properties = properties
|
||||
|
||||
def definition_body(self):
|
||||
varNames = self.properties.variableNames(True)
|
||||
|
||||
methods = self.properties.methods
|
||||
if methods.hasNonChromeOnly() or methods.hasChromeOnly():
|
||||
methodArgs = """// %(methods)s has an end-of-list marker at the end that we ignore
|
||||
%(methods)s, %(methods)s_ids, %(methods)s_specs, ArrayLength(%(methods)s) - 1""" % varNames
|
||||
else:
|
||||
methodArgs = "NULL, NULL, NULL, 0"
|
||||
methodArgs = CGGeneric(methodArgs)
|
||||
|
||||
attrs = self.properties.attrs
|
||||
if attrs.hasNonChromeOnly() or attrs.hasChromeOnly():
|
||||
attrArgs = """// %(attrs)s has an end-of-list marker at the end that we ignore
|
||||
%(attrs)s, %(attrs)s_ids, %(attrs)s_specs, ArrayLength(%(attrs)s) - 1""" % varNames
|
||||
else:
|
||||
attrArgs = "NULL, NULL, NULL, 0"
|
||||
attrArgs = CGGeneric(attrArgs)
|
||||
|
||||
consts = self.properties.consts
|
||||
if consts.hasNonChromeOnly() or consts.hasChromeOnly():
|
||||
constArgs = """// %(consts)s has an end-of-list marker at the end that we ignore
|
||||
%(consts)s, %(consts)s_ids, %(consts)s_specs, ArrayLength(%(consts)s) - 1""" % varNames
|
||||
else:
|
||||
constArgs = "NULL, NULL, NULL, 0"
|
||||
constArgs = CGGeneric(constArgs)
|
||||
|
||||
prefixArgs = CGGeneric(self.getPrefixArgs())
|
||||
|
||||
return CGIndenter(
|
||||
CGWrapper(CGList([prefixArgs, methodArgs, attrArgs, constArgs], ",\n"),
|
||||
pre=("return Xray%s(" % self.name),
|
||||
post=");",
|
||||
reindent=True)).define()
|
||||
|
||||
class CGResolveProperty(CGXrayHelper):
|
||||
def __init__(self, descriptor, properties):
|
||||
args = [Argument('JSContext*', 'cx'), Argument('JSObject*', 'wrapper'),
|
||||
Argument('jsid', 'id'), Argument('bool', 'set'),
|
||||
Argument('JSPropertyDescriptor*', 'desc')]
|
||||
CGAbstractMethod.__init__(self, descriptor, "ResolveProperty", "bool", args)
|
||||
self.properties = properties
|
||||
def definition_body(self):
|
||||
str = ""
|
||||
CGXrayHelper.__init__(self, descriptor, "ResolveProperty", args,
|
||||
properties)
|
||||
|
||||
varNames = self.properties.variableNames(True)
|
||||
def getPrefixArgs(self):
|
||||
return "cx, wrapper, id, desc"
|
||||
|
||||
methods = self.properties.methods
|
||||
if methods.hasNonChromeOnly() or methods.hasChromeOnly():
|
||||
str += """ // %(methods)s has an end-of-list marker at the end that we ignore
|
||||
for (size_t prefIdx = 0; prefIdx < ArrayLength(%(methods)s)-1; ++prefIdx) {
|
||||
MOZ_ASSERT(%(methods)s[prefIdx].specs);
|
||||
if (%(methods)s[prefIdx].enabled) {
|
||||
// Set i to be the index into our full list of ids/specs that we're
|
||||
// looking at now.
|
||||
size_t i = %(methods)s[prefIdx].specs - %(methods)s_specs;
|
||||
for ( ; %(methods)s_ids[i] != JSID_VOID; ++i) {
|
||||
if (id == %(methods)s_ids[i]) {
|
||||
JSFunction *fun = JS_NewFunctionById(cx, %(methods)s_specs[i].call, %(methods)s_specs[i].nargs, 0, wrapper, id);
|
||||
if (!fun)
|
||||
return false;
|
||||
JSObject *funobj = JS_GetFunctionObject(fun);
|
||||
desc->value.setObject(*funobj);
|
||||
desc->attrs = %(methods)s_specs[i].flags;
|
||||
desc->obj = wrapper;
|
||||
desc->setter = nsnull;
|
||||
desc->getter = nsnull;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
""" % varNames
|
||||
|
||||
attrs = self.properties.attrs
|
||||
if attrs.hasNonChromeOnly() or attrs.hasChromeOnly():
|
||||
str += """ // %(attrs)s has an end-of-list marker at the end that we ignore
|
||||
for (size_t prefIdx = 0; prefIdx < ArrayLength(%(attrs)s)-1; ++prefIdx) {
|
||||
MOZ_ASSERT(%(attrs)s[prefIdx].specs);
|
||||
if (%(attrs)s[prefIdx].enabled) {
|
||||
// Set i to be the index into our full list of ids/specs that we're
|
||||
// looking at now.
|
||||
size_t i = %(attrs)s[prefIdx].specs - %(attrs)s_specs;;
|
||||
for ( ; %(attrs)s_ids[i] != JSID_VOID; ++i) {
|
||||
if (id == %(attrs)s_ids[i]) {
|
||||
desc->attrs = %(attrs)s_specs[i].flags;
|
||||
desc->obj = wrapper;
|
||||
desc->setter = %(attrs)s_specs[i].setter;
|
||||
desc->getter = %(attrs)s_specs[i].getter;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
""" % varNames
|
||||
|
||||
return str + " return true;"
|
||||
|
||||
class CGEnumerateProperties(CGAbstractMethod):
|
||||
class CGEnumerateProperties(CGXrayHelper):
|
||||
def __init__(self, descriptor, properties):
|
||||
args = [Argument('JS::AutoIdVector&', 'props')]
|
||||
CGAbstractMethod.__init__(self, descriptor, "EnumerateProperties", "bool", args)
|
||||
self.properties = properties
|
||||
def definition_body(self):
|
||||
str = ""
|
||||
CGXrayHelper.__init__(self, descriptor, "EnumerateProperties", args,
|
||||
properties)
|
||||
|
||||
varNames = self.properties.variableNames(True)
|
||||
|
||||
methods = self.properties.methods
|
||||
if methods.hasNonChromeOnly() or methods.hasChromeOnly():
|
||||
str += """ // %(methods)s has an end-of-list marker at the end that we ignore
|
||||
for (size_t prefIdx = 0; prefIdx < ArrayLength(%(methods)s)-1; ++prefIdx) {
|
||||
MOZ_ASSERT(%(methods)s[prefIdx].specs);
|
||||
if (%(methods)s[prefIdx].enabled) {
|
||||
// Set i to be the index into our full list of ids/specs that we're
|
||||
// looking at now.
|
||||
size_t i = %(methods)s[prefIdx].specs - %(methods)s_specs;
|
||||
for ( ; %(methods)s_ids[i] != JSID_VOID; ++i) {
|
||||
if ((%(methods)s_specs[i].flags & JSPROP_ENUMERATE) &&
|
||||
!props.append(%(methods)s_ids[i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
""" % varNames
|
||||
|
||||
attrs = self.properties.attrs
|
||||
if attrs.hasNonChromeOnly() or attrs.hasChromeOnly():
|
||||
str += """ // %(attrs)s has an end-of-list marker at the end that we ignore
|
||||
for (size_t prefIdx = 0; prefIdx < ArrayLength(%(attrs)s)-1; ++prefIdx) {
|
||||
MOZ_ASSERT(%(attrs)s[prefIdx].specs);
|
||||
if (%(attrs)s[prefIdx].enabled) {
|
||||
// Set i to be the index into our full list of ids/specs that we're
|
||||
// looking at now.
|
||||
size_t i = %(attrs)s[prefIdx].specs - %(attrs)s_specs;;
|
||||
for ( ; %(attrs)s_ids[i] != JSID_VOID; ++i) {
|
||||
if ((%(attrs)s_specs[i].flags & JSPROP_ENUMERATE) &&
|
||||
!props.append(%(attrs)s_ids[i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
""" % varNames
|
||||
|
||||
return str + " return true;"
|
||||
def getPrefixArgs(self):
|
||||
return "props"
|
||||
|
||||
class CGPrototypeTraitsClass(CGClass):
|
||||
def __init__(self, descriptor, indent=''):
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "nsDOMEventTargetHelper.h"
|
||||
#include "nsIDOMBluetoothManager.h"
|
||||
#include "mozilla/Observer.h"
|
||||
#include "nsIEventTarget.h"
|
||||
|
||||
BEGIN_BLUETOOTH_NAMESPACE
|
||||
|
||||
|
@ -122,6 +122,7 @@ BrowserElementChild.prototype = {
|
||||
addMsgListener("go-back", this._recvGoBack);
|
||||
addMsgListener("go-forward", this._recvGoForward);
|
||||
addMsgListener("reload", this._recvReload);
|
||||
addMsgListener("stop", this._recvStop);
|
||||
addMsgListener("unblock-modal-prompt", this._recvStopWaiting);
|
||||
addMsgListener("fire-ctx-callback", this._recvFireCtxCallback);
|
||||
|
||||
@ -481,6 +482,11 @@ BrowserElementChild.prototype = {
|
||||
}
|
||||
},
|
||||
|
||||
_recvStop: function(data) {
|
||||
let webNav = docShell.QueryInterface(Ci.nsIWebNavigation);
|
||||
webNav.stop(webNav.STOP_NETWORK);
|
||||
},
|
||||
|
||||
_keyEventHandler: function(e) {
|
||||
if (whitelistedEvents.indexOf(e.keyCode) != -1 && !e.defaultPrevented) {
|
||||
sendAsyncMsg('keyevent', {
|
||||
|
@ -169,6 +169,7 @@ function BrowserElementParent(frameLoader) {
|
||||
defineMethod('goBack', this._goBack);
|
||||
defineMethod('goForward', this._goForward);
|
||||
defineMethod('reload', this._reload);
|
||||
defineMethod('stop', this._stop);
|
||||
defineDOMRequestMethod('getScreenshot', 'get-screenshot');
|
||||
defineDOMRequestMethod('getCanGoBack', 'get-can-go-back');
|
||||
defineDOMRequestMethod('getCanGoForward', 'get-can-go-forward');
|
||||
@ -341,6 +342,10 @@ BrowserElementParent.prototype = {
|
||||
this._sendAsyncMsg('reload', {hardReload: hardReload});
|
||||
},
|
||||
|
||||
_stop: function() {
|
||||
this._sendAsyncMsg('stop');
|
||||
},
|
||||
|
||||
_fireKeyEvent: function(data) {
|
||||
let evt = this._window.document.createEvent("KeyboardEvent");
|
||||
evt.initKeyEvent(data.json.type, true, true, this._window,
|
||||
|
@ -81,6 +81,9 @@ MOCHITEST_FILES = \
|
||||
browserElement_BackForward.js \
|
||||
file_bug741717.sjs \
|
||||
browserElement_Reload.js \
|
||||
file_bug709759.sjs \
|
||||
browserElement_Stop.js \
|
||||
test_browserElement_inproc_Stop.html \
|
||||
browserElement_ContextmenuEvents.js \
|
||||
test_browserElement_inproc_ContextmenuEvents.html \
|
||||
$(NULL)
|
||||
@ -119,6 +122,7 @@ MOCHITEST_FILES += \
|
||||
test_browserElement_oop_SecurityChange.html \
|
||||
test_browserElement_oop_BackForward.html \
|
||||
test_browserElement_oop_Reload.html \
|
||||
test_browserElement_oop_Stop.html \
|
||||
test_browserElement_oop_ContextmenuEvents.html \
|
||||
$(NULL)
|
||||
endif #}
|
||||
|
42
dom/browser-element/mochitest/browserElement_Stop.js
Normal file
42
dom/browser-element/mochitest/browserElement_Stop.js
Normal file
@ -0,0 +1,42 @@
|
||||
/* Any copyright is dedicated to the public domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
// Bug 709759 - Test the stop ability of <iframe mozbrowser>.
|
||||
|
||||
// The img that is loaded will never be returned and will block
|
||||
// the page from loading, the timeout ensures that the page is
|
||||
// actually blocked from loading, once stop is called the
|
||||
// image load will be cancaelled and mozbrowserloadend should be called.
|
||||
|
||||
"use strict";
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var iframe;
|
||||
var stopped = false;
|
||||
var imgSrc = 'http://test/tests/dom/browser-element/mochitest/file_bug709759.sjs';
|
||||
|
||||
function runTest() {
|
||||
browserElementTestHelpers.setEnabledPref(true);
|
||||
browserElementTestHelpers.addToWhitelist();
|
||||
|
||||
iframe = document.createElement('iframe');
|
||||
iframe.mozbrowser = true;
|
||||
|
||||
iframe.addEventListener('mozbrowserloadend', loadend);
|
||||
iframe.src = 'data:text/html,<html>' +
|
||||
'<body><img src="' + imgSrc + '" /></body></html>';
|
||||
|
||||
document.body.appendChild(iframe);
|
||||
|
||||
setTimeout(function() {
|
||||
stopped = true;
|
||||
iframe.stop();
|
||||
}, 200);
|
||||
}
|
||||
|
||||
function loadend() {
|
||||
ok(stopped, 'Iframes network connections were stopped');
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
runTest();
|
5
dom/browser-element/mochitest/file_bug709759.sjs
Normal file
5
dom/browser-element/mochitest/file_bug709759.sjs
Normal file
@ -0,0 +1,5 @@
|
||||
function handleRequest(request, response)
|
||||
{
|
||||
response.processAsync();
|
||||
response.setHeader("Content-Type", "image/jpeg", false);
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test of browser element.</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="browserElementTestHelpers.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<script type="application/javascript;version=1.7" src="browserElement_Stop.js">
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,13 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test of browser element.</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="browserElementTestHelpers.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<script type="application/javascript;version=1.7" src="browserElement_Stop.js">
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -25,6 +25,10 @@
|
||||
// Microsoft's API Name hackery sucks
|
||||
#undef CreateEvent
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
#include "nsIVolumeService.h"
|
||||
#endif
|
||||
|
||||
using namespace mozilla::dom;
|
||||
using namespace mozilla::dom::devicestorage;
|
||||
|
||||
@ -270,15 +274,26 @@ nsDOMDeviceStorage::SetRootFileForType(const nsAString& aType, const PRInt32 aIn
|
||||
NS_ASSERTION(dirService, "Must have directory service");
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
// check that /sdcard exists, if it doesn't go no further.
|
||||
NS_NewLocalFile(NS_LITERAL_STRING("/sdcard"), false, getter_AddRefs(f));
|
||||
bool check = false;
|
||||
f->Exists(&check);
|
||||
if (!check) {
|
||||
mFile = nsnull;
|
||||
mFile = nsnull;
|
||||
|
||||
nsCOMPtr<nsIVolumeService> vs = do_GetService(NS_VOLUMESERVICE_CONTRACTID);
|
||||
if (!vs) {
|
||||
return typeResult;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIVolume> v;
|
||||
vs->GetVolumeByPath(NS_LITERAL_STRING("/sdcard"), getter_AddRefs(v));
|
||||
|
||||
if (!v) {
|
||||
return typeResult;
|
||||
}
|
||||
|
||||
PRInt32 state;
|
||||
v->GetState(&state);
|
||||
|
||||
if (state != nsIVolume::STATE_MOUNTED) {
|
||||
return typeResult;
|
||||
}
|
||||
f = nsnull;
|
||||
#endif
|
||||
|
||||
// Picture directory
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "FileCommon.h"
|
||||
|
||||
#include "nsIRequestObserver.h"
|
||||
#include "nsThreadUtils.h"
|
||||
|
||||
class nsIFileStorage;
|
||||
|
||||
|
@ -31,8 +31,7 @@ LOCAL_INCLUDES += \
|
||||
|
||||
DEFINES += -D_IMPL_NS_LAYOUT
|
||||
|
||||
# Bug 770046 - Cannot fail.
|
||||
# MOCHITEST_FILES = test_ipc.html
|
||||
MOCHITEST_FILES = test_ipc.html
|
||||
|
||||
# Need to enable these tests sometime soon.
|
||||
#XPCSHELL_TESTS = unit
|
||||
|
@ -58,6 +58,10 @@ function triggerSecondaryCommand(popup, index)
|
||||
ok(notifications.length > 0, "at least one notification displayed");
|
||||
let notification = notifications[0];
|
||||
|
||||
// Cancel the arrow panel slide-in transition (bug 767133) such that
|
||||
// it won't interfere with us interacting with the dropdown.
|
||||
document.getAnonymousNodes(popup)[0].style.transition = "none";
|
||||
|
||||
notification.button.focus();
|
||||
|
||||
popup.addEventListener("popupshown", function () {
|
||||
|
@ -20,7 +20,7 @@ include "IPC/nsGUIEventIPC.h";
|
||||
|
||||
using IPC::URI;
|
||||
using gfxMatrix;
|
||||
using mozilla::LayersBackend;
|
||||
using mozilla::layers::LayersBackend;
|
||||
using mozilla::WindowsHandle;
|
||||
using nscolor;
|
||||
using nsCompositionEvent;
|
||||
|
@ -1030,7 +1030,7 @@ TabChild::InitWidget(const nsIntSize& size)
|
||||
nsnull // nsDeviceContext
|
||||
);
|
||||
|
||||
LayerManager::LayersBackend be;
|
||||
LayersBackend be;
|
||||
uint64_t id;
|
||||
int32_t maxTextureSize;
|
||||
RenderFrameChild* remoteFrame =
|
||||
|
@ -36,4 +36,6 @@ private:
|
||||
} /* namespace plugins */
|
||||
} /* namespace mozilla */
|
||||
|
||||
#undef slots
|
||||
|
||||
#endif
|
||||
|
@ -13,6 +13,7 @@
|
||||
#ifdef MOZ_WIDGET_QT
|
||||
#include <QtCore/QCoreApplication>
|
||||
#include <QtCore/QEventLoop>
|
||||
#include "NestedLoopTimer.h"
|
||||
#endif
|
||||
|
||||
#include "base/process_util.h"
|
||||
|
@ -133,9 +133,7 @@ SettingsServiceLock.prototype = {
|
||||
flags: nsIClassInfo.DOM_OBJECT})
|
||||
};
|
||||
|
||||
const SETTINGSSERVICE_CONTRACTID = "@mozilla.org/settingsService;1";
|
||||
const SETTINGSSERVICE_CID = Components.ID("{3458e760-8513-11e1-b0c4-0800200c9a66}");
|
||||
const nsISettingsService = Ci.nsISettingsService;
|
||||
|
||||
let myGlobal = this;
|
||||
|
||||
@ -171,13 +169,7 @@ SettingsService.prototype = {
|
||||
},
|
||||
|
||||
classID : SETTINGSSERVICE_CID,
|
||||
QueryInterface : XPCOMUtils.generateQI([nsISettingsService]),
|
||||
|
||||
classInfo : XPCOMUtils.generateCI({classID: SETTINGSSERVICE_CID,
|
||||
contractID: SETTINGSSERVICE_CONTRACTID,
|
||||
classDescription: "SettingsService",
|
||||
interfaces: [nsISettingsService],
|
||||
flags: nsIClassInfo.DOM_OBJECT})
|
||||
QueryInterface : XPCOMUtils.generateQI([Ci.nsISettingsService]),
|
||||
}
|
||||
|
||||
const NSGetFactory = XPCOMUtils.generateNSGetFactory([SettingsService, SettingsServiceLock])
|
||||
|
@ -22,6 +22,8 @@ const MOBILECONNECTIONINFO_CID =
|
||||
Components.ID("{a35cfd39-2d93-4489-ac7d-396475dacb27}");
|
||||
const MOBILENETWORKINFO_CID =
|
||||
Components.ID("{a6c8416c-09b4-46d1-bf29-6520d677d085}");
|
||||
const VOICEMAILSTATUS_CID=
|
||||
Components.ID("{5467f2eb-e214-43ea-9b89-67711241ec8e}");
|
||||
|
||||
const RIL_IPC_MSG_NAMES = [
|
||||
"RIL:CardStateChanged",
|
||||
@ -33,6 +35,7 @@ const RIL_IPC_MSG_NAMES = [
|
||||
"RIL:SelectNetwork",
|
||||
"RIL:SelectNetworkAuto",
|
||||
"RIL:CallStateChanged",
|
||||
"RIL:VoicemailNotification",
|
||||
"RIL:CallError",
|
||||
"RIL:GetCardLock:Return:OK",
|
||||
"RIL:GetCardLock:Return:KO",
|
||||
@ -98,6 +101,25 @@ MobileNetworkInfo.prototype = {
|
||||
state: null
|
||||
};
|
||||
|
||||
function VoicemailStatus() {}
|
||||
VoicemailStatus.prototype = {
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMMozVoicemailStatus]),
|
||||
classID: VOICEMAILSTATUS_CID,
|
||||
classInfo: XPCOMUtils.generateCI({
|
||||
classID: VOICEMAILSTATUS_CID,
|
||||
classDescription: "VoicemailStatus",
|
||||
flags: Ci.nsIClassInfo.DOM_OBJECT,
|
||||
interfaces: [Ci.nsIDOMMozVoicemailStatus]
|
||||
}),
|
||||
|
||||
// nsIDOMMozVoicemailStatus
|
||||
|
||||
hasMessages: false,
|
||||
messageCount: Ci.nsIDOMMozVoicemailStatus.MESSAGE_COUNT_UNKNOWN,
|
||||
returnNumber: null,
|
||||
returnMessage: null
|
||||
};
|
||||
|
||||
function RILContentHelper() {
|
||||
this.voiceConnectionInfo = new MobileConnectionInfo();
|
||||
this.dataConnectionInfo = new MobileConnectionInfo();
|
||||
@ -312,31 +334,54 @@ RILContentHelper.prototype = {
|
||||
},
|
||||
|
||||
_telephonyCallbacks: null,
|
||||
_enumerationTelephonyCallbacks: null,
|
||||
_voicemailCallbacks: null,
|
||||
_enumerateTelephonyCallbacks: null,
|
||||
|
||||
registerTelephonyCallback: function registerTelephonyCallback(callback) {
|
||||
if (this._telephonyCallbacks) {
|
||||
if (this._telephonyCallbacks.indexOf(callback) != -1) {
|
||||
throw new Error("Already registered this callback!");
|
||||
}
|
||||
} else {
|
||||
this._telephonyCallbacks = [];
|
||||
voicemailStatus: null,
|
||||
|
||||
registerCallback: function registerCallback(callbackType, callback) {
|
||||
let callbacks = this[callbackType];
|
||||
if (!callbacks) {
|
||||
callbacks = this[callbackType] = [];
|
||||
}
|
||||
this._telephonyCallbacks.push(callback);
|
||||
debug("Registered telephony callback: " + callback);
|
||||
|
||||
if (callbacks.indexOf(callback) != -1) {
|
||||
throw new Error("Already registered this callback!");
|
||||
}
|
||||
|
||||
callbacks.push(callback);
|
||||
if (DEBUG) debug("Registered " + callbackType + " callback: " + callback);
|
||||
},
|
||||
|
||||
unregisterTelephonyCallback: function unregisterTelephonyCallback(callback) {
|
||||
if (!this._telephonyCallbacks) {
|
||||
unregisterCallback: function unregisterCallback(callbackType, callback) {
|
||||
let callbacks = this[callbackType];
|
||||
if (!callbacks) {
|
||||
return;
|
||||
}
|
||||
let index = this._telephonyCallbacks.indexOf(callback);
|
||||
|
||||
let index = callbacks.indexOf(callback);
|
||||
if (index != -1) {
|
||||
this._telephonyCallbacks.splice(index, 1);
|
||||
debug("Unregistered telephony callback: " + callback);
|
||||
callbacks.splice(index, 1);
|
||||
if (DEBUG) debug("Unregistered telephony callback: " + callback);
|
||||
}
|
||||
},
|
||||
|
||||
registerTelephonyCallback: function registerTelephonyCallback(callback) {
|
||||
this.registerCallback("_telephonyCallbacks", callback);
|
||||
},
|
||||
|
||||
unregisterTelephonyCallback: function unregisteTelephonyCallback(callback) {
|
||||
this.unregisterCallback("_telephonyCallbacks", callback);
|
||||
},
|
||||
|
||||
registerVoicemailCallback: function registerVoicemailCallback(callback) {
|
||||
this.registerCallback("_voicemailCallbacks", callback);
|
||||
},
|
||||
|
||||
unregisterVoicemailCallback: function unregisteVoicemailCallback(callback) {
|
||||
this.unregisterCallback("_voicemailCallbacks", callback);
|
||||
},
|
||||
|
||||
enumerateCalls: function enumerateCalls(callback) {
|
||||
debug("Requesting enumeration of calls for callback: " + callback);
|
||||
cpmm.sendAsyncMessage("RIL:EnumerateCalls");
|
||||
@ -487,14 +532,19 @@ RILContentHelper.prototype = {
|
||||
RIL.GECKO_NETWORK_SELECTION_AUTOMATIC);
|
||||
break;
|
||||
case "RIL:CallStateChanged":
|
||||
this._deliverTelephonyCallback("callStateChanged",
|
||||
[msg.json.callIndex, msg.json.state,
|
||||
msg.json.number, msg.json.isActive]);
|
||||
this._deliverCallback("_telephonyCallbacks",
|
||||
"callStateChanged",
|
||||
[msg.json.callIndex, msg.json.state,
|
||||
msg.json.number, msg.json.isActive]);
|
||||
break;
|
||||
case "RIL:CallError":
|
||||
this._deliverTelephonyCallback("notifyError",
|
||||
[msg.json.callIndex,
|
||||
msg.json.error]);
|
||||
this._deliverCallback("_telephonyCallbacks",
|
||||
"notifyError",
|
||||
[msg.json.callIndex,
|
||||
msg.json.error]);
|
||||
break;
|
||||
case "RIL:VoicemailNotification":
|
||||
this.handleVoicemailNotification(msg.json);
|
||||
break;
|
||||
case "RIL:GetCardLock:Return:OK":
|
||||
case "RIL:SetCardLock:Return:OK":
|
||||
@ -590,14 +640,48 @@ RILContentHelper.prototype = {
|
||||
}
|
||||
},
|
||||
|
||||
_deliverTelephonyCallback: function _deliverTelephonyCallback(name, args) {
|
||||
if (!this._telephonyCallbacks) {
|
||||
handleVoicemailNotification: function handleVoicemailNotification(message) {
|
||||
let changed = false;
|
||||
if (!this.voicemailStatus) {
|
||||
this.voicemailStatus = new VoicemailStatus();
|
||||
}
|
||||
|
||||
if (this.voicemailStatus.hasMessages != message.active) {
|
||||
changed = true;
|
||||
this.voicemailStatus.hasMessages = message.active;
|
||||
}
|
||||
|
||||
if (this.voicemailStatus.messageCount != message.msgCount) {
|
||||
changed = true;
|
||||
this.voicemailStatus.messageCount = message.msgCount;
|
||||
}
|
||||
|
||||
if (this.voicemailStatus.returnNumber != message.returnNumber) {
|
||||
changed = true;
|
||||
this.voicemailStatus.returnNumber = message.returnNumber;
|
||||
}
|
||||
|
||||
if (this.voicemailStatus.returnMessage != message.returnMessage) {
|
||||
changed = true;
|
||||
this.voicemailStatus.returnMessage = message.returnMessage;
|
||||
}
|
||||
|
||||
if (changed) {
|
||||
this._deliverCallback("_voicemailCallbacks",
|
||||
"voicemailNotification",
|
||||
[this.voicemailStatus]);
|
||||
}
|
||||
},
|
||||
|
||||
_deliverCallback: function _deliverCallback(callbackType, name, args) {
|
||||
let thisCallbacks = this[callbackType];
|
||||
if (!thisCallbacks) {
|
||||
return;
|
||||
}
|
||||
|
||||
let callbacks = this._telephonyCallbacks.slice();
|
||||
let callbacks = thisCallbacks.slice();
|
||||
for each (let callback in callbacks) {
|
||||
if (this._telephonyCallbacks.indexOf(callback) == -1) {
|
||||
if (thisCallbacks.indexOf(callback) == -1) {
|
||||
continue;
|
||||
}
|
||||
let handler = callback[name];
|
||||
@ -610,7 +694,7 @@ RILContentHelper.prototype = {
|
||||
debug("callback handler for " + name + " threw an exception: " + e);
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
const NSGetFactory = XPCOMUtils.generateNSGetFactory([RILContentHelper]);
|
||||
|
@ -780,6 +780,19 @@ RadioInterfaceLayer.prototype = {
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: Bug #768441
|
||||
// For now we don't store indicators persistently. When the mwi.discard
|
||||
// flag is false, we'll need to persist the indicator to EFmwis.
|
||||
// See TS 23.040 9.2.3.24.2
|
||||
|
||||
let mwi = message.mwi;
|
||||
if (mwi) {
|
||||
mwi.returnNumber = message.sender || null;
|
||||
mwi.returnMessage = message.fullBody || null;
|
||||
ppmm.sendAsyncMessage("RIL:VoicemailNotification", mwi);
|
||||
return;
|
||||
}
|
||||
|
||||
let id = gSmsDatabaseService.saveReceivedMessage(message.sender || null,
|
||||
message.fullBody || null,
|
||||
message.timestamp);
|
||||
@ -790,6 +803,7 @@ RadioInterfaceLayer.prototype = {
|
||||
message.fullBody || null,
|
||||
message.timestamp,
|
||||
false);
|
||||
|
||||
Services.obs.notifyObservers(sms, kSmsReceivedObserverTopic, null);
|
||||
},
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
interface nsIDOMMozMobileConnectionInfo;
|
||||
interface nsIDOMDOMRequest;
|
||||
interface nsIDOMWindow;
|
||||
interface nsIDOMMozVoicemailStatus;
|
||||
|
||||
[scriptable, uuid(c14c71b8-afba-403b-8320-94593de9380f)]
|
||||
interface nsIRILTelephonyCallback : nsISupports
|
||||
@ -62,6 +63,18 @@ interface nsIRILTelephonyCallback : nsISupports
|
||||
in AString error);
|
||||
};
|
||||
|
||||
[scriptable, uuid(3ac98987-a63c-4ebe-adbd-ff7a0348d804)]
|
||||
interface nsIRILVoicemailCallback : nsISupports
|
||||
{
|
||||
/**
|
||||
* Called when a voicemail notification has been received by the network.
|
||||
*
|
||||
* @param status
|
||||
* The new voicemail status
|
||||
*/
|
||||
void voicemailNotification(in nsIDOMMozVoicemailStatus status);
|
||||
};
|
||||
|
||||
[scriptable, uuid(8a711703-1ee5-4675-9d9a-0b188e944cfe)]
|
||||
interface nsIRILDataCallInfo : nsISupports
|
||||
{
|
||||
@ -117,12 +130,15 @@ interface nsIRILContactCallback : nsISupports
|
||||
* Helper that runs in the content process and exposes information
|
||||
* to the DOM.
|
||||
*/
|
||||
[scriptable, uuid(2f8b0929-2ecf-498c-bfa7-42690509696e)]
|
||||
[scriptable, uuid(d2ec602f-9746-4ada-b0c6-f1c1a3cf3578)]
|
||||
interface nsIRILContentHelper : nsIMobileConnectionProvider
|
||||
{
|
||||
void registerTelephonyCallback(in nsIRILTelephonyCallback callback);
|
||||
void unregisterTelephonyCallback(in nsIRILTelephonyCallback callback);
|
||||
|
||||
void registerVoicemailCallback(in nsIRILVoicemailCallback callback);
|
||||
void unregisterVoicemailCallback(in nsIRILVoicemailCallback callback);
|
||||
|
||||
/**
|
||||
* Will continue calling callback.enumerateCallState until the callback
|
||||
* returns false.
|
||||
@ -145,6 +161,8 @@ interface nsIRILContentHelper : nsIMobileConnectionProvider
|
||||
|
||||
attribute bool microphoneMuted;
|
||||
attribute bool speakerEnabled;
|
||||
|
||||
readonly attribute nsIDOMMozVoicemailStatus voicemailStatus;
|
||||
};
|
||||
|
||||
[scriptable, uuid(fd9e8b38-b839-4d56-8482-3bf1f5c8f2ee)]
|
||||
|
@ -515,7 +515,7 @@ const PDU_TOA_NATIONAL = 0xA0; // National number. Prefix or escape digits
|
||||
const PDU_TOA_NETWORK_SPEC = 0xB0; // Network specific number This is used to
|
||||
// indicate administration/service number
|
||||
// specific to the serving network
|
||||
const PDU_TOA_SUSCRIBER = 0xC0; // Suscriber number. This is used when a
|
||||
const PDU_TOA_SUBSCRIBER = 0xC0; // Subscriber number. This is used when a
|
||||
// specific short number representation is
|
||||
// stored in one or more SCs as part of a
|
||||
// higher layer application
|
||||
@ -657,12 +657,23 @@ const PDU_PID_ME_DEPERSONALIZATION = 0x7E;
|
||||
const PDU_PID_USIM_DATA_DOWNLOAD = 0x7F;
|
||||
|
||||
// DCS - Data Coding Scheme
|
||||
const PDU_DCS_MSG_CODING_7BITS_ALPHABET = 0x00;
|
||||
const PDU_DCS_MSG_CODING_8BITS_ALPHABET = 0x04;
|
||||
const PDU_DCS_MSG_CODING_16BITS_ALPHABET= 0x08;
|
||||
const PDU_DCS_MSG_CLASS_ME_SPECIFIC = 0xF1;
|
||||
const PDU_DCS_MSG_CLASS_SIM_SPECIFIC = 0xF2;
|
||||
const PDU_DCS_MSG_CLASS_TE_SPECIFIC = 0xF3;
|
||||
const PDU_DCS_MSG_CODING_7BITS_ALPHABET = 0x00;
|
||||
const PDU_DCS_MSG_CODING_8BITS_ALPHABET = 0x04;
|
||||
const PDU_DCS_MSG_CODING_16BITS_ALPHABET = 0x08;
|
||||
const PDU_DCS_MSG_CLASS_ME_SPECIFIC = 0xF1;
|
||||
const PDU_DCS_MSG_CLASS_SIM_SPECIFIC = 0xF2;
|
||||
const PDU_DCS_MSG_CLASS_TE_SPECIFIC = 0xF3;
|
||||
const PDU_DCS_CODING_GROUP_BITS = 0xF0;
|
||||
const PDU_DCS_CODING_GROUP_7BITS_DISCARD = 0xC0;
|
||||
const PDU_DCS_CODING_GROUP_7BITS_STORE = 0xD0;
|
||||
const PDU_DCS_CODING_GROUP_16BITS_STORE = 0xE0;
|
||||
const PDU_DCS_MWI_ACTIVE_BITS = 0x08;
|
||||
const PDU_DCS_MWI_ACTIVE_VALUE = 0x08;
|
||||
const PDU_DCS_MWI_TYPE_BITS = 0x03;
|
||||
const PDU_DCS_MWI_TYPE_VOICEMAIL = 0x00;
|
||||
const PDU_DCS_MWI_TYPE_FAX = 0x01;
|
||||
const PDU_DCS_MWI_TYPE_EMAIL = 0x02;
|
||||
const PDU_DCS_MWI_TYPE_OTHER = 0x03;
|
||||
|
||||
// Because service center timestamp omit the century. Yay.
|
||||
const PDU_TIMESTAMP_YEAR_OFFSET = 2000;
|
||||
@ -670,8 +681,8 @@ const PDU_TIMESTAMP_YEAR_OFFSET = 2000;
|
||||
// See 9.2.3.24 TP‑User Data (TP‑UD)
|
||||
const PDU_IEI_CONCATENATED_SHORT_MESSAGES_8BIT = 0x00;
|
||||
const PDU_IEI_SPECIAL_SMS_MESSAGE_INDICATION = 0x01;
|
||||
const PDU_IEI_APPLICATION_PORT_ADDREESING_SCHEME_8BIT = 0x04;
|
||||
const PDU_IEI_APPLICATION_PORT_ADDREESING_SCHEME_16BIT = 0x05;
|
||||
const PDU_IEI_APPLICATION_PORT_ADDRESSING_SCHEME_8BIT = 0x04;
|
||||
const PDU_IEI_APPLICATION_PORT_ADDRESSING_SCHEME_16BIT = 0x05;
|
||||
const PDU_IEI_SMSC_CONTROL_PARAMS = 0x06;
|
||||
const PDU_IEI_UDH_SOURCE_INDICATOR = 0x07;
|
||||
const PDU_IEI_CONCATENATED_SHORT_MESSAGES_16BIT = 0x08;
|
||||
@ -1334,6 +1345,11 @@ const PDU_NL_SINGLE_SHIFT_TABLES = [
|
||||
+ " "
|
||||
];
|
||||
|
||||
// Special SMS Message Indication constants
|
||||
const PDU_MWI_STORE_TYPE_BIT = 0x80;
|
||||
const PDU_MWI_STORE_TYPE_DISCARD = 0x00;
|
||||
const PDU_MWI_STORE_TYPE_STORE = 0x80;
|
||||
|
||||
const RADIOTECH_FAMILY_3GPP = 1; // GSM, WCDMA, LTE
|
||||
const RADIOTECH_FAMILY_3GPP2 = 2; // CDMA, EVDO
|
||||
|
||||
@ -1462,5 +1478,7 @@ const GECKO_RADIO_TECH = [
|
||||
"hspa+",
|
||||
];
|
||||
|
||||
const GECKO_VOICEMAIL_MESSAGE_COUNT_UNKNOWN = -1;
|
||||
|
||||
// Allow this file to be imported via Components.utils.import().
|
||||
const EXPORTED_SYMBOLS = Object.keys(this);
|
||||
|
@ -3962,19 +3962,25 @@ let GsmPDUHelper = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Read 1 + UDHL octets and construct user data header at return.
|
||||
* Read 1 + UDHL octets and construct user data header.
|
||||
*
|
||||
* @return A header object with properties contained in received message.
|
||||
* The properties set include:
|
||||
* <ul>
|
||||
* <li>length: totoal length of the header, default 0.
|
||||
* <li>langIndex: used locking shift table index, default
|
||||
* PDU_NL_IDENTIFIER_DEFAULT.
|
||||
* <li>langShiftIndex: used locking shift table index, default
|
||||
* PDU_NL_IDENTIFIER_DEFAULT.
|
||||
* </ul>
|
||||
* @param msg
|
||||
* message object for output.
|
||||
*
|
||||
* @see 3GPP TS 23.040 9.2.3.24
|
||||
*/
|
||||
readUserDataHeader: function readUserDataHeader() {
|
||||
readUserDataHeader: function readUserDataHeader(msg) {
|
||||
/**
|
||||
* A header object with properties contained in received message.
|
||||
* The properties set include:
|
||||
*
|
||||
* length: totoal length of the header, default 0.
|
||||
* langIndex: used locking shift table index, default
|
||||
* PDU_NL_IDENTIFIER_DEFAULT.
|
||||
* langShiftIndex: used locking shift table index, default
|
||||
* PDU_NL_IDENTIFIER_DEFAULT.
|
||||
*
|
||||
*/
|
||||
let header = {
|
||||
length: 0,
|
||||
langIndex: PDU_NL_IDENTIFIER_DEFAULT,
|
||||
@ -3982,10 +3988,14 @@ let GsmPDUHelper = {
|
||||
};
|
||||
|
||||
header.length = this.readHexOctet();
|
||||
if (DEBUG) debug("Read UDH length: " + header.length);
|
||||
|
||||
let dataAvailable = header.length;
|
||||
while (dataAvailable >= 2) {
|
||||
let id = this.readHexOctet();
|
||||
let length = this.readHexOctet();
|
||||
if (DEBUG) debug("Read UDH id: " + id + ", length: " + length);
|
||||
|
||||
dataAvailable -= 2;
|
||||
|
||||
switch (id) {
|
||||
@ -4001,7 +4011,7 @@ let GsmPDUHelper = {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case PDU_IEI_APPLICATION_PORT_ADDREESING_SCHEME_8BIT: {
|
||||
case PDU_IEI_APPLICATION_PORT_ADDRESSING_SCHEME_8BIT: {
|
||||
let dstp = this.readHexOctet();
|
||||
let orip = this.readHexOctet();
|
||||
dataAvailable -= 2;
|
||||
@ -4016,7 +4026,7 @@ let GsmPDUHelper = {
|
||||
header.originatorPort = orip;
|
||||
break;
|
||||
}
|
||||
case PDU_IEI_APPLICATION_PORT_ADDREESING_SCHEME_16BIT: {
|
||||
case PDU_IEI_APPLICATION_PORT_ADDRESSING_SCHEME_16BIT: {
|
||||
let dstp = (this.readHexOctet() << 8) | this.readHexOctet();
|
||||
let orip = (this.readHexOctet() << 8) | this.readHexOctet();
|
||||
dataAvailable -= 4;
|
||||
@ -4055,6 +4065,41 @@ let GsmPDUHelper = {
|
||||
if (langIndex < PDU_NL_LOCKING_SHIFT_TABLES.length) {
|
||||
header.langIndex = langIndex;
|
||||
}
|
||||
break;
|
||||
case PDU_IEI_SPECIAL_SMS_MESSAGE_INDICATION:
|
||||
let msgInd = this.readHexOctet() & 0xFF;
|
||||
let msgCount = this.readHexOctet();
|
||||
dataAvailable -= 2;
|
||||
|
||||
|
||||
/*
|
||||
* TS 23.040 V6.8.1 Sec 9.2.3.24.2
|
||||
* bits 1 0 : basic message indication type
|
||||
* bits 4 3 2 : extended message indication type
|
||||
* bits 6 5 : Profile id
|
||||
* bit 7 : storage type
|
||||
*/
|
||||
let storeType = msgInd & PDU_MWI_STORE_TYPE_BIT;
|
||||
let mwi = msg.mwi;
|
||||
if (!mwi) {
|
||||
mwi = msg.mwi = {};
|
||||
}
|
||||
|
||||
if (storeType == PDU_MWI_STORE_TYPE_STORE) {
|
||||
// Store message because TP_UDH indicates so, note this may override
|
||||
// the setting in DCS, but that is expected
|
||||
mwi.discard = false;
|
||||
} else if (mwi.discard === undefined) {
|
||||
// storeType == PDU_MWI_STORE_TYPE_DISCARD
|
||||
// only override mwi.discard here if it hasn't already been set
|
||||
mwi.discard = true;
|
||||
}
|
||||
|
||||
mwi.msgCount = msgCount & 0xFF;
|
||||
mwi.active = mwi.msgCount > 0;
|
||||
|
||||
if (DEBUG) debug("MWI in TP_UDH received: " + JSON.stringify(mwi));
|
||||
|
||||
break;
|
||||
default:
|
||||
if (DEBUG) {
|
||||
@ -4083,7 +4128,7 @@ let GsmPDUHelper = {
|
||||
throw new Error("Illegal user data header found!");
|
||||
}
|
||||
|
||||
return header;
|
||||
msg.header = header;
|
||||
},
|
||||
|
||||
/**
|
||||
@ -4258,9 +4303,21 @@ let GsmPDUHelper = {
|
||||
switch (msg.epid) {
|
||||
case PDU_PID_SHORT_MESSAGE_TYPE_0:
|
||||
return;
|
||||
case PDU_PID_RETURN_CALL_MESSAGE:
|
||||
// Level 1 of message waiting indication:
|
||||
// Only a return call message is provided
|
||||
let mwi = msg.mwi = {};
|
||||
|
||||
// TODO: When should we de-activate the level 1 indicator?
|
||||
mwi.active = true;
|
||||
mwi.discard = false;
|
||||
mwi.msgCount = GECKO_VOICEMAIL_MESSAGE_COUNT_UNKNOWN;
|
||||
if (DEBUG) debug("TP-PID got return call message: " + msg.sender);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
msg.epid = PDU_PID_DEFAULT;
|
||||
},
|
||||
|
||||
@ -4274,6 +4331,10 @@ let GsmPDUHelper = {
|
||||
*/
|
||||
readDataCodingScheme: function readDataCodingScheme(msg) {
|
||||
let dcs = this.readHexOctet();
|
||||
if (DEBUG) debug("PDU: read dcs: " + dcs);
|
||||
|
||||
// Level 2 of message waiting indication
|
||||
this.readMessageWaitingFromDCS(msg, dcs);
|
||||
|
||||
// 7 bit is the default fallback encoding.
|
||||
let encoding = PDU_DCS_MSG_CODING_7BITS_ALPHABET;
|
||||
@ -4313,6 +4374,48 @@ let GsmPDUHelper = {
|
||||
if (DEBUG) debug("PDU: message encoding is " + encoding + " bit.");
|
||||
},
|
||||
|
||||
readMessageWaitingFromDCS: function readMessageWaitingFromDCS(msg, dcs) {
|
||||
// 0xC0 == 7 bit, don't store
|
||||
// 0xD0 == 7 bit, store
|
||||
// 0xE0 == UCS-2, store
|
||||
let codingGroup = dcs & PDU_DCS_CODING_GROUP_BITS;
|
||||
|
||||
if (codingGroup == PDU_DCS_CODING_GROUP_7BITS_DISCARD ||
|
||||
codingGroup == PDU_DCS_CODING_GROUP_7BITS_STORE ||
|
||||
codingGroup == PDU_DCS_CODING_GROUP_16BITS_STORE) {
|
||||
|
||||
// Indiciates voicemail indicator set or clear
|
||||
let active = (dcs & PDU_DCS_MWI_ACTIVE_BITS) == PDU_DCS_MWI_ACTIVE_VALUE;
|
||||
|
||||
// If TP-UDH is present, these values will be overwritten
|
||||
switch (dcs & PDU_DCS_MWI_TYPE_BITS) {
|
||||
case PDU_DCS_MWI_TYPE_VOICEMAIL:
|
||||
let mwi = msg.mwi;
|
||||
if (!mwi) {
|
||||
mwi = msg.mwi = {};
|
||||
}
|
||||
|
||||
mwi.active = active;
|
||||
mwi.discard = codingGroup == PDU_DCS_CODING_GROUP_7BITS_DISCARD;
|
||||
mwi.msgCount = active ? GECKO_VOICEMAIL_MESSAGE_COUNT_UNKNOWN : 0;
|
||||
|
||||
if (DEBUG) {
|
||||
debug("MWI in DCS received for voicemail: " + JSON.stringify(mwi));
|
||||
}
|
||||
break;
|
||||
case PDU_DCS_MWI_TYPE_FAX:
|
||||
if (DEBUG) debug("MWI in DCS received for fax");
|
||||
break;
|
||||
case PDU_DCS_MWI_TYPE_EMAIL:
|
||||
if (DEBUG) debug("MWI in DCS received for email");
|
||||
break;
|
||||
default:
|
||||
if (DEBUG) debug("MWI in DCS received for \"other\"");
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Read GSM TP-Service-Centre-Time-Stamp(TP-SCTS).
|
||||
*
|
||||
@ -4356,7 +4459,7 @@ let GsmPDUHelper = {
|
||||
|
||||
let paddingBits = 0;
|
||||
if (msg.udhi) {
|
||||
msg.header = this.readUserDataHeader();
|
||||
this.readUserDataHeader(msg);
|
||||
|
||||
if (msg.encoding == PDU_DCS_MSG_CODING_7BITS_ALPHABET) {
|
||||
let headerBits = (msg.header.length + 1) * 8;
|
||||
@ -4369,6 +4472,8 @@ let GsmPDUHelper = {
|
||||
}
|
||||
}
|
||||
|
||||
if (DEBUG) debug("After header, " + length + " septets left of user data");
|
||||
|
||||
msg.body = null;
|
||||
msg.data = null;
|
||||
switch (msg.encoding) {
|
||||
@ -4454,13 +4559,15 @@ let GsmPDUHelper = {
|
||||
// D DR S SR ST C
|
||||
SMSC: null, // M M M M M M
|
||||
mti: null, // M M M M M M
|
||||
udhi: null, // M M X M M M
|
||||
udhi: null, // M M O M M M
|
||||
sender: null, // M X X X X X
|
||||
recipient: null, // X X M X M M
|
||||
pid: null, // M O M O O M
|
||||
epid: null, // M O M O O M
|
||||
dcs: null, // M O M O O X
|
||||
encoding: null, // M O M O O X
|
||||
mwi: null, // O O O O O O
|
||||
replace: false, // O O O O O O
|
||||
header: null, // M M O M M M
|
||||
body: null, // M O M O O O
|
||||
data: null, // M O M O O O
|
||||
timestamp: null, // M X X X X X
|
||||
|
@ -21,6 +21,8 @@ CPPSRCS = \
|
||||
Telephony.cpp \
|
||||
TelephonyCall.cpp \
|
||||
CallEvent.cpp \
|
||||
Voicemail.cpp \
|
||||
VoicemailEvent.cpp \
|
||||
$(NULL)
|
||||
|
||||
XPIDLSRCS = \
|
||||
@ -28,6 +30,9 @@ XPIDLSRCS = \
|
||||
nsIDOMTelephony.idl \
|
||||
nsIDOMTelephonyCall.idl \
|
||||
nsIDOMCallEvent.idl \
|
||||
nsIDOMVoicemail.idl \
|
||||
nsIDOMVoicemailEvent.idl \
|
||||
nsIDOMVoicemailStatus.idl \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
@ -8,11 +8,15 @@
|
||||
#define mozilla_dom_telephony_telephonyfactory_h__
|
||||
|
||||
#include "nsIDOMTelephony.h"
|
||||
#include "nsIDOMVoicemail.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
|
||||
// Implemented in Telephony.cpp.
|
||||
// Implemented in Telephony.cpp / Voicemail.cpp.
|
||||
|
||||
nsresult
|
||||
NS_NewTelephony(nsPIDOMWindow* aWindow, nsIDOMTelephony** aTelephony);
|
||||
|
||||
nsresult
|
||||
NS_NewVoicemail(nsPIDOMWindow* aWindow, nsIDOMMozVoicemail** aVoicemail);
|
||||
|
||||
#endif // mozilla_dom_telephony_telephonyfactory_h__
|
||||
|
111
dom/telephony/Voicemail.cpp
Normal file
111
dom/telephony/Voicemail.cpp
Normal file
@ -0,0 +1,111 @@
|
||||
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=40: */
|
||||
/* 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 "Voicemail.h"
|
||||
#include "nsIDOMVoicemailStatus.h"
|
||||
|
||||
#include "mozilla/Services.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsDOMClassInfo.h"
|
||||
#include "nsRadioInterfaceLayer.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
#include "VoicemailEvent.h"
|
||||
|
||||
DOMCI_DATA(MozVoicemail, mozilla::dom::telephony::Voicemail)
|
||||
|
||||
USING_TELEPHONY_NAMESPACE
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(Voicemail)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(Voicemail,
|
||||
nsDOMEventTargetHelper)
|
||||
NS_CYCLE_COLLECTION_TRAVERSE_EVENT_HANDLER(statuschanged)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(Voicemail,
|
||||
nsDOMEventTargetHelper)
|
||||
NS_CYCLE_COLLECTION_UNLINK_EVENT_HANDLER(statuschanged)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(Voicemail)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMMozVoicemail)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(MozVoicemail)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetHelper)
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(Voicemail, nsDOMEventTargetHelper)
|
||||
NS_IMPL_RELEASE_INHERITED(Voicemail, nsDOMEventTargetHelper)
|
||||
|
||||
NS_IMPL_ISUPPORTS1(Voicemail::RILVoicemailCallback, nsIRILVoicemailCallback)
|
||||
|
||||
Voicemail::Voicemail(nsPIDOMWindow* aWindow, nsIRILContentHelper* aRIL)
|
||||
: mRIL(aRIL)
|
||||
{
|
||||
BindToOwner(aWindow);
|
||||
|
||||
mRILVoicemailCallback = new RILVoicemailCallback(this);
|
||||
|
||||
nsresult rv = aRIL->RegisterVoicemailCallback(mRILVoicemailCallback);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("Failed registering voicemail callback with RIL");
|
||||
}
|
||||
}
|
||||
|
||||
Voicemail::~Voicemail()
|
||||
{
|
||||
if (mRIL && mRILVoicemailCallback) {
|
||||
mRIL->UnregisterVoicemailCallback(mRILVoicemailCallback);
|
||||
}
|
||||
}
|
||||
|
||||
// nsIDOMMozVoicemail
|
||||
|
||||
NS_IMETHODIMP
|
||||
Voicemail::GetStatus(nsIDOMMozVoicemailStatus** aStatus)
|
||||
{
|
||||
*aStatus = nsnull;
|
||||
|
||||
NS_ENSURE_STATE(mRIL);
|
||||
return mRIL->GetVoicemailStatus(aStatus);
|
||||
}
|
||||
|
||||
NS_IMPL_EVENT_HANDLER(Voicemail, statuschanged)
|
||||
|
||||
// nsIRILVoicemailCallback
|
||||
|
||||
NS_IMETHODIMP
|
||||
Voicemail::VoicemailNotification(nsIDOMMozVoicemailStatus* aStatus)
|
||||
{
|
||||
nsRefPtr<VoicemailEvent> event = new VoicemailEvent(nsnull, nsnull);
|
||||
nsresult rv = event->InitVoicemailEvent(NS_LITERAL_STRING("statuschanged"),
|
||||
false, false, aStatus);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = event->SetTrusted(true);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
bool dummy;
|
||||
rv = DispatchEvent(static_cast<nsIDOMMozVoicemailEvent*>(event), &dummy);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_NewVoicemail(nsPIDOMWindow* aWindow, nsIDOMMozVoicemail** aVoicemail)
|
||||
{
|
||||
nsPIDOMWindow* innerWindow = aWindow->IsInnerWindow() ?
|
||||
aWindow :
|
||||
aWindow->GetCurrentInnerWindow();
|
||||
|
||||
nsCOMPtr<nsIRILContentHelper> ril =
|
||||
do_GetService(NS_RILCONTENTHELPER_CONTRACTID);
|
||||
NS_ENSURE_STATE(ril);
|
||||
|
||||
nsRefPtr<Voicemail> voicemail = new Voicemail(innerWindow, ril);
|
||||
voicemail.forget(aVoicemail);
|
||||
return NS_OK;
|
||||
}
|
61
dom/telephony/Voicemail.h
Normal file
61
dom/telephony/Voicemail.h
Normal file
@ -0,0 +1,61 @@
|
||||
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=40: */
|
||||
/* 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_telephony_voicemail_h__
|
||||
#define mozilla_dom_telephony_voicemail_h__
|
||||
|
||||
#include "TelephonyCommon.h"
|
||||
|
||||
#include "nsDOMEvent.h"
|
||||
#include "nsDOMEventTargetHelper.h"
|
||||
#include "nsIDOMVoicemail.h"
|
||||
#include "nsIRadioInterfaceLayer.h"
|
||||
|
||||
class nsIRILContentHelper;
|
||||
class nsIDOMMozVoicemailStatus;
|
||||
|
||||
BEGIN_TELEPHONY_NAMESPACE
|
||||
|
||||
class Voicemail : public nsDOMEventTargetHelper,
|
||||
public nsIDOMMozVoicemail
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIDOMMOZVOICEMAIL
|
||||
NS_DECL_NSIRILVOICEMAILCALLBACK
|
||||
|
||||
NS_FORWARD_NSIDOMEVENTTARGET(nsDOMEventTargetHelper::)
|
||||
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(Voicemail, nsDOMEventTargetHelper)
|
||||
|
||||
Voicemail(nsPIDOMWindow* aWindow, nsIRILContentHelper* aRIL);
|
||||
virtual ~Voicemail();
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIRILContentHelper> mRIL;
|
||||
nsCOMPtr<nsIRILVoicemailCallback> mRILVoicemailCallback;
|
||||
|
||||
NS_DECL_EVENT_HANDLER(statuschanged)
|
||||
|
||||
class RILVoicemailCallback : public nsIRILVoicemailCallback
|
||||
{
|
||||
Voicemail* mVoicemail;
|
||||
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_FORWARD_NSIRILVOICEMAILCALLBACK(mVoicemail->)
|
||||
|
||||
RILVoicemailCallback(Voicemail* aVoicemail)
|
||||
: mVoicemail(aVoicemail)
|
||||
{
|
||||
NS_ASSERTION(mVoicemail, "Null pointer!");
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
END_TELEPHONY_NAMESPACE
|
||||
|
||||
#endif // mozilla_dom_telephony_voicemail_h__
|
64
dom/telephony/VoicemailEvent.cpp
Normal file
64
dom/telephony/VoicemailEvent.cpp
Normal file
@ -0,0 +1,64 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "VoicemailEvent.h"
|
||||
#include "nsDOMClassInfo.h"
|
||||
#include "nsIDOMVoicemailStatus.h"
|
||||
|
||||
DOMCI_DATA(MozVoicemailEvent, mozilla::dom::telephony::VoicemailEvent)
|
||||
|
||||
USING_TELEPHONY_NAMESPACE
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(VoicemailEvent)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(VoicemailEvent, nsDOMEvent)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mStatus)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(VoicemailEvent, nsDOMEvent)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mStatus)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(VoicemailEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMMozVoicemailEvent)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(MozVoicemailEvent)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent)
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(VoicemailEvent, nsDOMEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(VoicemailEvent, nsDOMEvent)
|
||||
|
||||
nsresult
|
||||
VoicemailEvent::InitVoicemailEvent(const nsAString& aEventTypeArg,
|
||||
bool aCanBubbleArg, bool aCancelableArg,
|
||||
nsIDOMMozVoicemailStatus* aStatus)
|
||||
{
|
||||
nsresult rv = nsDOMEvent::InitEvent(aEventTypeArg, aCanBubbleArg,
|
||||
aCancelableArg);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mStatus = aStatus;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
VoicemailEvent::GetStatus(nsIDOMMozVoicemailStatus** aStatus)
|
||||
{
|
||||
NS_IF_ADDREF(*aStatus = mStatus);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
nsresult
|
||||
NS_NewDOMVoicemailEvent(nsIDOMEvent** aInstancePtrResult,
|
||||
nsPresContext* aPresContext,
|
||||
nsEvent* aEvent)
|
||||
{
|
||||
return CallQueryInterface(
|
||||
new mozilla::dom::telephony::VoicemailEvent(aPresContext, aEvent),
|
||||
aInstancePtrResult);
|
||||
}
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user