mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 03:45:46 +00:00
Merge mozilla-central into services-central
This commit is contained in:
commit
6d85cdb9be
@ -15,7 +15,7 @@ Cu.import("resource://gre/modules/Services.jsm");
|
||||
function AlertsService() { }
|
||||
|
||||
AlertsService.prototype = {
|
||||
classID: Components.ID("{5dce03b2-8faa-4b6e-9242-6ddb0411750c}"),
|
||||
classID: Components.ID("{fe33c107-82a4-41d6-8c64-5353267e04c9}"),
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIAlertsService]),
|
||||
|
||||
showAlertNotification: function(aImageUrl, aTitle, aText, aTextClickable, aCookie, aAlertListener, aName) {
|
||||
|
@ -7,8 +7,8 @@ contract @mozilla.org/b2g-camera-content;1 {eff4231b-abce-4f7f-a40a-d646e8fde3ce
|
||||
category JavaScript-navigator-property mozCamera @mozilla.org/b2g-camera-content;1
|
||||
|
||||
# AlertsService.js
|
||||
component {5dce03b2-8faa-4b6e-9242-6ddb0411750c} AlertsService.js
|
||||
contract @mozilla.org/alerts-service;1 {5dce03b2-8faa-4b6e-9242-6ddb0411750c}
|
||||
component {fe33c107-82a4-41d6-8c64-5353267e04c9} AlertsService.js
|
||||
contract @mozilla.org/system-alerts-service;1 {fe33c107-82a4-41d6-8c64-5353267e04c9}
|
||||
|
||||
# ContentPermissionPrompt.js
|
||||
component {8c719f03-afe0-4aac-91ff-6c215895d467} ContentPermissionPrompt.js
|
||||
|
@ -15,7 +15,7 @@ function ContentPermissionPrompt() {}
|
||||
ContentPermissionPrompt.prototype = {
|
||||
|
||||
handleExistingPermission: function handleExistingPermission(request) {
|
||||
let result = Services.perms.testExactPermission(request.uri, request.type);
|
||||
let result = Services.perms.testExactPermissionFromPrincipal(request.principal, request.type);
|
||||
if (result == Ci.nsIPermissionManager.ALLOW_ACTION) {
|
||||
request.allow();
|
||||
return true;
|
||||
@ -56,7 +56,7 @@ ContentPermissionPrompt.prototype = {
|
||||
"type": "permission-prompt",
|
||||
"permission": request.type,
|
||||
"id": requestId,
|
||||
"url": request.uri.spec
|
||||
"url": request.principal.URI.spec
|
||||
};
|
||||
let event = content.document.createEvent("CustomEvent");
|
||||
event.initCustomEvent("mozChromeEvent", true, true, details);
|
||||
|
@ -231,7 +231,7 @@ var gPluginHandler = {
|
||||
managePlugins: function (aEvent) {
|
||||
BrowserOpenAddonsMgr("addons://list/plugin");
|
||||
},
|
||||
|
||||
|
||||
// Callback for user clicking on the link in a click-to-play plugin
|
||||
// (where the plugin has an update)
|
||||
openPluginUpdatePage: function (aEvent) {
|
||||
@ -279,9 +279,8 @@ var gPluginHandler = {
|
||||
// The overlay is null if the XBL binding is not attached (element is display:none).
|
||||
if (overlay) {
|
||||
overlay.addEventListener("click", function(aEvent) {
|
||||
// Have to check that the target is a XULElement and not the link
|
||||
// to update the plugin
|
||||
if (aEvent.target instanceof XULElement &&
|
||||
// Have to check that the target is not the link to update the plugin
|
||||
if (!(aEvent.originalTarget instanceof HTMLAnchorElement) &&
|
||||
aEvent.button == 0 && aEvent.isTrusted)
|
||||
gPluginHandler.activateSinglePlugin(aEvent.target.ownerDocument.defaultView.top, aPlugin);
|
||||
}, true);
|
||||
|
@ -25,11 +25,6 @@ let gBrowserThumbnails = {
|
||||
*/
|
||||
_timeouts: null,
|
||||
|
||||
/**
|
||||
* Cache for the PageThumbs module.
|
||||
*/
|
||||
_pageThumbs: null,
|
||||
|
||||
/**
|
||||
* List of tab events we want to listen for.
|
||||
*/
|
||||
@ -52,9 +47,6 @@ let gBrowserThumbnails = {
|
||||
}, this);
|
||||
|
||||
this._timeouts = new WeakMap();
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "_pageThumbs",
|
||||
"resource:///modules/PageThumbs.jsm", "PageThumbs");
|
||||
},
|
||||
|
||||
uninit: function Thumbnails_uninit() {
|
||||
@ -100,7 +92,7 @@ let gBrowserThumbnails = {
|
||||
|
||||
_capture: function Thumbnails_capture(aBrowser) {
|
||||
if (this._shouldCapture(aBrowser))
|
||||
this._pageThumbs.captureAndStore(aBrowser);
|
||||
PageThumbs.captureAndStore(aBrowser);
|
||||
},
|
||||
|
||||
_delayedCapture: function Thumbnails_delayedCapture(aBrowser) {
|
||||
|
@ -140,6 +140,9 @@ XPCOMUtils.defineLazyGetter(this, "Social", function() {
|
||||
return tmp.Social;
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "PageThumbs",
|
||||
"resource:///modules/PageThumbs.jsm");
|
||||
|
||||
#ifdef MOZ_SAFE_BROWSING
|
||||
XPCOMUtils.defineLazyGetter(this, "SafeBrowsing", function() {
|
||||
let tmp = {};
|
||||
|
@ -3407,7 +3407,20 @@
|
||||
// Set the cursor to an arrow during tab drags.
|
||||
dt.mozCursor = "default";
|
||||
|
||||
let canvas = tabPreviews.capture(tab, false);
|
||||
// Create a canvas to which we capture the current tab.
|
||||
let canvas = document.createElementNS("http://www.w3.org/1999/xhtml", "canvas");
|
||||
canvas.mozOpaque = true;
|
||||
|
||||
// We want drag images to be about 1/6th of the available screen width.
|
||||
const widthFactor = 0.1739; // 1:5.75 inverse
|
||||
canvas.width = Math.ceil(screen.availWidth * widthFactor);
|
||||
|
||||
// Maintain a 16:9 aspect ratio for drag images.
|
||||
const aspectRatio = 0.5625; // 16:9 inverse
|
||||
canvas.height = Math.round(canvas.width * aspectRatio);
|
||||
|
||||
let browser = tab.linkedBrowser;
|
||||
PageThumbs.captureToCanvas(browser.contentWindow, canvas);
|
||||
dt.setDragImage(canvas, 0, 0);
|
||||
|
||||
// _dragOffsetX/Y give the coordinates that the mouse should be
|
||||
|
@ -146,8 +146,7 @@ function test3() {
|
||||
var manageLink = gTestBrowser.contentDocument.getAnonymousElementByAttribute(pluginNode, "class", "managePluginsLink");
|
||||
ok(manageLink, "Test 3, found 'manage' link in plugin-problem binding");
|
||||
|
||||
EventUtils.synthesizeMouse(manageLink,
|
||||
5, 5, {}, gTestBrowser.contentWindow);
|
||||
EventUtils.synthesizeMouseAtCenter(manageLink, {}, gTestBrowser.contentWindow);
|
||||
}
|
||||
|
||||
function test4(tab, win) {
|
||||
@ -237,7 +236,7 @@ function test9a() {
|
||||
var objLoadingContent = plugin2.QueryInterface(Ci.nsIObjectLoadingContent);
|
||||
ok(!objLoadingContent.activated, "Test 9a, Plugin with id=" + plugin2.id + " should not be activated");
|
||||
|
||||
EventUtils.synthesizeMouse(plugin1, 100, 100, { });
|
||||
EventUtils.synthesizeMouseAtCenter(plugin1, {}, gTestBrowser.contentWindow);
|
||||
var objLoadingContent = plugin1.QueryInterface(Ci.nsIObjectLoadingContent);
|
||||
var condition = function() objLoadingContent.activated;
|
||||
waitForCondition(condition, test9b, "Test 9a, Waited too long for plugin to activate");
|
||||
@ -266,7 +265,7 @@ function test9b() {
|
||||
var objLoadingContent = plugin2.QueryInterface(Ci.nsIObjectLoadingContent);
|
||||
ok(!objLoadingContent.activated, "Test 9b, Plugin with id=" + plugin2.id + " should not be activated");
|
||||
|
||||
EventUtils.synthesizeMouse(plugin2, 100, 100, { });
|
||||
EventUtils.synthesizeMouseAtCenter(plugin2, {}, gTestBrowser.contentWindow);
|
||||
var objLoadingContent = plugin2.QueryInterface(Ci.nsIObjectLoadingContent);
|
||||
var condition = function() objLoadingContent.activated;
|
||||
waitForCondition(condition, test9c, "Test 9b, Waited too long for plugin to activate");
|
||||
@ -482,7 +481,7 @@ function test16b() {
|
||||
var plugin = gTestBrowser.contentDocument.getElementsByTagName("embed")[0];
|
||||
var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
|
||||
ok(!objLoadingContent.activated, "Test 16b, Plugin should not be activated");
|
||||
EventUtils.synthesizeMouse(plugin, 100, 100, { });
|
||||
EventUtils.synthesizeMouseAtCenter(plugin, {}, gTestBrowser.contentWindow);
|
||||
var condition = function() objLoadingContent.activated;
|
||||
waitForCondition(condition, test16c, "Test 16b, Waited too long for plugin to activate");
|
||||
}
|
||||
@ -590,10 +589,18 @@ function test18a() {
|
||||
test18b();
|
||||
}
|
||||
};
|
||||
EventUtils.synthesizeMouse(updateLink, 5, 5, {}, gTestBrowser.contentWindow);
|
||||
EventUtils.synthesizeMouseAtCenter(updateLink, {}, gTestBrowser.contentWindow);
|
||||
}
|
||||
|
||||
function test18b() {
|
||||
// clicking the update link should not activate the plugin
|
||||
var doc = gTestBrowser.contentDocument;
|
||||
var plugin = doc.getElementById("test");
|
||||
var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
|
||||
ok(!objLoadingContent.activated, "Test 18b, Plugin should not be activated");
|
||||
var overlay = doc.getAnonymousElementByAttribute(plugin, "class", "mainBox");
|
||||
ok(overlay.style.visibility != "hidden", "Test 18b, Plugin overlay should exist, not be hidden");
|
||||
|
||||
unregisterFakeBlocklistService();
|
||||
registerFakeBlocklistService(Ci.nsIBlocklistService.STATE_VULNERABLE_NO_UPDATE);
|
||||
prepareTest(test18c, gTestRoot + "plugin_test.html");
|
||||
@ -616,5 +623,71 @@ function test18c() {
|
||||
var plugin = get_test_plugin();
|
||||
plugin.clicktoplay = false;
|
||||
|
||||
prepareTest(test19a, gTestRoot + "plugin_test.html");
|
||||
}
|
||||
|
||||
// Tests that clicking the icon of the overlay activates the plugin
|
||||
function test19a() {
|
||||
var doc = gTestBrowser.contentDocument;
|
||||
var plugin = doc.getElementById("test");
|
||||
var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
|
||||
ok(!objLoadingContent.activated, "Test 19a, Plugin should not be activated");
|
||||
|
||||
var icon = doc.getAnonymousElementByAttribute(plugin, "class", "icon");
|
||||
EventUtils.synthesizeMouseAtCenter(icon, {}, gTestBrowser.contentWindow);
|
||||
var condition = function() objLoadingContent.activated;
|
||||
waitForCondition(condition, test19b, "Test 19a, Waited too long for plugin to activate");
|
||||
}
|
||||
|
||||
function test19b() {
|
||||
var doc = gTestBrowser.contentDocument;
|
||||
var plugin = doc.getElementById("test");
|
||||
var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
|
||||
ok(objLoadingContent.activated, "Test 19b, Plugin should be activated");
|
||||
|
||||
prepareTest(test19c, gTestRoot + "plugin_test.html");
|
||||
}
|
||||
|
||||
// Tests that clicking the text of the overlay activates the plugin
|
||||
function test19c() {
|
||||
var doc = gTestBrowser.contentDocument;
|
||||
var plugin = doc.getElementById("test");
|
||||
var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
|
||||
ok(!objLoadingContent.activated, "Test 19c, Plugin should not be activated");
|
||||
|
||||
var text = doc.getAnonymousElementByAttribute(plugin, "class", "msg msgClickToPlay");
|
||||
EventUtils.synthesizeMouseAtCenter(text, {}, gTestBrowser.contentWindow);
|
||||
var condition = function() objLoadingContent.activated;
|
||||
waitForCondition(condition, test19d, "Test 19c, Waited too long for plugin to activate");
|
||||
}
|
||||
|
||||
function test19d() {
|
||||
var doc = gTestBrowser.contentDocument;
|
||||
var plugin = doc.getElementById("test");
|
||||
var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
|
||||
ok(objLoadingContent.activated, "Test 19d, Plugin should be activated");
|
||||
|
||||
prepareTest(test19e, gTestRoot + "plugin_test.html");
|
||||
}
|
||||
|
||||
// Tests that clicking the box of the overlay activates the plugin
|
||||
// (just to be thorough)
|
||||
function test19e() {
|
||||
var doc = gTestBrowser.contentDocument;
|
||||
var plugin = doc.getElementById("test");
|
||||
var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
|
||||
ok(!objLoadingContent.activated, "Test 19e, Plugin should not be activated");
|
||||
|
||||
EventUtils.synthesizeMouse(plugin, 50, 50, {}, gTestBrowser.contentWindow);
|
||||
var condition = function() objLoadingContent.activated;
|
||||
waitForCondition(condition, test19f, "Test 19e, Waited too long for plugin to activate");
|
||||
}
|
||||
|
||||
function test19f() {
|
||||
var doc = gTestBrowser.contentDocument;
|
||||
var plugin = doc.getElementById("test");
|
||||
var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
|
||||
ok(objLoadingContent.activated, "Test 19f, Plugin should be activated");
|
||||
|
||||
finishTest();
|
||||
}
|
||||
|
@ -18,9 +18,7 @@ Browser context menu tests.
|
||||
|
||||
/** Test for Login Manager: multiple login autocomplete. **/
|
||||
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
Components.utils.import("resource://gre/modules/InlineSpellChecker.jsm");
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
SpecialPowers.wrap(Components).utils.import("resource://gre/modules/InlineSpellChecker.jsm", window);
|
||||
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
@ -729,7 +727,7 @@ function runTest(testNum) {
|
||||
|
||||
case 24:
|
||||
// Context menu for selected text
|
||||
if (Services.appinfo.OS == "Darwin") {
|
||||
if (SpecialPowers.Services.appinfo.OS == "Darwin") {
|
||||
// This test is only enabled on Mac due to bug 736399.
|
||||
checkContextMenu(["context-copy", true,
|
||||
"context-selectall", true,
|
||||
@ -745,7 +743,7 @@ function runTest(testNum) {
|
||||
|
||||
case 25:
|
||||
// Context menu for selected text which matches valid URL pattern
|
||||
if (Services.appinfo.OS == "Darwin") {
|
||||
if (SpecialPowers.Services.appinfo.OS == "Darwin") {
|
||||
// This test is only enabled on Mac due to bug 736399.
|
||||
checkContextMenu(["context-openlinkincurrent", true,
|
||||
"context-openlinkintab", true,
|
||||
@ -790,8 +788,7 @@ var text, link, mailto, input, img, canvas, video_ok, video_bad, video_bad2,
|
||||
inputspell, pagemenu, dom_full_screen, plainTextItems, audio_in_video;
|
||||
|
||||
function startTest() {
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
chromeWin = subwindow
|
||||
chromeWin = SpecialPowers.wrap(subwindow)
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebNavigation)
|
||||
.QueryInterface(Ci.nsIDocShellTreeItem)
|
||||
|
@ -26,6 +26,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=462856
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
const Cc = SpecialPowers.wrap(Components).classes;
|
||||
|
||||
var numFinished = 0;
|
||||
|
||||
@ -34,18 +35,17 @@ window.addEventListener("message", function(event) {
|
||||
|
||||
if (++numFinished == 3) {
|
||||
// Clean up after ourself
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var pm = Components.classes["@mozilla.org/permissionmanager;1"].
|
||||
var pm = Cc["@mozilla.org/permissionmanager;1"].
|
||||
getService(Components.interfaces.nsIPermissionManager);
|
||||
var ioService = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
var ioService = Cc["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
var uri1 = ioService.newURI(frames.testFrame.location, null, null);
|
||||
var uri2 = ioService.newURI(frames.testFrame3.location, null, null);
|
||||
|
||||
var principal1 = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
|
||||
var principal1 = Cc["@mozilla.org/scriptsecuritymanager;1"]
|
||||
.getService(Components.interfaces.nsIScriptSecurityManager)
|
||||
.getNoAppCodebasePrincipal(uri1);
|
||||
var principal2 = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
|
||||
var principal2 = Cc["@mozilla.org/scriptsecuritymanager;1"]
|
||||
.getService(Components.interfaces.nsIScriptSecurityManager)
|
||||
.getNoAppCodebasePrincipal(uri2);
|
||||
|
||||
@ -108,8 +108,7 @@ function loaded() {
|
||||
// Click the notification bar's "Allow" button. This should kick
|
||||
// off updates, which will eventually lead to getting messages from
|
||||
// the children.
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"].
|
||||
var wm = SpecialPowers.wrap(Components).classes["@mozilla.org/appshell/window-mediator;1"].
|
||||
getService(Components.interfaces.nsIWindowMediator);
|
||||
var win = wm.getMostRecentWindow("navigator:browser");
|
||||
var notificationBox = win.gBrowser.getNotificationBox();
|
||||
@ -117,7 +116,7 @@ function loaded() {
|
||||
var notification = notificationBox.getNotificationWithValue("offline-app-requested-mochi.test");
|
||||
notification.childNodes[0].click();
|
||||
|
||||
notification = notificationBox.getNotificationWithValue("offline-app-requested-example.com");
|
||||
notification = SpecialPowers.wrap(notificationBox).getNotificationWithValue("offline-app-requested-example.com");
|
||||
notification.childNodes[0].click();
|
||||
}
|
||||
|
||||
|
@ -32,15 +32,13 @@ SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function finishTest() {
|
||||
// Clean up after ourselves.
|
||||
netscape.security.PrivilegeManager
|
||||
.enablePrivilege("UniversalXPConnect");
|
||||
var pm = Components.classes["@mozilla.org/permissionmanager;1"].
|
||||
var Cc = SpecialPowers.wrap(Components).classes;
|
||||
var pm = Cc["@mozilla.org/permissionmanager;1"].
|
||||
getService(Components.interfaces.nsIPermissionManager);
|
||||
|
||||
var uri = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService)
|
||||
var uri = Cc["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService)
|
||||
.newURI(window.frames[0].location, null, null);
|
||||
var principal = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
|
||||
var principal = Cc["@mozilla.org/scriptsecuritymanager;1"]
|
||||
.getService(Components.interfaces.nsIScriptSecurityManager)
|
||||
.getNoAppCodebasePrincipal(uri);
|
||||
|
||||
@ -70,8 +68,6 @@ function handleMessageEvents(event) {
|
||||
// successfully reloaded), or the string "error" appears
|
||||
// in the iframe, as in the case of bug 501422.
|
||||
intervalID = setInterval(function() {
|
||||
netscape.security.PrivilegeManager
|
||||
.enablePrivilege("UniversalXPConnect");
|
||||
// Sometimes document.body may not exist, and trying to access
|
||||
// it will throw an exception, so handle this case.
|
||||
try {
|
||||
@ -103,8 +99,7 @@ function loaded() {
|
||||
// Click the notification bar's "Allow" button. This should kick
|
||||
// off updates, which will eventually lead to getting messages from
|
||||
// the iframe.
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"].
|
||||
var wm = SpecialPowers.wrap(Components).classes["@mozilla.org/appshell/window-mediator;1"].
|
||||
getService(Components.interfaces.nsIWindowMediator);
|
||||
var win = wm.getMostRecentWindow("navigator:browser");
|
||||
var notificationBox = win.gBrowser.getNotificationBox();
|
||||
|
@ -20,8 +20,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=589543
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
addLoadEvent(function() {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var doc = $("testFrame").contentDocument;
|
||||
var doc = SpecialPowers.wrap($("testFrame").contentDocument);
|
||||
var daddy = doc.getElementById("feedSubscribeLine");
|
||||
var popup = doc.getAnonymousElementByAttribute(daddy, "anonid", "handlersMenuPopup");
|
||||
isnot(popup, null, "Feed preview should have a handlers popup");
|
||||
|
@ -1560,13 +1560,14 @@ ContentPermissionPrompt.prototype = {
|
||||
return;
|
||||
}
|
||||
|
||||
var requestingURI = request.uri;
|
||||
var requestingPrincipal = request.principal;
|
||||
var requestingURI = requestingPrincipal.URI;
|
||||
|
||||
// Ignore requests from non-nsIStandardURLs
|
||||
if (!(requestingURI instanceof Ci.nsIStandardURL))
|
||||
return;
|
||||
|
||||
var result = Services.perms.testExactPermission(requestingURI, "geo");
|
||||
var result = Services.perms.testExactPermissionFromPrincipal(requestingPrincipal, "geo");
|
||||
|
||||
if (result == Ci.nsIPermissionManager.ALLOW_ACTION) {
|
||||
request.allow();
|
||||
@ -1619,7 +1620,7 @@ ContentPermissionPrompt.prototype = {
|
||||
label: browserBundle.GetStringFromName("geolocation.alwaysShareLocation"),
|
||||
accessKey: browserBundle.GetStringFromName("geolocation.alwaysShareLocation.accesskey"),
|
||||
callback: function () {
|
||||
Services.perms.add(requestingURI, "geo", Ci.nsIPermissionManager.ALLOW_ACTION);
|
||||
Services.perms.addFromPrincipal(requestingPrincipal, "geo", Ci.nsIPermissionManager.ALLOW_ACTION);
|
||||
request.allow();
|
||||
}
|
||||
});
|
||||
@ -1627,7 +1628,7 @@ ContentPermissionPrompt.prototype = {
|
||||
label: browserBundle.GetStringFromName("geolocation.neverShareLocation"),
|
||||
accessKey: browserBundle.GetStringFromName("geolocation.neverShareLocation.accesskey"),
|
||||
callback: function () {
|
||||
Services.perms.add(requestingURI, "geo", Ci.nsIPermissionManager.DENY_ACTION);
|
||||
Services.perms.addFromPrincipal(requestingPrincipal, "geo", Ci.nsIPermissionManager.DENY_ACTION);
|
||||
request.cancel();
|
||||
}
|
||||
});
|
||||
|
@ -116,11 +116,26 @@ let PageThumbs = {
|
||||
return;
|
||||
}
|
||||
|
||||
let telemetryCaptureTime = new Date();
|
||||
let [sw, sh, scale] = this._determineCropSize(aWindow);
|
||||
|
||||
let canvas = this._createCanvas();
|
||||
let ctx = canvas.getContext("2d");
|
||||
this.captureToCanvas(aWindow, canvas);
|
||||
|
||||
// Fetch the canvas data on the next event loop tick so that we allow
|
||||
// some event processing in between drawing to the canvas and encoding
|
||||
// its data. We want to block the UI as short as possible. See bug 744100.
|
||||
Services.tm.currentThread.dispatch(function () {
|
||||
canvas.mozFetchAsStream(aCallback, this.contentType);
|
||||
}.bind(this), Ci.nsIThread.DISPATCH_NORMAL);
|
||||
},
|
||||
|
||||
/**
|
||||
* Captures a thumbnail from a given window and draws it to the given canvas.
|
||||
* @param aWindow The DOM window to capture a thumbnail from.
|
||||
* @param aCanvas The canvas to draw to.
|
||||
*/
|
||||
captureToCanvas: function PageThumbs_captureToCanvas(aWindow, aCanvas) {
|
||||
let telemetryCaptureTime = new Date();
|
||||
let [sw, sh, scale] = this._determineCropSize(aWindow, aCanvas);
|
||||
let ctx = aCanvas.getContext("2d");
|
||||
|
||||
// Scale the canvas accordingly.
|
||||
ctx.scale(scale, scale);
|
||||
@ -136,13 +151,6 @@ let PageThumbs = {
|
||||
let telemetry = Services.telemetry;
|
||||
telemetry.getHistogramById("FX_THUMBNAILS_CAPTURE_TIME_MS")
|
||||
.add(new Date() - telemetryCaptureTime);
|
||||
|
||||
// Fetch the canvas data on the next event loop tick so that we allow
|
||||
// some event processing in between drawing to the canvas and encoding
|
||||
// its data. We want to block the UI as short as possible. See bug 744100.
|
||||
Services.tm.currentThread.dispatch(function () {
|
||||
canvas.mozFetchAsStream(aCallback, this.contentType);
|
||||
}.bind(this), Ci.nsIThread.DISPATCH_NORMAL);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -193,13 +201,14 @@ let PageThumbs = {
|
||||
/**
|
||||
* Determines the crop size for a given content window.
|
||||
* @param aWindow The content window.
|
||||
* @param aCanvas The target canvas.
|
||||
* @return An array containing width, height and scale.
|
||||
*/
|
||||
_determineCropSize: function PageThumbs_determineCropSize(aWindow) {
|
||||
_determineCropSize: function PageThumbs_determineCropSize(aWindow, aCanvas) {
|
||||
let sw = aWindow.innerWidth;
|
||||
let sh = aWindow.innerHeight;
|
||||
|
||||
let [thumbnailWidth, thumbnailHeight] = this._getThumbnailSize();
|
||||
let {width: thumbnailWidth, height: thumbnailHeight} = aCanvas;
|
||||
let scale = Math.max(thumbnailWidth / sw, thumbnailHeight / sh);
|
||||
let scaledWidth = sw * scale;
|
||||
let scaledHeight = sh * scale;
|
||||
|
@ -11,8 +11,6 @@ registerCleanupFunction(function () {
|
||||
gBrowser.removeTab(gBrowser.tabs[1]);
|
||||
});
|
||||
|
||||
let cachedXULDocument;
|
||||
|
||||
/**
|
||||
* Provide the default test function to start our test runner.
|
||||
*/
|
||||
|
@ -51,15 +51,16 @@ let DebuggerController = {
|
||||
window.removeEventListener("DOMContentLoaded", this._startupDebugger, true);
|
||||
|
||||
DebuggerView.initializePanes();
|
||||
DebuggerView.initializeEditor();
|
||||
DebuggerView.StackFrames.initialize();
|
||||
DebuggerView.Breakpoints.initialize();
|
||||
DebuggerView.Properties.initialize();
|
||||
DebuggerView.Scripts.initialize();
|
||||
DebuggerView.showCloseButton(!this._isRemoteDebugger && !this._isChromeDebugger);
|
||||
DebuggerView.initializeEditor(function() {
|
||||
DebuggerView.Scripts.initialize();
|
||||
DebuggerView.StackFrames.initialize();
|
||||
DebuggerView.Breakpoints.initialize();
|
||||
DebuggerView.Properties.initialize();
|
||||
DebuggerView.showCloseButton(!this._isRemoteDebugger && !this._isChromeDebugger);
|
||||
|
||||
this.dispatchEvent("Debugger:Loaded");
|
||||
this._connect();
|
||||
this.dispatchEvent("Debugger:Loaded");
|
||||
this._connect();
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
/**
|
||||
@ -934,7 +935,7 @@ SourceScripts.prototype = {
|
||||
|
||||
// Select the preferred script if one exists, the first entry otherwise.
|
||||
let preferredScriptUrl = DebuggerView.Scripts.preferredScriptUrl;
|
||||
if (preferredScriptUrl) {
|
||||
if (preferredScriptUrl && DebuggerView.Scripts.contains(preferredScriptUrl)) {
|
||||
DebuggerView.Scripts.selectScript(preferredScriptUrl);
|
||||
} else {
|
||||
DebuggerView.Scripts.selectIndex(0);
|
||||
|
@ -32,8 +32,11 @@ let DebuggerView = {
|
||||
|
||||
/**
|
||||
* Initializes the SourceEditor instance.
|
||||
*
|
||||
* @param function aCallback
|
||||
* Called after the editor finishes initializing.
|
||||
*/
|
||||
initializeEditor: function DV_initializeEditor() {
|
||||
initializeEditor: function DV_initializeEditor(aCallback) {
|
||||
let placeholder = document.getElementById("editor");
|
||||
|
||||
let config = {
|
||||
@ -45,7 +48,10 @@ let DebuggerView = {
|
||||
};
|
||||
|
||||
this.editor = new SourceEditor();
|
||||
this.editor.init(placeholder, config, this._onEditorLoad.bind(this));
|
||||
this.editor.init(placeholder, config, function() {
|
||||
this._onEditorLoad();
|
||||
aCallback();
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
/**
|
||||
@ -474,7 +480,7 @@ ScriptsView.prototype = {
|
||||
for (let i = 0, l = scripts.itemCount; i < l; i++) {
|
||||
scripts.getItemAtIndex(i).hidden = false;
|
||||
}
|
||||
} else {
|
||||
} else if (this._prevSearchedFile !== file) {
|
||||
let found = false;
|
||||
|
||||
for (let i = 0, l = scripts.itemCount; i < l; i++) {
|
||||
@ -502,15 +508,18 @@ ScriptsView.prototype = {
|
||||
scripts.removeAttribute("tooltiptext");
|
||||
}
|
||||
}
|
||||
if (line > -1) {
|
||||
if (this._prevSearchedLine !== line && line > -1) {
|
||||
editor.setCaretPosition(line - 1);
|
||||
}
|
||||
if (token.length) {
|
||||
if (this._prevSearchedToken !== token && token.length > 0) {
|
||||
let offset = editor.find(token, { ignoreCase: true });
|
||||
if (offset > -1) {
|
||||
editor.setSelection(offset, offset + token.length)
|
||||
}
|
||||
}
|
||||
this._prevSearchedFile = file;
|
||||
this._prevSearchedLine = line;
|
||||
this._prevSearchedToken = token;
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -44,6 +44,7 @@ MOCHITEST_BROWSER_TESTS = \
|
||||
browser_dbg_stack-04.js \
|
||||
browser_dbg_stack-05.js \
|
||||
browser_dbg_location-changes.js \
|
||||
browser_dbg_location-changes-new.js \
|
||||
browser_dbg_location-changes-blank.js \
|
||||
browser_dbg_script-switching.js \
|
||||
browser_dbg_scripts-sorting.js \
|
||||
|
@ -0,0 +1,91 @@
|
||||
/* vim:set ts=2 sw=2 sts=2 et: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Make sure that changing the tab location URL to a page with other scripts works.
|
||||
*/
|
||||
|
||||
var gPane = null;
|
||||
var gTab = null;
|
||||
var gDebuggee = null;
|
||||
var gDebugger = null;
|
||||
|
||||
function test()
|
||||
{
|
||||
debug_tab_pane(STACK_URL, function(aTab, aDebuggee, aPane) {
|
||||
gTab = aTab;
|
||||
gDebuggee = aDebuggee;
|
||||
gPane = aPane;
|
||||
gDebugger = gPane.contentWindow;
|
||||
|
||||
testSimpleCall();
|
||||
});
|
||||
}
|
||||
|
||||
function testSimpleCall() {
|
||||
gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
|
||||
Services.tm.currentThread.dispatch({
|
||||
run: function() {
|
||||
var frames = gDebugger.DebuggerView.StackFrames._frames,
|
||||
childNodes = frames.childNodes;
|
||||
|
||||
is(gDebugger.DebuggerController.activeThread.state, "paused",
|
||||
"Should only be getting stack frames while paused.");
|
||||
|
||||
is(frames.querySelectorAll(".dbg-stackframe").length, 1,
|
||||
"Should have only one frame.");
|
||||
|
||||
is(childNodes.length, frames.querySelectorAll(".dbg-stackframe").length,
|
||||
"All children should be frames.");
|
||||
|
||||
isnot(gDebugger.DebuggerView.Scripts.selected, null,
|
||||
"There should be a selected script.");
|
||||
isnot(gDebugger.editor.getText().length, 0,
|
||||
"The source editor should have some text displayed.");
|
||||
|
||||
testLocationChange();
|
||||
}
|
||||
}, 0);
|
||||
});
|
||||
|
||||
gDebuggee.simpleCall();
|
||||
}
|
||||
|
||||
function testLocationChange()
|
||||
{
|
||||
gDebugger.DebuggerController.activeThread.resume(function() {
|
||||
gDebugger.DebuggerController.client.addOneTimeListener("tabNavigated", function(aEvent, aPacket) {
|
||||
ok(true, "tabNavigated event was fired.");
|
||||
gDebugger.DebuggerController.client.addOneTimeListener("tabAttached", function(aEvent, aPacket) {
|
||||
ok(true, "Successfully reattached to the tab again.");
|
||||
|
||||
// Wait for the initial resume...
|
||||
gDebugger.gClient.addOneTimeListener("resumed", function() {
|
||||
isnot(gDebugger.DebuggerView.Scripts.selected, null,
|
||||
"There should be a selected script.");
|
||||
isnot(gDebugger.editor.getText().length, 0,
|
||||
"The source editor should have some text displayed.");
|
||||
|
||||
let menulist = gDebugger.DebuggerView.Scripts._scripts;
|
||||
let noScripts = gDebugger.L10N.getStr("noScriptsText");
|
||||
isnot(menulist.getAttribute("label"), noScripts,
|
||||
"The menulist should not display a notice that there are no scripts availalble.");
|
||||
isnot(menulist.getAttribute("tooltiptext"), "",
|
||||
"The menulist should have a tooltip text attributed.");
|
||||
|
||||
closeDebuggerAndFinish();
|
||||
});
|
||||
});
|
||||
});
|
||||
content.location = EXAMPLE_URL + "browser_dbg_iframes.html";
|
||||
});
|
||||
}
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
removeTab(gTab);
|
||||
gPane = null;
|
||||
gTab = null;
|
||||
gDebuggee = null;
|
||||
gDebugger = null;
|
||||
});
|
@ -191,6 +191,11 @@ function clear() {
|
||||
|
||||
function write(text) {
|
||||
clear();
|
||||
append(text);
|
||||
}
|
||||
|
||||
function append(text) {
|
||||
gSearchBox.focus();
|
||||
|
||||
for (let i = 0; i < text.length; i++) {
|
||||
EventUtils.sendChar(text[i]);
|
||||
|
@ -96,6 +96,8 @@ function secondSearch() {
|
||||
window.removeEventListener(aEvent.type, _onEvent);
|
||||
|
||||
executeSoon(function() {
|
||||
append("#" + token);
|
||||
|
||||
info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
|
||||
ok(gEditor.getCaretPosition().line == 5 &&
|
||||
gEditor.getCaretPosition().col == 8 + token.length,
|
||||
@ -103,6 +105,49 @@ function secondSearch() {
|
||||
is(gScripts.visibleItemsCount, 1,
|
||||
"Not all the correct scripts are shown after the search. (2)");
|
||||
|
||||
waitForFirstScript();
|
||||
});
|
||||
}
|
||||
});
|
||||
gScripts.selectIndex(1);
|
||||
}
|
||||
|
||||
function waitForFirstScript() {
|
||||
window.addEventListener("Debugger:ScriptShown", function _onEvent(aEvent) {
|
||||
info("Current script url:\n" + aEvent.detail.url + "\n");
|
||||
info("Debugger editor text:\n" + gEditor.getText() + "\n");
|
||||
|
||||
let url = aEvent.detail.url;
|
||||
if (url.indexOf("-01.js") != -1) {
|
||||
window.removeEventListener(aEvent.type, _onEvent);
|
||||
|
||||
executeSoon(function() {
|
||||
thirdSearch();
|
||||
});
|
||||
}
|
||||
});
|
||||
gScripts.selectIndex(0);
|
||||
}
|
||||
|
||||
function thirdSearch() {
|
||||
let token = "deb";
|
||||
|
||||
window.addEventListener("Debugger:ScriptShown", function _onEvent(aEvent) {
|
||||
info("Current script url:\n" + aEvent.detail.url + "\n");
|
||||
info("Debugger editor text:\n" + gEditor.getText() + "\n");
|
||||
|
||||
let url = aEvent.detail.url;
|
||||
if (url.indexOf("-02.js") != -1) {
|
||||
window.removeEventListener(aEvent.type, _onEvent);
|
||||
|
||||
executeSoon(function() {
|
||||
info("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
|
||||
ok(gEditor.getCaretPosition().line == 5 &&
|
||||
gEditor.getCaretPosition().col == 8 + token.length,
|
||||
"The editor didn't jump to the correct line. (3)");
|
||||
is(gScripts.visibleItemsCount, 1,
|
||||
"Not all the correct scripts are shown after the search. (3)");
|
||||
|
||||
finalCheck(0, "ugger;", token);
|
||||
});
|
||||
}
|
||||
@ -115,7 +160,7 @@ function finalCheck(i, string, token) {
|
||||
|
||||
ok(gEditor.getCaretPosition().line == 5 &&
|
||||
gEditor.getCaretPosition().col == 8 + token.length + i,
|
||||
"The editor didn't remain at the correct token. (3)");
|
||||
"The editor didn't remain at the correct token. (4)");
|
||||
|
||||
if (string[i]) {
|
||||
EventUtils.sendChar(string[i]);
|
||||
@ -126,7 +171,7 @@ 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)");
|
||||
"The editor didn't remain at the correct token. (5)");
|
||||
|
||||
executeSoon(function() {
|
||||
let noMatchingScripts = gDebugger.L10N.getStr("noMatchingScriptsText");
|
||||
@ -139,7 +184,7 @@ function finalCheck(i, string, token) {
|
||||
write("BOGUS");
|
||||
ok(gEditor.getCaretPosition().line == 5 &&
|
||||
gEditor.getCaretPosition().col == 8 + token.length + i,
|
||||
"The editor didn't remain at the correct token. (5)");
|
||||
"The editor didn't remain at the correct token. (6)");
|
||||
|
||||
is(gMenulist.getAttribute("label"), noMatchingScripts,
|
||||
"The menulist should display a notice that no scripts match the searched token.");
|
||||
@ -151,7 +196,7 @@ 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. (6)");
|
||||
"The editor didn't remain at the correct token. (7)");
|
||||
|
||||
isnot(gMenulist.getAttribute("label"), noMatchingScripts,
|
||||
"The menulist should not display a notice after the searchbox was emptied.");
|
||||
@ -171,6 +216,11 @@ function clear() {
|
||||
|
||||
function write(text) {
|
||||
clear();
|
||||
append(text);
|
||||
}
|
||||
|
||||
function append(text) {
|
||||
gSearchBox.focus();
|
||||
|
||||
for (let i = 0; i < text.length; i++) {
|
||||
EventUtils.sendChar(text[i]);
|
||||
|
@ -550,7 +550,7 @@ function OutputPanel(aChromeDoc, aInput, aLoadCallback)
|
||||
this._loadCallback = aLoadCallback;
|
||||
|
||||
/*
|
||||
<panel id="gcli-output"
|
||||
<tooltip id="gcli-output"
|
||||
noautofocus="true"
|
||||
noautohide="true"
|
||||
class="gcli-panel">
|
||||
@ -558,13 +558,15 @@ function OutputPanel(aChromeDoc, aInput, aLoadCallback)
|
||||
id="gcli-output-frame"
|
||||
src="chrome://browser/content/devtools/gclioutput.xhtml"
|
||||
flex="1"/>
|
||||
</panel>
|
||||
</tooltip>
|
||||
*/
|
||||
this._panel = aChromeDoc.createElement("panel");
|
||||
|
||||
// TODO: Switch back from tooltip to panel when metacity focus issue is fixed:
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=780102
|
||||
this._panel = aChromeDoc.createElement("tooltip");
|
||||
|
||||
this._panel.id = "gcli-output";
|
||||
this._panel.classList.add("gcli-panel");
|
||||
this._panel.setAttribute("noautofocus", "true");
|
||||
this._panel.setAttribute("noautohide", "true");
|
||||
this._toolbar.parentElement.insertBefore(this._panel, this._toolbar);
|
||||
|
||||
this._frame = aChromeDoc.createElementNS(NS_XHTML, "iframe");
|
||||
@ -579,6 +581,10 @@ function OutputPanel(aChromeDoc, aInput, aLoadCallback)
|
||||
this._frame.addEventListener("load", this._onload, true);
|
||||
|
||||
this.loaded = false;
|
||||
this.canHide = false;
|
||||
|
||||
this._onpopuphiding = this._onpopuphiding.bind(this);
|
||||
this._panel.addEventListener("popuphiding", this._onpopuphiding, true);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -606,6 +612,18 @@ OutputPanel.prototype._onload = function OP_onload()
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Prevent the popup from hiding if it is not permitted via this.canHide.
|
||||
*/
|
||||
OutputPanel.prototype._onpopuphiding = function OP_onpopuphiding(aEvent)
|
||||
{
|
||||
// TODO: When we switch back from tooltip to panel we can remove this hack:
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=780102
|
||||
if (!this.canHide) {
|
||||
aEvent.preventDefault();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Display the OutputPanel.
|
||||
*/
|
||||
@ -618,6 +636,8 @@ OutputPanel.prototype.show = function OP_show()
|
||||
this._resize();
|
||||
}.bind(this), 0);
|
||||
|
||||
this.canHide = false;
|
||||
|
||||
this._panel.openPopup(this._input, "before_start", 0, 0, false, false, null);
|
||||
this._resize();
|
||||
|
||||
@ -677,6 +697,7 @@ OutputPanel.prototype.update = function OP_update()
|
||||
*/
|
||||
OutputPanel.prototype.remove = function OP_remove()
|
||||
{
|
||||
this.canHide = true;
|
||||
this._panel.hidePopup();
|
||||
|
||||
if (this.displayedOutput) {
|
||||
@ -693,11 +714,15 @@ OutputPanel.prototype.destroy = function OP_destroy()
|
||||
{
|
||||
this.remove();
|
||||
|
||||
this._panel.removeEventListener("popuphiding", this._onpopuphiding, true);
|
||||
|
||||
this._panel.removeChild(this._frame);
|
||||
this._toolbar.parentElement.removeChild(this._panel);
|
||||
|
||||
delete this._input;
|
||||
delete this._toolbar;
|
||||
delete this._onload;
|
||||
delete this._onpopuphiding;
|
||||
delete this._panel;
|
||||
delete this._frame;
|
||||
delete this._content;
|
||||
@ -714,6 +739,7 @@ OutputPanel.prototype._visibilityChanged = function OP_visibilityChanged(aEvent)
|
||||
if (aEvent.outputVisible === true) {
|
||||
// this.show is called by _outputChanged
|
||||
} else {
|
||||
this.canHide = true;
|
||||
this._panel.hidePopup();
|
||||
}
|
||||
};
|
||||
@ -734,7 +760,7 @@ function TooltipPanel(aChromeDoc, aInput, aLoadCallback)
|
||||
this._onload = this._onload.bind(this);
|
||||
this._loadCallback = aLoadCallback;
|
||||
/*
|
||||
<panel id="gcli-tooltip"
|
||||
<tooltip id="gcli-tooltip"
|
||||
type="arrow"
|
||||
noautofocus="true"
|
||||
noautohide="true"
|
||||
@ -743,13 +769,15 @@ function TooltipPanel(aChromeDoc, aInput, aLoadCallback)
|
||||
id="gcli-tooltip-frame"
|
||||
src="chrome://browser/content/devtools/gclitooltip.xhtml"
|
||||
flex="1"/>
|
||||
</panel>
|
||||
</tooltip>
|
||||
*/
|
||||
this._panel = aChromeDoc.createElement("panel");
|
||||
|
||||
// TODO: Switch back from tooltip to panel when metacity focus issue is fixed:
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=780102
|
||||
this._panel = aChromeDoc.createElement("tooltip");
|
||||
|
||||
this._panel.id = "gcli-tooltip";
|
||||
this._panel.classList.add("gcli-panel");
|
||||
this._panel.setAttribute("noautofocus", "true");
|
||||
this._panel.setAttribute("noautohide", "true");
|
||||
this._toolbar.parentElement.insertBefore(this._panel, this._toolbar);
|
||||
|
||||
this._frame = aChromeDoc.createElementNS(NS_XHTML, "iframe");
|
||||
@ -759,7 +787,12 @@ function TooltipPanel(aChromeDoc, aInput, aLoadCallback)
|
||||
this._panel.appendChild(this._frame);
|
||||
|
||||
this._frame.addEventListener("load", this._onload, true);
|
||||
|
||||
this.loaded = false;
|
||||
this.canHide = false;
|
||||
|
||||
this._onpopuphiding = this._onpopuphiding.bind(this);
|
||||
this._panel.addEventListener("popuphiding", this._onpopuphiding, true);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -785,6 +818,18 @@ TooltipPanel.prototype._onload = function TP_onload()
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Prevent the popup from hiding if it is not permitted via this.canHide.
|
||||
*/
|
||||
TooltipPanel.prototype._onpopuphiding = function TP_onpopuphiding(aEvent)
|
||||
{
|
||||
// TODO: When we switch back from tooltip to panel we can remove this hack:
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=780102
|
||||
if (!this.canHide) {
|
||||
aEvent.preventDefault();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Display the TooltipPanel.
|
||||
*/
|
||||
@ -802,6 +847,8 @@ TooltipPanel.prototype.show = function TP_show(aDimensions)
|
||||
this._resize();
|
||||
}.bind(this), 0);
|
||||
|
||||
this.canHide = false;
|
||||
|
||||
this._resize();
|
||||
this._panel.openPopup(this._input, "before_start", aDimensions.start * 10, 0, false, false, null);
|
||||
this._input.focus();
|
||||
@ -845,6 +892,7 @@ TooltipPanel.prototype._resize = function TP_resize()
|
||||
*/
|
||||
TooltipPanel.prototype.remove = function TP_remove()
|
||||
{
|
||||
this.canHide = true;
|
||||
this._panel.hidePopup();
|
||||
};
|
||||
|
||||
@ -855,6 +903,8 @@ TooltipPanel.prototype.destroy = function TP_destroy()
|
||||
{
|
||||
this.remove();
|
||||
|
||||
this._panel.removeEventListener("popuphiding", this._onpopuphiding, true);
|
||||
|
||||
this._panel.removeChild(this._frame);
|
||||
this._toolbar.parentElement.removeChild(this._panel);
|
||||
|
||||
@ -862,6 +912,7 @@ TooltipPanel.prototype.destroy = function TP_destroy()
|
||||
delete this._dimensions;
|
||||
delete this._input;
|
||||
delete this._onload;
|
||||
delete this._onpopuphiding;
|
||||
delete this._panel;
|
||||
delete this._frame;
|
||||
delete this._toolbar;
|
||||
@ -879,6 +930,7 @@ TooltipPanel.prototype._visibilityChanged = function TP_visibilityChanged(aEvent
|
||||
if (aEvent.tooltipVisible === true) {
|
||||
this.show(aEvent.dimensions);
|
||||
} else {
|
||||
this.canHide = true;
|
||||
this._panel.hidePopup();
|
||||
}
|
||||
};
|
||||
|
@ -18,11 +18,13 @@ let webappsUI = {
|
||||
init: function webappsUI_init() {
|
||||
Services.obs.addObserver(this, "webapps-ask-install", false);
|
||||
Services.obs.addObserver(this, "webapps-launch", false);
|
||||
Services.obs.addObserver(this, "webapps-uninstall", false);
|
||||
},
|
||||
|
||||
uninit: function webappsUI_uninit() {
|
||||
Services.obs.removeObserver(this, "webapps-ask-install");
|
||||
Services.obs.removeObserver(this, "webapps-launch");
|
||||
Services.obs.removeObserver(this, "webapps-uninstall");
|
||||
},
|
||||
|
||||
observe: function webappsUI_observe(aSubject, aTopic, aData) {
|
||||
@ -37,6 +39,9 @@ let webappsUI = {
|
||||
case "webapps-launch":
|
||||
WebappOSUtils.launch(data);
|
||||
break;
|
||||
case "webapps-uninstall":
|
||||
WebappOSUtils.uninstall(data);
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -3311,6 +3311,7 @@ stack[anonid=browserStack][responsivemode] {
|
||||
text-shadow: none;
|
||||
background-image: -moz-linear-gradient(top, #B4211B, #8A1915);
|
||||
border-radius: 1px;
|
||||
-moz-margin-end: 5px;
|
||||
}
|
||||
|
||||
|
||||
|
@ -18,8 +18,8 @@ from devicemanager import DeviceManager, NetworkTools
|
||||
from mozprocess import ProcessHandlerMixin
|
||||
|
||||
|
||||
class LogcatProc(ProcessHandlerMixin):
|
||||
"""Process handler for logcat which puts all output in a Queue.
|
||||
class StdOutProc(ProcessHandlerMixin):
|
||||
"""Process handler for b2g which puts all output in a Queue.
|
||||
"""
|
||||
|
||||
def __init__(self, cmd, queue, **kwargs):
|
||||
@ -76,6 +76,20 @@ class B2GRemoteAutomation(Automation):
|
||||
env['MOZ_HIDE_RESULTS_TABLE'] = '1'
|
||||
return env
|
||||
|
||||
def waitForNet(self):
|
||||
active = False
|
||||
time_out = 0
|
||||
while not active and time_out < 40:
|
||||
data = self._devicemanager.runCmd(['shell', '/system/bin/netcfg']).stdout.readlines()
|
||||
data.pop(0)
|
||||
for line in data:
|
||||
if (re.search(r'UP\s+(?:[0-9]{1,3}\.){3}[0-9]{1,3}', line)):
|
||||
active = True
|
||||
break
|
||||
time_out += 1
|
||||
time.sleep(1)
|
||||
return active
|
||||
|
||||
def checkForCrashes(self, directory, symbolsPath):
|
||||
# XXX: This will have to be updated after crash reporting on b2g
|
||||
# is in place.
|
||||
@ -160,7 +174,11 @@ class B2GRemoteAutomation(Automation):
|
||||
serial, status = self.getDeviceStatus()
|
||||
|
||||
# reboot!
|
||||
self._devicemanager.checkCmd(['reboot'])
|
||||
self._devicemanager.runCmd(['shell', '/system/bin/reboot'])
|
||||
|
||||
# The above command can return while adb still thinks the device is
|
||||
# connected, so wait a little bit for it to disconnect from adb.
|
||||
time.sleep(10)
|
||||
|
||||
# wait for device to come back to previous status
|
||||
print 'waiting for device to come back online after reboot'
|
||||
@ -183,21 +201,26 @@ class B2GRemoteAutomation(Automation):
|
||||
# to pass env variables into the B2G process, but this doesn't
|
||||
# seem to matter.
|
||||
|
||||
instance = self.B2GInstance(self._devicemanager)
|
||||
|
||||
# reboot device so it starts up with the mochitest profile
|
||||
# XXX: We could potentially use 'stop b2g' + 'start b2g' to achieve
|
||||
# a similar effect; will see which is more stable while attempting
|
||||
# to bring up the continuous integration.
|
||||
if self._is_emulator:
|
||||
self.restartB2G()
|
||||
else:
|
||||
if not self._is_emulator:
|
||||
self.rebootDevice()
|
||||
time.sleep(5)
|
||||
#wait for wlan to come up
|
||||
if not self.waitForNet():
|
||||
raise Exception("network did not come up, please configure the network" +
|
||||
" prior to running before running the automation framework")
|
||||
|
||||
# Infrequently, gecko comes up before networking does, so wait a little
|
||||
# bit to give the network time to become available.
|
||||
# XXX: need a more robust mechanism for this
|
||||
time.sleep(40)
|
||||
# stop b2g
|
||||
self._devicemanager.runCmd(['shell', 'stop', 'b2g'])
|
||||
time.sleep(5)
|
||||
|
||||
# relaunch b2g inside b2g instance
|
||||
instance = self.B2GInstance(self._devicemanager)
|
||||
|
||||
time.sleep(5)
|
||||
|
||||
# Set up port forwarding again for Marionette, since any that
|
||||
# existed previously got wiped out by the reboot.
|
||||
@ -206,6 +229,11 @@ class B2GRemoteAutomation(Automation):
|
||||
'tcp:%s' % self.marionette.port,
|
||||
'tcp:%s' % self.marionette.port])
|
||||
|
||||
if self._is_emulator:
|
||||
self.marionette.emulator.wait_for_port()
|
||||
else:
|
||||
time.sleep(5)
|
||||
|
||||
# start a marionette session
|
||||
session = self.marionette.start_session()
|
||||
if 'b2g' not in session:
|
||||
@ -228,26 +256,29 @@ class B2GRemoteAutomation(Automation):
|
||||
|
||||
def __init__(self, dm):
|
||||
self.dm = dm
|
||||
self.logcat_proc = None
|
||||
self.stdout_proc = None
|
||||
self.queue = Queue.Queue()
|
||||
|
||||
# Launch logcat in a separate thread, and dump all output lines
|
||||
# Launch b2g in a separate thread, and dump all output lines
|
||||
# into a queue. The lines in this queue are
|
||||
# retrieved and returned by accessing the stdout property of
|
||||
# this class.
|
||||
cmd = [self.dm.adbPath]
|
||||
if self.dm.deviceSerial:
|
||||
cmd.extend(['-s', self.dm.deviceSerial])
|
||||
cmd.append('logcat')
|
||||
proc = threading.Thread(target=self._save_logcat_proc, args=(cmd, self.queue))
|
||||
cmd.append('shell')
|
||||
cmd.append('/system/bin/b2g.sh')
|
||||
proc = threading.Thread(target=self._save_stdout_proc, args=(cmd, self.queue))
|
||||
proc.daemon = True
|
||||
proc.start()
|
||||
|
||||
def _save_logcat_proc(self, cmd, queue):
|
||||
self.logcat_proc = LogcatProc(cmd, queue)
|
||||
self.logcat_proc.run()
|
||||
self.logcat_proc.waitForFinish()
|
||||
self.logcat_proc = None
|
||||
def _save_stdout_proc(self, cmd, queue):
|
||||
self.stdout_proc = StdOutProc(cmd, queue)
|
||||
self.stdout_proc.run()
|
||||
if hasattr(self.stdout_proc, 'processOutput'):
|
||||
self.stdout_proc.processOutput()
|
||||
self.stdout_proc.waitForFinish()
|
||||
self.stdout_proc = None
|
||||
|
||||
@property
|
||||
def pid(self):
|
||||
@ -257,7 +288,7 @@ class B2GRemoteAutomation(Automation):
|
||||
@property
|
||||
def stdout(self):
|
||||
# Return any lines in the queue used by the
|
||||
# logcat process handler.
|
||||
# b2g process handler.
|
||||
lines = []
|
||||
while True:
|
||||
try:
|
||||
|
@ -21,7 +21,7 @@ interface nsIContentSecurityPolicy;
|
||||
[ptr] native JSPrincipals(JSPrincipals);
|
||||
[ptr] native PrincipalArray(nsTArray<nsCOMPtr<nsIPrincipal> >);
|
||||
|
||||
[scriptable, uuid(8a74b011-667d-4cfa-b2a2-b27582ba5f38)]
|
||||
[scriptable, uuid(6df7d16d-5b26-42a1-b1f7-069d46c37aa8)]
|
||||
interface nsIPrincipal : nsISerializable
|
||||
{
|
||||
/**
|
||||
@ -230,13 +230,13 @@ interface nsIPrincipal : nsISerializable
|
||||
|
||||
const short APP_STATUS_NOT_INSTALLED = 0;
|
||||
const short APP_STATUS_INSTALLED = 1;
|
||||
const short APP_STATUS_TRUSTED = 2;
|
||||
const short APP_STATUS_PRIVILEGED = 2;
|
||||
const short APP_STATUS_CERTIFIED = 3;
|
||||
|
||||
/**
|
||||
* Shows the status of the app.
|
||||
* Can be: APP_STATUS_NOT_INSTALLED, APP_STATUS_INSTALLED,
|
||||
* APP_STATUS_TRUSTED or APP_STATUS_CERTIFIED.
|
||||
* APP_STATUS_PRIVILEGED or APP_STATUS_CERTIFIED.
|
||||
*/
|
||||
readonly attribute unsigned short appStatus;
|
||||
|
||||
|
@ -1043,7 +1043,7 @@ nsPrincipal::InitFromPersistent(const char* aPrefName,
|
||||
|
||||
const char* ordinalBegin = PL_strpbrk(aPrefName, "1234567890");
|
||||
if (ordinalBegin) {
|
||||
PRIntn n = atoi(ordinalBegin);
|
||||
int n = atoi(ordinalBegin);
|
||||
if (sCapabilitiesOrdinal <= n) {
|
||||
sCapabilitiesOrdinal = n + 1;
|
||||
}
|
||||
@ -1122,7 +1122,7 @@ nsPrincipal::Read(nsIObjectInputStream* aStream)
|
||||
|
||||
const char* ordinalBegin = PL_strpbrk(mPrefName.get(), "1234567890");
|
||||
if (ordinalBegin) {
|
||||
PRIntn n = atoi(ordinalBegin);
|
||||
int n = atoi(ordinalBegin);
|
||||
if (sCapabilitiesOrdinal <= n) {
|
||||
sCapabilitiesOrdinal = n + 1;
|
||||
}
|
||||
|
@ -1,58 +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 DirectionalityUtils_h___
|
||||
#define DirectionalityUtils_h___
|
||||
|
||||
class nsIContent;
|
||||
class nsIDocument;
|
||||
class nsINode;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
class Element;
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
namespace directionality {
|
||||
|
||||
enum Directionality {
|
||||
eDir_NotSet = 0,
|
||||
eDir_RTL = 1,
|
||||
eDir_LTR = 2
|
||||
};
|
||||
|
||||
void SetDirectionality(mozilla::dom::Element* aElement, Directionality aDir,
|
||||
bool aNotify = true);
|
||||
|
||||
/**
|
||||
* Set the directionality of an element according to the algorithm defined at
|
||||
* http://www.whatwg.org/specs/web-apps/current-work/multipage/elements.html#the-directionality,
|
||||
* not including elements with auto direction.
|
||||
*
|
||||
* @return the directionality that the element was set to
|
||||
*/
|
||||
Directionality RecomputeDirectionality(mozilla::dom::Element* aElement,
|
||||
bool aNotify = true);
|
||||
|
||||
/**
|
||||
* Set the directionality of any descendants of a node that do not themselves
|
||||
* have a dir attribute.
|
||||
* For performance reasons we walk down the descendant tree in the rare case
|
||||
* of setting the dir attribute, rather than walking up the ancestor tree in
|
||||
* the much more common case of getting the element's directionality.
|
||||
*/
|
||||
void SetDirectionalityOnDescendants(mozilla::dom::Element* aElement,
|
||||
Directionality aDir,
|
||||
bool aNotify = true);
|
||||
|
||||
} // end namespace directionality
|
||||
|
||||
} // end namespace mozilla
|
||||
|
||||
#endif /* DirectionalityUtils_h___ */
|
@ -10,7 +10,6 @@
|
||||
#include "mozilla/dom/FragmentOrElement.h" // for base class
|
||||
#include "nsChangeHint.h" // for enum
|
||||
#include "nsEventStates.h" // for member
|
||||
#include "mozilla/dom/DirectionalityUtils.h"
|
||||
|
||||
class nsEventStateManager;
|
||||
class nsFocusManager;
|
||||
@ -217,18 +216,6 @@ public:
|
||||
*/
|
||||
virtual nsIAtom *GetClassAttributeName() const = 0;
|
||||
|
||||
inline mozilla::directionality::Directionality GetDirectionality() const {
|
||||
if (HasFlag(NODE_HAS_DIRECTION_RTL)) {
|
||||
return mozilla::directionality::eDir_RTL;
|
||||
}
|
||||
|
||||
if (HasFlag(NODE_HAS_DIRECTION_LTR)) {
|
||||
return mozilla::directionality::eDir_LTR;
|
||||
}
|
||||
|
||||
return mozilla::directionality::eDir_NotSet;
|
||||
}
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Method to get the _intrinsic_ content state of this element. This is the
|
||||
|
@ -48,7 +48,6 @@ $(NULL)
|
||||
EXPORTS_NAMESPACES = mozilla/dom mozilla
|
||||
|
||||
EXPORTS_mozilla/dom = \
|
||||
DirectionalityUtils.h \
|
||||
Element.h \
|
||||
FragmentOrElement.h \
|
||||
FromParser.h \
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include "nsPIDOMWindow.h" // for use in inline functions
|
||||
#include "nsPropertyTable.h" // for member
|
||||
#include "nsTHashtable.h" // for member
|
||||
#include "mozilla/dom/DirectionalityUtils.h"
|
||||
|
||||
class imgIRequest;
|
||||
class nsAString;
|
||||
@ -398,10 +397,6 @@ public:
|
||||
{
|
||||
mBidiOptions = aBidiOptions;
|
||||
}
|
||||
|
||||
inline mozilla::directionality::Directionality GetDocumentDirectionality() {
|
||||
return mDirectionality;
|
||||
}
|
||||
|
||||
/**
|
||||
* Access HTTP header data (this may also get set from other
|
||||
@ -1858,9 +1853,6 @@ protected:
|
||||
// defined in nsBidiUtils.h
|
||||
PRUint32 mBidiOptions;
|
||||
|
||||
// The root directionality of this document.
|
||||
mozilla::directionality::Directionality mDirectionality;
|
||||
|
||||
nsCString mContentLanguage;
|
||||
private:
|
||||
nsCString mContentType;
|
||||
|
@ -145,16 +145,8 @@ enum {
|
||||
// Set if the node has had :hover selectors matched against it
|
||||
NODE_HAS_RELEVANT_HOVER_RULES = 0x00080000U,
|
||||
|
||||
// Set if the node has right-to-left directionality
|
||||
NODE_HAS_DIRECTION_RTL = 0x00100000U,
|
||||
|
||||
// Set if the node has left-to-right directionality
|
||||
NODE_HAS_DIRECTION_LTR = 0x00200000U,
|
||||
|
||||
NODE_ALL_DIRECTION_FLAGS = NODE_HAS_DIRECTION_LTR | NODE_HAS_DIRECTION_RTL,
|
||||
|
||||
// Remaining bits are node type specific.
|
||||
NODE_TYPE_SPECIFIC_BITS_OFFSET = 22
|
||||
NODE_TYPE_SPECIFIC_BITS_OFFSET = 20
|
||||
};
|
||||
|
||||
/**
|
||||
@ -1287,8 +1279,6 @@ private:
|
||||
NodeIsContent,
|
||||
// Set if the node has animations or transitions
|
||||
ElementHasAnimations,
|
||||
// Set if node has a dir attribute with a valid value (ltr or rtl)
|
||||
NodeHasValidDirAttribute,
|
||||
// Guard value
|
||||
BooleanFlagCount
|
||||
};
|
||||
@ -1356,9 +1346,6 @@ public:
|
||||
void ClearPointerLock() { ClearBoolFlag(ElementHasPointerLock); }
|
||||
bool MayHaveAnimations() { return GetBoolFlag(ElementHasAnimations); }
|
||||
void SetMayHaveAnimations() { SetBoolFlag(ElementHasAnimations); }
|
||||
void SetHasValidDir() { SetBoolFlag(NodeHasValidDirAttribute); }
|
||||
void ClearHasValidDir() { ClearBoolFlag(NodeHasValidDirAttribute); }
|
||||
bool HasValidDir() const { return GetBoolFlag(NodeHasValidDirAttribute); }
|
||||
protected:
|
||||
void SetParentIsContent(bool aValue) { SetBoolFlag(ParentIsContent, aValue); }
|
||||
void SetInDocument() { SetBoolFlag(IsInDocument); }
|
||||
|
@ -1,96 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=2 sw=2 et tw=78: */
|
||||
/* 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 "mozilla/dom/DirectionalityUtils.h"
|
||||
#include "nsINode.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "nsIDOMNodeFilter.h"
|
||||
#include "nsTreeWalker.h"
|
||||
#include "nsIDOMHTMLDocument.h"
|
||||
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
namespace directionality {
|
||||
|
||||
typedef mozilla::dom::Element Element;
|
||||
|
||||
void
|
||||
SetDirectionality(Element* aElement, Directionality aDir, bool aNotify)
|
||||
{
|
||||
aElement->UnsetFlags(NODE_ALL_DIRECTION_FLAGS);
|
||||
switch (aDir) {
|
||||
case eDir_RTL:
|
||||
aElement->SetFlags(NODE_HAS_DIRECTION_RTL);
|
||||
break;
|
||||
case eDir_LTR:
|
||||
aElement->SetFlags(NODE_HAS_DIRECTION_LTR);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
aElement->UpdateState(aNotify);
|
||||
}
|
||||
|
||||
Directionality
|
||||
RecomputeDirectionality(Element* aElement, bool aNotify)
|
||||
{
|
||||
Directionality dir = eDir_LTR;
|
||||
|
||||
if (aElement->HasValidDir()) {
|
||||
dir = aElement->GetDirectionality();
|
||||
} else {
|
||||
Element* parent = aElement->GetElementParent();
|
||||
if (parent) {
|
||||
// If the element doesn't have an explicit dir attribute with a valid
|
||||
// value, the directionality is the same as the parent element (but
|
||||
// don't propagate the parent directionality if it isn't set yet).
|
||||
Directionality parentDir = parent->GetDirectionality();
|
||||
if (parentDir != eDir_NotSet) {
|
||||
dir = parentDir;
|
||||
}
|
||||
} else {
|
||||
// If there is no parent element, the directionality is the same as the
|
||||
// document direction.
|
||||
Directionality documentDir =
|
||||
aElement->OwnerDoc()->GetDocumentDirectionality();
|
||||
if (documentDir != eDir_NotSet) {
|
||||
dir = documentDir;
|
||||
}
|
||||
}
|
||||
|
||||
SetDirectionality(aElement, dir, aNotify);
|
||||
}
|
||||
return dir;
|
||||
}
|
||||
|
||||
void
|
||||
SetDirectionalityOnDescendants(Element* aElement, Directionality aDir,
|
||||
bool aNotify)
|
||||
{
|
||||
for (nsIContent* child = aElement->GetFirstChild(); child; ) {
|
||||
if (!child->IsElement()) {
|
||||
child = child->GetNextNode(aElement);
|
||||
continue;
|
||||
}
|
||||
|
||||
Element* element = child->AsElement();
|
||||
if (element->HasValidDir()) {
|
||||
child = child->GetNextNonChildNode(aElement);
|
||||
continue;
|
||||
}
|
||||
SetDirectionality(element, aDir, aNotify);
|
||||
child = child->GetNextNode(aElement);
|
||||
}
|
||||
}
|
||||
|
||||
} // end namespace directionality
|
||||
|
||||
} // end namespace mozilla
|
||||
|
@ -53,7 +53,6 @@ LOCAL_INCLUDES = \
|
||||
$(NULL)
|
||||
|
||||
CPPSRCS = \
|
||||
DirectionalityUtils.cpp \
|
||||
nsAtomListUtils.cpp \
|
||||
nsAttrAndChildArray.cpp \
|
||||
nsAttrValue.cpp \
|
||||
|
@ -53,7 +53,7 @@ extern PRLogModuleInfo* gContentSinkLogModuleInfo;
|
||||
#define SINK_TRACE_REFLOW 0x2
|
||||
#define SINK_ALWAYS_REFLOW 0x4
|
||||
|
||||
#define SINK_LOG_TEST(_lm, _bit) (PRIntn((_lm)->level) & (_bit))
|
||||
#define SINK_LOG_TEST(_lm, _bit) (int((_lm)->level) & (_bit))
|
||||
|
||||
#define SINK_TRACE(_lm, _bit, _args) \
|
||||
PR_BEGIN_MACRO \
|
||||
|
@ -91,7 +91,6 @@
|
||||
#include "nsXMLEventsManager.h"
|
||||
|
||||
#include "nsBidiUtils.h"
|
||||
#include "mozilla/dom/DirectionalityUtils.h"
|
||||
|
||||
#include "nsIDOMUserDataHandler.h"
|
||||
#include "nsIDOMXPathEvaluator.h"
|
||||
@ -171,7 +170,6 @@
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
using namespace mozilla::directionality;
|
||||
|
||||
typedef nsTArray<Link*> LinkArray;
|
||||
|
||||
@ -1512,8 +1510,7 @@ nsIDocument::nsIDocument()
|
||||
mAllowDNSPrefetch(true),
|
||||
mIsBeingUsedAsImage(false),
|
||||
mHasLinksToUpdate(false),
|
||||
mPartID(0),
|
||||
mDirectionality(eDir_LTR)
|
||||
mPartID(0)
|
||||
{
|
||||
SetInDocument();
|
||||
}
|
||||
@ -5586,15 +5583,6 @@ nsDocument::SetDir(const nsAString& aDirection)
|
||||
// No presentation; just set it on ourselves
|
||||
SetBidiOptions(options);
|
||||
}
|
||||
Directionality dir = elt->mValue == IBMBIDI_TEXTDIRECTION_RTL ?
|
||||
eDir_RTL : eDir_LTR;
|
||||
SetDocumentDirectionality(dir);
|
||||
// Set the directionality of the root element and its descendants, if any
|
||||
Element* rootElement = GetRootElement();
|
||||
if (rootElement) {
|
||||
SetDirectionality(rootElement, dir, true);
|
||||
SetDirectionalityOnDescendants(rootElement, dir);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -1048,12 +1048,6 @@ protected:
|
||||
nsIContent* GetFirstBaseNodeWithHref();
|
||||
nsresult SetFirstBaseNodeWithHref(nsIContent *node);
|
||||
|
||||
inline void
|
||||
SetDocumentDirectionality(mozilla::directionality::Directionality aDir)
|
||||
{
|
||||
mDirectionality = aDir;
|
||||
}
|
||||
|
||||
// Get the first <title> element with the given IsNodeOfType type, or
|
||||
// return null if there isn't one
|
||||
nsIContent* GetTitleContent(PRUint32 aNodeType);
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
#include "prenv.h"
|
||||
|
||||
#include "mozIApplication.h"
|
||||
#include "nsIDOMHTMLIFrameElement.h"
|
||||
#include "nsIDOMHTMLFrameElement.h"
|
||||
#include "nsIDOMMozBrowserFrame.h"
|
||||
@ -31,6 +32,7 @@
|
||||
#include "nsIDocShellTreeNode.h"
|
||||
#include "nsIDocShellTreeOwner.h"
|
||||
#include "nsIDocShellLoadInfo.h"
|
||||
#include "nsIDOMApplicationRegistry.h"
|
||||
#include "nsIBaseWindow.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsIXPConnect.h"
|
||||
@ -1973,9 +1975,8 @@ nsFrameLoader::TryRemoteBrowser()
|
||||
return false;
|
||||
}
|
||||
|
||||
PRUint32 appId = 0;
|
||||
bool isBrowserElement = false;
|
||||
|
||||
nsCOMPtr<mozIApplication> app;
|
||||
if (OwnerIsBrowserFrame()) {
|
||||
isBrowserElement = true;
|
||||
|
||||
@ -1989,24 +1990,21 @@ nsFrameLoader::TryRemoteBrowser()
|
||||
return false;
|
||||
}
|
||||
|
||||
appsService->GetAppLocalIdByManifestURL(manifest, &appId);
|
||||
|
||||
// If the frame is actually an app, we should not mark it as a browser.
|
||||
if (appId != nsIScriptSecurityManager::NO_APP_ID) {
|
||||
nsCOMPtr<mozIDOMApplication> domApp;
|
||||
appsService->GetAppByManifestURL(manifest, getter_AddRefs(domApp));
|
||||
// If the frame is actually an app, we should not mark it as a
|
||||
// browser. This is to identify the data store: since <app>s
|
||||
// and <browser>s-within-<app>s have different stores, we want
|
||||
// to ensure the <app> uses its store, not the one for its
|
||||
// <browser>s.
|
||||
app = do_QueryInterface(domApp);
|
||||
if (app) {
|
||||
isBrowserElement = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If our owner has no app manifest URL, then this is equivalent to
|
||||
// ContentParent::GetNewOrUsed().
|
||||
nsAutoString appManifest;
|
||||
GetOwnerAppManifestURL(appManifest);
|
||||
ContentParent* parent = ContentParent::GetForApp(appManifest);
|
||||
|
||||
NS_ASSERTION(parent->IsAlive(), "Process parent should be alive; something is very wrong!");
|
||||
mRemoteBrowser = parent->CreateTab(chromeFlags, isBrowserElement, appId);
|
||||
if (mRemoteBrowser) {
|
||||
if ((mRemoteBrowser = ContentParent::CreateBrowser(app, isBrowserElement))) {
|
||||
nsCOMPtr<nsIDOMElement> element = do_QueryInterface(mOwnerContent);
|
||||
mRemoteBrowser->SetOwnerElement(element);
|
||||
|
||||
@ -2019,8 +2017,8 @@ nsFrameLoader::TryRemoteBrowser()
|
||||
nsCOMPtr<nsIBrowserDOMWindow> browserDOMWin;
|
||||
rootChromeWin->GetBrowserDOMWindow(getter_AddRefs(browserDOMWin));
|
||||
mRemoteBrowser->SetBrowserDOMWindow(browserDOMWin);
|
||||
|
||||
mChildHost = parent;
|
||||
|
||||
mChildHost = static_cast<ContentParent*>(mRemoteBrowser->Manager());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -51,7 +51,6 @@
|
||||
#include "nsIDOMMutationEvent.h"
|
||||
#include "nsMutationEvent.h"
|
||||
#include "nsNodeUtils.h"
|
||||
#include "mozilla/dom/DirectionalityUtils.h"
|
||||
#include "nsDocument.h"
|
||||
#include "nsAttrValueOrString.h"
|
||||
#ifdef MOZ_XUL
|
||||
@ -129,7 +128,6 @@
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
using namespace mozilla::directionality;
|
||||
|
||||
nsEventStates
|
||||
Element::IntrinsicState() const
|
||||
@ -1360,13 +1358,6 @@ nsGenericElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
SetSubtreeRootPointer(aParent->SubtreeRoot());
|
||||
}
|
||||
|
||||
// This has to be here, rather than in nsGenericHTMLElement::BindToTree,
|
||||
// because it has to happen after updating the parent pointer, but before
|
||||
// recursively binding the kids.
|
||||
if (IsHTML()) {
|
||||
RecomputeDirectionality(this, false);
|
||||
}
|
||||
|
||||
// If NODE_FORCE_XBL_BINDINGS was set we might have anonymous children
|
||||
// that also need to be told that they are moving.
|
||||
nsresult rv;
|
||||
@ -1552,13 +1543,6 @@ nsGenericElement::UnbindFromTree(bool aDeep, bool aNullParent)
|
||||
}
|
||||
}
|
||||
|
||||
// This has to be here, rather than in nsGenericHTMLElement::UnbindFromTree,
|
||||
// because it has to happen after unsetting the parent pointer, but before
|
||||
// recursively unbinding the kids.
|
||||
if (IsHTML()) {
|
||||
RecomputeDirectionality(this, false);
|
||||
}
|
||||
|
||||
if (aDeep) {
|
||||
// Do the kids. Don't call GetChildCount() here since that'll force
|
||||
// XUL to generate template children, which there is no need for since
|
||||
|
@ -270,7 +270,6 @@ GK_ATOM(dialog, "dialog")
|
||||
GK_ATOM(difference, "difference")
|
||||
GK_ATOM(digit, "digit")
|
||||
GK_ATOM(dir, "dir")
|
||||
GK_ATOM(directionality, "directionality")
|
||||
GK_ATOM(disableOutputEscaping, "disable-output-escaping")
|
||||
GK_ATOM(disabled, "disabled")
|
||||
GK_ATOM(display, "display")
|
||||
|
@ -54,7 +54,7 @@ nsNodeInfoManager::GetNodeInfoInnerHashValue(const void *key)
|
||||
}
|
||||
|
||||
|
||||
PRIntn
|
||||
int
|
||||
nsNodeInfoManager::NodeInfoInnerKeyCompare(const void *key1, const void *key2)
|
||||
{
|
||||
NS_ASSERTION(key1 && key2, "Null key passed to NodeInfoInnerKeyCompare!");
|
||||
@ -183,8 +183,8 @@ nsNodeInfoManager::Init(nsIDocument *aDocument)
|
||||
}
|
||||
|
||||
// static
|
||||
PRIntn
|
||||
nsNodeInfoManager::DropNodeInfoDocument(PLHashEntry *he, PRIntn hashIndex, void *arg)
|
||||
int
|
||||
nsNodeInfoManager::DropNodeInfoDocument(PLHashEntry *he, int hashIndex, void *arg)
|
||||
{
|
||||
static_cast<nsINodeInfo*>(he->value)->mDocument = nullptr;
|
||||
return HT_ENUMERATE_NEXT;
|
||||
|
@ -116,9 +116,9 @@ protected:
|
||||
void SetDocumentPrincipal(nsIPrincipal *aPrincipal);
|
||||
|
||||
private:
|
||||
static PRIntn NodeInfoInnerKeyCompare(const void *key1, const void *key2);
|
||||
static int NodeInfoInnerKeyCompare(const void *key1, const void *key2);
|
||||
static PLHashNumber GetNodeInfoInnerHashValue(const void *key);
|
||||
static PRIntn DropNodeInfoDocument(PLHashEntry *he, PRIntn hashIndex,
|
||||
static int DropNodeInfoDocument(PLHashEntry *he, int hashIndex,
|
||||
void *arg);
|
||||
|
||||
PLHashTable *mNodeInfoHash;
|
||||
|
@ -381,8 +381,6 @@ MOCHITEST_FILES_B = \
|
||||
test_bug562652.html \
|
||||
test_bug562137.html \
|
||||
file_bug562137.txt \
|
||||
test_bug562169-1.html \
|
||||
test_bug562169-2.html \
|
||||
test_bug548193.html \
|
||||
file_bug548193.sjs \
|
||||
test_html_colors_quirks.html \
|
||||
|
@ -32,15 +32,14 @@ function afterLoad() {
|
||||
iframeDoc.getElementById("password").value = "123456";
|
||||
iframeDoc.getElementById("hidden").value = "gecko";
|
||||
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var file = Components.classes["@mozilla.org/file/directory_service;1"]
|
||||
var file = SpecialPowers.wrap(Components).classes["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Components.interfaces.nsIProperties)
|
||||
.get("TmpD", Components.interfaces.nsILocalFile);
|
||||
file.append("345339_test.file");
|
||||
file.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0666);
|
||||
filePath = file.path;
|
||||
|
||||
iframeDoc.getElementById("file").value = filePath;
|
||||
SpecialPowers.wrap(iframeDoc).getElementById("file").value = filePath;
|
||||
|
||||
/* Reload the page */
|
||||
$("testframe").setAttribute("onload", "afterReload()");
|
||||
@ -62,8 +61,7 @@ function afterReload() {
|
||||
"password field value forgotten");
|
||||
is(iframeDoc.getElementById("hidden").value, "gecko",
|
||||
"hidden field value preserved");
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
is(iframeDoc.getElementById("file").value, filePath,
|
||||
is(SpecialPowers.wrap(iframeDoc).getElementById("file").value, filePath,
|
||||
"file field value preserved");
|
||||
|
||||
SimpleTest.finish();
|
||||
|
@ -31,9 +31,10 @@ function eventHandler(evt) {
|
||||
|
||||
function test(trusted, type, removeAddedListener, removeSetListener, allowUntrusted) {
|
||||
if (trusted) {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var x1 = SpecialPowers.wrap(new XMLHttpRequest());
|
||||
} else {
|
||||
x1 = new XMLHttpRequest();
|
||||
}
|
||||
var x1 = new XMLHttpRequest();
|
||||
|
||||
var handlerCount = 0;
|
||||
if (trusted || allowUntrusted || allowUntrusted == undefined) {
|
||||
|
@ -22,14 +22,13 @@
|
||||
request.send(null);
|
||||
|
||||
// Try reading headers in privileged context
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
is(request.getResponseHeader("Set-Cookie"), "test", "Reading Set-Cookie response header in privileged context");
|
||||
is(request.getResponseHeader("Set-Cookie2"), "test2", "Reading Set-Cookie2 response header in privileged context");
|
||||
is(request.getResponseHeader("X-Dummy"), "test", "Reading X-Dummy response header in privileged context");
|
||||
is(SpecialPowers.wrap(request).getResponseHeader("Set-Cookie"), "test", "Reading Set-Cookie response header in privileged context");
|
||||
is(SpecialPowers.wrap(request).getResponseHeader("Set-Cookie2"), "test2", "Reading Set-Cookie2 response header in privileged context");
|
||||
is(SpecialPowers.wrap(request).getResponseHeader("X-Dummy"), "test", "Reading X-Dummy response header in privileged context");
|
||||
|
||||
ok(/\bSet-Cookie:/i.test(request.getAllResponseHeaders()), "Looking for Set-Cookie in all response headers in privileged context");
|
||||
ok(/\bSet-Cookie2:/i.test(request.getAllResponseHeaders()), "Looking for Set-Cookie2 in all response headers in privileged context");
|
||||
ok(/\bX-Dummy:/i.test(request.getAllResponseHeaders()), "Looking for X-Dummy in all response headers in privileged context");
|
||||
ok(/\bSet-Cookie:/i.test(SpecialPowers.wrap(request).getAllResponseHeaders()), "Looking for Set-Cookie in all response headers in privileged context");
|
||||
ok(/\bSet-Cookie2:/i.test(SpecialPowers.wrap(request).getAllResponseHeaders()), "Looking for Set-Cookie2 in all response headers in privileged context");
|
||||
ok(/\bX-Dummy:/i.test(SpecialPowers.wrap(request).getAllResponseHeaders()), "Looking for X-Dummy in all response headers in privileged context");
|
||||
|
||||
// Try reading headers in unprivileged context
|
||||
setTimeout(function() {
|
||||
|
@ -19,10 +19,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=422537
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
/** Test for Bug 422537 **/
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
|
||||
var isupports_string = Components.classes["@mozilla.org/supports-string;1"]
|
||||
.createInstance(Components.interfaces.nsISupportsString);
|
||||
var isupports_string = SpecialPowers.wrap(Components)
|
||||
.classes["@mozilla.org/supports-string;1"]
|
||||
.createInstance(Components.interfaces.nsISupportsString);
|
||||
isupports_string.data = "foo";
|
||||
|
||||
const url = "http://mochi.test:8888";
|
||||
@ -35,12 +34,15 @@ var body = [
|
||||
for each (var i in body) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", url, true);
|
||||
xhr.send(i);
|
||||
var chan = SpecialPowers.unwrap(SpecialPowers.wrap(xhr).channel);
|
||||
if (!(chan instanceof Components.interfaces.nsIUploadChannel))
|
||||
if (i == isupports_string)
|
||||
SpecialPowers.wrap(xhr).send(i);
|
||||
else
|
||||
xhr.send(i);
|
||||
var chan = SpecialPowers.wrap(xhr).channel;
|
||||
if (!SpecialPowers.call_Instanceof(chan, Components.interfaces.nsIUploadChannel))
|
||||
throw "Must be an upload channel";
|
||||
var stream = chan.uploadStream;
|
||||
if (!stream || !(stream instanceof Components.interfaces.nsISeekableStream))
|
||||
if (!stream || !SpecialPowers.call_Instanceof(stream, Components.interfaces.nsISeekableStream))
|
||||
throw "Stream must be seekable";
|
||||
// the following is a no-op, but should not throw an exception
|
||||
stream.seek(Components.interfaces.nsISeekableStream.NS_SEEK_CUR, 0);
|
||||
|
@ -1,44 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=562169
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 562169</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=562169">Mozilla Bug 562169</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
<div dir="rtl" id="z"></div>
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 562169 **/
|
||||
/** Test that adding an child to an element with dir="rtl" makes the
|
||||
child have rtl directionality, and removing the child makes it
|
||||
go back to ltr directionality **/
|
||||
|
||||
function checkSelector(element, expectedDir, expectedChild)
|
||||
{
|
||||
ok(element.querySelector(":dir("+expectedDir+")") == expectedChild,
|
||||
"direction should be " + expectedDir);
|
||||
}
|
||||
|
||||
var x = document.createElement("div");
|
||||
var y = document.createElement("div");
|
||||
x.appendChild(y);
|
||||
checkSelector(x, "ltr", y);
|
||||
$(z).appendChild(x);
|
||||
checkSelector(x, "rtl", y);
|
||||
$(z).removeChild(x);
|
||||
checkSelector(x, "ltr", y);
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -1,29 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=562169
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 562169</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=562169">Mozilla Bug 562169</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 562169 **/
|
||||
/** Test that a newly created element has ltr directionality **/
|
||||
|
||||
ok(document.createElement("div").mozMatchesSelector(":dir(ltr)"),
|
||||
"Element should be ltr on creation");
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
7
content/canvas/crashtests/727547.html
Normal file
7
content/canvas/crashtests/727547.html
Normal file
@ -0,0 +1,7 @@
|
||||
<!doctype html>
|
||||
<canvas></canvas>
|
||||
<script>
|
||||
var canvas = document.body.firstChild,
|
||||
gl = canvas.getContext("experimental-webgl");
|
||||
gl.texImage2D(0, 0, 0, 0, 0, { width: 10, height: 10, data: 7 });
|
||||
</script>
|
10
content/canvas/crashtests/780392-1.html
Normal file
10
content/canvas/crashtests/780392-1.html
Normal file
@ -0,0 +1,10 @@
|
||||
<!doctype HTML>
|
||||
<html>
|
||||
<body>
|
||||
<canvas id="c" width="10000" height="10000"></canvas>
|
||||
<script>
|
||||
var ctx = document.getElementById("c").getContext("2d");
|
||||
ctx.fillText("Hello world!", 50, 50);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -2,6 +2,7 @@ load 360293-1.html
|
||||
load 421715-1.html
|
||||
load 553938-1.html
|
||||
load 647480.html
|
||||
load 727547.html
|
||||
load 0px-size-font-667225.html
|
||||
load texImage2D.html
|
||||
load 729116.html
|
||||
@ -11,3 +12,4 @@ load 746813-1.html
|
||||
#load 745818-large-source.html
|
||||
load 743499-negative-size.html
|
||||
load 767337-1.html
|
||||
load 780392-1.html
|
||||
|
@ -6,13 +6,14 @@
|
||||
<script>
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
const Cc = SpecialPowers.wrap(Components).classes;
|
||||
const Cr = SpecialPowers.wrap(Components).results;
|
||||
|
||||
function IsD2DEnabled() {
|
||||
var enabled = false;
|
||||
|
||||
try {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
enabled = Components.classes["@mozilla.org/gfx/info;1"].getService(Components.interfaces.nsIGfxInfo).D2DEnabled;
|
||||
enabled = Cc["@mozilla.org/gfx/info;1"].getService(Components.interfaces.nsIGfxInfo).D2DEnabled;
|
||||
} catch(e) {}
|
||||
|
||||
return enabled;
|
||||
@ -26,10 +27,9 @@ function IsMacOSX10_5orOlder() {
|
||||
var is105orOlder = false;
|
||||
|
||||
if (navigator.platform.indexOf("Mac") == 0) {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var version = Components.classes["@mozilla.org/system-info;1"]
|
||||
.getService(Components.interfaces.nsIPropertyBag2)
|
||||
.getProperty("version");
|
||||
var version = Cc["@mozilla.org/system-info;1"]
|
||||
.getService(Components.interfaces.nsIPropertyBag2)
|
||||
.getProperty("version");
|
||||
// the next line is correct: Mac OS 10.6 corresponds to Darwin version 10 !
|
||||
// Mac OS 10.5 would be Darwin version 9. the |version| string we've got here
|
||||
// is the Darwin version.
|
||||
@ -43,8 +43,7 @@ function IsAzureEnabled() {
|
||||
var enabled = false;
|
||||
|
||||
try {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var backend = Components.classes["@mozilla.org/gfx/info;1"].getService(Components.interfaces.nsIGfxInfo).getInfo().AzureCanvasBackend;
|
||||
var backend = Cc["@mozilla.org/gfx/info;1"].getService(Components.interfaces.nsIGfxInfo).getInfo().AzureCanvasBackend;
|
||||
enabled = (backend != "none");
|
||||
} catch (e) { }
|
||||
|
||||
@ -55,8 +54,7 @@ function IsAzureSkia() {
|
||||
var enabled = false;
|
||||
|
||||
try {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var backend = Components.classes["@mozilla.org/gfx/info;1"].getService(Components.interfaces.nsIGfxInfo).getInfo().AzureCanvasBackend;
|
||||
var backend = Cc["@mozilla.org/gfx/info;1"].getService(Components.interfaces.nsIGfxInfo).getInfo().AzureCanvasBackend;
|
||||
enabled = (backend == "skia");
|
||||
} catch (e) { }
|
||||
|
||||
@ -67,8 +65,7 @@ function IsAzureCairo() {
|
||||
var enabled = false;
|
||||
|
||||
try {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var backend = Components.classes["@mozilla.org/gfx/info;1"].getService(Components.interfaces.nsIGfxInfo).getInfo().AzureCanvasBackend;
|
||||
var backend = Cc["@mozilla.org/gfx/info;1"].getService(Components.interfaces.nsIGfxInfo).getInfo().AzureCanvasBackend;
|
||||
enabled = (backend == "cairo");
|
||||
} catch (e) { }
|
||||
|
||||
@ -126,7 +123,8 @@ ok(ctx.canvas === canvas, "ctx.canvas === canvas");
|
||||
function isPixel(ctx, x,y, r,g,b,a, d) {
|
||||
var pos = x + "," + y;
|
||||
var colour = r + "," + g + "," + b + "," + a;
|
||||
var pixel = ctx.getImageData(x, y, 1, 1);
|
||||
var pixel = SpecialPowers.unwrap(SpecialPowers.wrap(ctx)
|
||||
.getImageData(x, y, 1, 1));
|
||||
var pr = pixel.data[0],
|
||||
pg = pixel.data[1],
|
||||
pb = pixel.data[2],
|
||||
@ -19804,9 +19802,8 @@ function test_bug397524() {
|
||||
<script>
|
||||
function test_bug405982() {
|
||||
|
||||
var canvas = document.getElementById('c614');
|
||||
var canvas = SpecialPowers.wrap(document.getElementById('c614'));
|
||||
var ctx = canvas.getContext('2d');
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
|
||||
var _threw = false;
|
||||
try {
|
||||
@ -21123,7 +21120,6 @@ img.onload = wrapFunction(function ()
|
||||
ctx667.drawImage(img, 0, 25);
|
||||
// (The alpha values do not really survive float->int conversion, so just
|
||||
// do approximate comparisons)
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
isPixel(ctx667, 12,40, 1,3,254,255, 0);
|
||||
isPixel(ctx667, 37,40, 8,252,248,191, 2);
|
||||
isPixel(ctx667, 62,40, 6,10,250,127, 4);
|
||||
@ -21250,7 +21246,6 @@ deferTest();
|
||||
img.onload = wrapFunction(function ()
|
||||
{
|
||||
ctx672.drawImage(img, 0, 0);
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
isPixel(ctx672, 12,20, 255,255,0,255, 0);
|
||||
isPixel(ctx672, 50,20, 0,255,255,255, 0);
|
||||
isPixel(ctx672, 87,20, 0,0,255,255, 0);
|
||||
|
@ -248,10 +248,6 @@ private:
|
||||
#define NS_EVENT_STATE_VULNERABLE_NO_UPDATE NS_DEFINE_EVENT_STATE_MACRO(41)
|
||||
// Platform does not support plugin content (some mobile platforms)
|
||||
#define NS_EVENT_STATE_TYPE_UNSUPPORTED_PLATFORM NS_DEFINE_EVENT_STATE_MACRO(42)
|
||||
// Element is ltr (for :dir pseudo-class)
|
||||
#define NS_EVENT_STATE_LTR NS_DEFINE_EVENT_STATE_MACRO(43)
|
||||
// Element is rtl (for :dir pseudo-class)
|
||||
#define NS_EVENT_STATE_RTL NS_DEFINE_EVENT_STATE_MACRO(44)
|
||||
|
||||
/**
|
||||
* NOTE: do not go over 63 without updating nsEventStates::InternalType!
|
||||
|
@ -50,7 +50,7 @@ nsDOMSimpleGestureEvent::GetDirection(PRUint32 *aDirection)
|
||||
|
||||
/* readonly attribute float delta; */
|
||||
NS_IMETHODIMP
|
||||
nsDOMSimpleGestureEvent::GetDelta(PRFloat64 *aDelta)
|
||||
nsDOMSimpleGestureEvent::GetDelta(double *aDelta)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aDelta);
|
||||
*aDelta = static_cast<nsSimpleGestureEvent*>(mEvent)->delta;
|
||||
@ -83,7 +83,7 @@ nsDOMSimpleGestureEvent::InitSimpleGestureEvent(const nsAString& aTypeArg,
|
||||
PRUint16 aButton,
|
||||
nsIDOMEventTarget* aRelatedTarget,
|
||||
PRUint32 aDirectionArg,
|
||||
PRFloat64 aDeltaArg,
|
||||
double aDeltaArg,
|
||||
PRUint32 aClickCountArg)
|
||||
{
|
||||
nsresult rv = nsDOMMouseEvent::InitMouseEvent(aTypeArg,
|
||||
|
@ -53,7 +53,6 @@
|
||||
|
||||
#include "nsHTMLParts.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "mozilla/dom/DirectionalityUtils.h"
|
||||
#include "nsString.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
#include "nsGkAtoms.h"
|
||||
@ -97,7 +96,6 @@
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
using namespace mozilla::directionality;
|
||||
|
||||
class nsINodeInfo;
|
||||
class nsIDOMNodeList;
|
||||
@ -1689,24 +1687,6 @@ nsGenericHTMLElement::UpdateEditableState(bool aNotify)
|
||||
nsStyledElement::UpdateEditableState(aNotify);
|
||||
}
|
||||
|
||||
nsEventStates
|
||||
nsGenericHTMLElement::IntrinsicState() const
|
||||
{
|
||||
nsEventStates state = nsGenericHTMLElementBase::IntrinsicState();
|
||||
|
||||
if (GetDirectionality() == eDir_RTL) {
|
||||
state |= NS_EVENT_STATE_RTL;
|
||||
state &= ~NS_EVENT_STATE_LTR;
|
||||
} else { // at least for HTML, directionality is exclusively LTR or RTL
|
||||
NS_ASSERTION(GetDirectionality() == eDir_LTR,
|
||||
"HTML element's directionality must be either RTL or LTR");
|
||||
state |= NS_EVENT_STATE_LTR;
|
||||
state &= ~NS_EVENT_STATE_RTL;
|
||||
}
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGenericHTMLElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
@ -1909,20 +1889,6 @@ nsGenericHTMLElement::AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
||||
else if (aNotify && aName == nsGkAtoms::spellcheck) {
|
||||
SyncEditorsOnSubtree(this);
|
||||
}
|
||||
else if (aName == nsGkAtoms::dir) {
|
||||
Directionality dir;
|
||||
if (aValue &&
|
||||
(aValue->Equals(nsGkAtoms::ltr, eIgnoreCase) ||
|
||||
aValue->Equals(nsGkAtoms::rtl, eIgnoreCase))) {
|
||||
SetHasValidDir();
|
||||
dir = aValue->Equals(nsGkAtoms::rtl, eIgnoreCase) ? eDir_RTL : eDir_LTR;
|
||||
SetDirectionality(this, dir, aNotify);
|
||||
} else {
|
||||
ClearHasValidDir();
|
||||
dir = RecomputeDirectionality(this, aNotify);
|
||||
}
|
||||
SetDirectionalityOnDescendants(this, dir, aNotify);
|
||||
}
|
||||
}
|
||||
|
||||
return nsGenericHTMLElementBase::AfterSetAttr(aNamespaceID, aName,
|
||||
|
@ -49,8 +49,6 @@ public:
|
||||
{
|
||||
NS_ASSERTION(mNodeInfo->NamespaceID() == kNameSpaceID_XHTML,
|
||||
"Unexpected namespace");
|
||||
AddStatesSilently(NS_EVENT_STATE_LTR);
|
||||
SetFlags(NODE_HAS_DIRECTION_LTR);
|
||||
}
|
||||
|
||||
/** Typesafe, non-refcounting cast from nsIContent. Cheaper than QI. **/
|
||||
@ -204,8 +202,6 @@ public:
|
||||
|
||||
virtual void UpdateEditableState(bool aNotify);
|
||||
|
||||
virtual nsEventStates IntrinsicState() const;
|
||||
|
||||
// Helper for setting our editable flag and notifying
|
||||
void DoSetEditableFlag(bool aEditable, bool aNotify) {
|
||||
SetEditableFlag(aEditable);
|
||||
|
@ -265,6 +265,7 @@ MOCHITEST_FILES = \
|
||||
test_bug745685.html \
|
||||
test_input_file_picker.html \
|
||||
test_bug763626.html \
|
||||
test_bug780993.html \
|
||||
$(NULL)
|
||||
|
||||
MOCHITEST_BROWSER_FILES = \
|
||||
|
@ -24,10 +24,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=143220
|
||||
var leafName;
|
||||
var fullPath;
|
||||
|
||||
|
||||
function initVals() {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var dirSvc = Components.classes["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Components.interfaces.nsIProperties);
|
||||
var dirSvc = SpecialPowers.wrap(Components)
|
||||
.classes["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Components.interfaces.nsIProperties);
|
||||
var file = dirSvc.get("XpcomLib", Components.interfaces.nsILocalFile);
|
||||
isnot(file, null, "Must have file here");
|
||||
|
||||
@ -36,15 +37,13 @@ function initVals() {
|
||||
}
|
||||
|
||||
function initControl1() {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
$("i1").value = fullPath;
|
||||
is($("i1").value, fullPath, "Should have set full path 1");
|
||||
SpecialPowers.wrap($("i1")).value = fullPath;
|
||||
is(SpecialPowers.wrap($("i1")).value, fullPath, "Should have set full path 1");
|
||||
}
|
||||
|
||||
function initControl2() {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
$("i2").value = fullPath;
|
||||
is($("i2").value, fullPath, "Should have set full path 2");
|
||||
SpecialPowers.wrap($("i2")).value = fullPath;
|
||||
is(SpecialPowers.wrap($("i2")).value, fullPath, "Should have set full path 2");
|
||||
}
|
||||
|
||||
initVals();
|
||||
|
@ -32,26 +32,25 @@ var input2Files =
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function setFileInputs () {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
f = createFileWithData(input1File.name, input1File.body);
|
||||
singleFileInput.mozSetFileNameArray([f.path], 1);
|
||||
SpecialPowers.wrap(singleFileInput).mozSetFileNameArray([f.path], 1);
|
||||
|
||||
var input2FileNames = [];
|
||||
for each (file in input2Files) {
|
||||
f = createFileWithData(file.name, file.body);
|
||||
input2FileNames.push(f.path);
|
||||
}
|
||||
multiFileInput.mozSetFileNameArray(input2FileNames, input2FileNames.length);
|
||||
SpecialPowers.wrap(multiFileInput).mozSetFileNameArray(input2FileNames, input2FileNames.length);
|
||||
}
|
||||
|
||||
function createFileWithData(fileName, fileData) {
|
||||
var dirSvc = Components.classes["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Components.interfaces.nsIProperties);
|
||||
var dirSvc = SpecialPowers.wrap(Components).classes["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Components.interfaces.nsIProperties);
|
||||
var testFile = dirSvc.get("ProfD", Components.interfaces.nsIFile);
|
||||
testFile.append(fileName);
|
||||
var outStream = Components.
|
||||
classes["@mozilla.org/network/file-output-stream;1"].
|
||||
createInstance(Components.interfaces.nsIFileOutputStream);
|
||||
var outStream = SpecialPowers.wrap(Components).
|
||||
classes["@mozilla.org/network/file-output-stream;1"].
|
||||
createInstance(Components.interfaces.nsIFileOutputStream);
|
||||
outStream.init(testFile, 0x02 | 0x08 | 0x20, // write, create, truncate
|
||||
0666, 0);
|
||||
outStream.write(fileData, fileData.length);
|
||||
|
39
content/html/content/test/test_bug780993.html
Normal file
39
content/html/content/test/test_bug780993.html
Normal file
@ -0,0 +1,39 @@
|
||||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>Test for bug 780993</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
test(function() {
|
||||
var select = document.createElement("select");
|
||||
var option = document.createElement("option");
|
||||
select.appendChild(option);
|
||||
assert_equals(select[0], option);
|
||||
select[0] = null;
|
||||
assert_equals(option.parentNode, null);
|
||||
assert_equals(select[0], null);
|
||||
}, "Should be able to set select[n] to null.");
|
||||
test(function() {
|
||||
var select = document.createElement("select");
|
||||
var option = document.createElement("option");
|
||||
var option2 = document.createElement("option");
|
||||
select.appendChild(option);
|
||||
assert_equals(select[0], option);
|
||||
select[0] = option2;
|
||||
assert_equals(option.parentNode, null);
|
||||
assert_equals(option2.parentNode, select);
|
||||
assert_equals(select[0], option2);
|
||||
}, "Should be able to set select[n] to an option element");
|
||||
test(function() {
|
||||
var select = document.createElement("select");
|
||||
var option = document.createElement("option");
|
||||
select.appendChild(option);
|
||||
assert_equals(select[0], option);
|
||||
assert_throws(null, function() {
|
||||
select[0] = 42;
|
||||
});
|
||||
assert_equals(option.parentNode, select);
|
||||
assert_equals(select[0], option);
|
||||
}, "Should not be able to set select[n] to a primitive.");
|
||||
</script>
|
@ -92,7 +92,9 @@ public:
|
||||
|
||||
// imgIDecoderObserver (override nsStubImageDecoderObserver)
|
||||
NS_IMETHOD OnStartContainer(imgIRequest* aRequest, imgIContainer* aImage);
|
||||
NS_IMETHOD OnStopContainer(imgIRequest* aRequest, imgIContainer* aImage);
|
||||
NS_IMETHOD OnStopDecode(imgIRequest *aRequest, nsresult aStatus, const PRUnichar *aStatusArg);
|
||||
NS_IMETHOD OnDiscard(imgIRequest *aRequest);
|
||||
|
||||
// nsIDOMEventListener
|
||||
NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent);
|
||||
@ -519,6 +521,20 @@ ImageDocument::OnStartContainer(imgIRequest* aRequest, imgIContainer* aImage)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ImageDocument::OnStopContainer(imgIRequest* aRequest, imgIContainer* aImage)
|
||||
{
|
||||
if (mImageContent) {
|
||||
// Update the background-color of the image only after the
|
||||
// image has been decoded to prevent flashes of just the
|
||||
// background-color.
|
||||
mImageContent->SetAttr(kNameSpaceID_None, nsGkAtoms::_class,
|
||||
NS_LITERAL_STRING("decoded"), true);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ImageDocument::OnStopDecode(imgIRequest *aRequest,
|
||||
nsresult aStatus,
|
||||
@ -526,12 +542,6 @@ ImageDocument::OnStopDecode(imgIRequest *aRequest,
|
||||
{
|
||||
UpdateTitleAndCharset();
|
||||
|
||||
nsCOMPtr<nsIImageLoadingContent> imageLoader = do_QueryInterface(mImageContent);
|
||||
if (imageLoader) {
|
||||
mObservingImageLoader = false;
|
||||
imageLoader->RemoveObserver(this);
|
||||
}
|
||||
|
||||
// mImageContent can be null if the document is already destroyed
|
||||
if (NS_FAILED(aStatus) && mStringBundle && mImageContent) {
|
||||
nsCAutoString src;
|
||||
@ -549,6 +559,18 @@ ImageDocument::OnStopDecode(imgIRequest *aRequest,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ImageDocument::OnDiscard(imgIRequest *aRequest)
|
||||
{
|
||||
// mImageContent can be null if the document is already destroyed
|
||||
if (mImageContent) {
|
||||
// Remove any decoded-related styling when the image is unloaded.
|
||||
mImageContent->UnsetAttr(kNameSpaceID_None, nsGkAtoms::_class,
|
||||
true);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ImageDocument::HandleEvent(nsIDOMEvent* aEvent)
|
||||
{
|
||||
|
@ -55,9 +55,7 @@ function checkURI(uri, name, type) {
|
||||
|
||||
function checkFrame(num) {
|
||||
// Just snarf our data
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
|
||||
var outer = window.frames[num]
|
||||
var outer = SpecialPowers.wrap(window.frames[num]);
|
||||
name = outer.name;
|
||||
|
||||
is(outer.document.baseURI,
|
||||
|
@ -24,21 +24,19 @@ var frame = document.getElementById("i");
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addLoadEvent(function() {
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
var viewer =
|
||||
frame.contentWindow
|
||||
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||
.getInterface(Components.interfaces.nsIWebNavigation)
|
||||
.QueryInterface(Components.interfaces.nsIDocShell)
|
||||
.contentViewer
|
||||
.QueryInterface(Components.interfaces.nsIMarkupDocumentViewer);
|
||||
SpecialPowers.wrap(frame.contentWindow
|
||||
.QueryInterface(Components.interfaces.nsIInterfaceRequestor))
|
||||
.getInterface(Components.interfaces.nsIWebNavigation)
|
||||
.QueryInterface(Components.interfaces.nsIDocShell)
|
||||
.contentViewer
|
||||
.QueryInterface(Components.interfaces.nsIMarkupDocumentViewer);
|
||||
|
||||
viewer.fullZoom = 1.5;
|
||||
|
||||
setTimeout(function() {
|
||||
synthesizeMouse(frame, 30, 30, {});
|
||||
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
is(viewer.fullZoom, 1.5, "Zoom in the image frame should not have been reset");
|
||||
|
||||
SimpleTest.finish();
|
||||
|
@ -16,8 +16,8 @@ class nsMediaPluginReader : public nsBuiltinDecoderReader
|
||||
{
|
||||
nsCString mType;
|
||||
MPAPI::Decoder *mPlugin;
|
||||
PRBool mHasAudio;
|
||||
PRBool mHasVideo;
|
||||
bool mHasAudio;
|
||||
bool mHasVideo;
|
||||
nsIntRect mPicture;
|
||||
nsIntSize mInitialFrame;
|
||||
int64_t mVideoSeekTimeUs;
|
||||
|
@ -159,10 +159,9 @@ function fileUriToSrc(path, mustExist) {
|
||||
if (navigator.appVersion.indexOf("Android") != -1)
|
||||
return path;
|
||||
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
const Ci = Components.interfaces;
|
||||
const Cc = Components.classes;
|
||||
const Cr = Components.results;
|
||||
const Cc = SpecialPowers.wrap(Components).classes;
|
||||
const Cr = SpecialPowers.wrap(Components).results;
|
||||
var dirSvc = Cc["@mozilla.org/file/directory_service;1"].
|
||||
getService(Ci.nsIProperties);
|
||||
var f = dirSvc.get("CurWorkD", Ci.nsILocalFile);
|
||||
@ -444,8 +443,7 @@ function MediaTestManager() {
|
||||
// Force a GC after every completed testcase. This ensures that any decoders
|
||||
// with live threads waiting for the GC are killed promptly, to free up the
|
||||
// thread stacks' address space.
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
Components.utils.forceGC();
|
||||
SpecialPowers.forceGC();
|
||||
|
||||
while (this.testNum < this.tests.length && this.tokens.length < PARALLEL_TESTS) {
|
||||
var test = this.tests[this.testNum];
|
||||
@ -497,15 +495,14 @@ function mediaTestCleanup() {
|
||||
A[i].parentNode.removeChild(A[i]);
|
||||
A[i] = null;
|
||||
}
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
Components.utils.forceGC();
|
||||
SpecialPowers.forceGC();
|
||||
}
|
||||
|
||||
(function() {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
// Ensure that preload preferences are comsistent
|
||||
var prefService = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefService);
|
||||
var prefService = SpecialPowers.wrap(Components)
|
||||
.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefService);
|
||||
var branch = prefService.getBranch("media.");
|
||||
var oldDefault = 2;
|
||||
var oldAuto = 3;
|
||||
@ -522,7 +519,6 @@ function mediaTestCleanup() {
|
||||
branch.setBoolPref("opus.enabled", true);
|
||||
|
||||
window.addEventListener("unload", function() {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
branch.setIntPref("preload.default", oldDefault);
|
||||
branch.setIntPref("preload.auto", oldAuto);
|
||||
if (oldOpus !== undefined)
|
||||
|
@ -156,7 +156,7 @@ void txDouble::toString(double aValue, nsAString& aDest)
|
||||
const int buflen = 20;
|
||||
char buf[buflen];
|
||||
|
||||
PRIntn intDigits, sign;
|
||||
int intDigits, sign;
|
||||
char* endp;
|
||||
PR_dtoa(aValue, 0, 0, &intDigits, &sign, &endp, buf, buflen - 1);
|
||||
|
||||
|
@ -572,7 +572,7 @@ txXPathNodeUtils::getBaseURI(const txXPathNode& aNode, nsAString& aURI)
|
||||
}
|
||||
|
||||
/* static */
|
||||
PRIntn
|
||||
int
|
||||
txXPathNodeUtils::comparePosition(const txXPathNode& aNode,
|
||||
const txXPathNode& aOtherNode)
|
||||
{
|
||||
|
@ -567,7 +567,7 @@ txNodeSet::findPosition(const txXPathNode& aNode, txXPathNode* aFirst,
|
||||
// If we search 2 nodes or less there is no point in further divides
|
||||
txXPathNode* pos = aFirst;
|
||||
for (; pos < aLast; ++pos) {
|
||||
PRIntn cmp = txXPathNodeUtils::comparePosition(aNode, *pos);
|
||||
int cmp = txXPathNodeUtils::comparePosition(aNode, *pos);
|
||||
if (cmp < 0) {
|
||||
return pos;
|
||||
}
|
||||
@ -583,7 +583,7 @@ txNodeSet::findPosition(const txXPathNode& aNode, txXPathNode* aFirst,
|
||||
|
||||
// (cannot add two pointers)
|
||||
txXPathNode* midpos = aFirst + (aLast - aFirst) / 2;
|
||||
PRIntn cmp = txXPathNodeUtils::comparePosition(aNode, *midpos);
|
||||
int cmp = txXPathNodeUtils::comparePosition(aNode, *midpos);
|
||||
if (cmp == 0) {
|
||||
aDupe = true;
|
||||
|
||||
|
@ -94,8 +94,8 @@ public:
|
||||
const txXPathNode& aBase, nsAString& aResult);
|
||||
static void release(txXPathNode* aNode);
|
||||
static void getBaseURI(const txXPathNode& aNode, nsAString& aURI);
|
||||
static PRIntn comparePosition(const txXPathNode& aNode,
|
||||
const txXPathNode& aOtherNode);
|
||||
static int comparePosition(const txXPathNode& aNode,
|
||||
const txXPathNode& aOtherNode);
|
||||
static bool localNameEquals(const txXPathNode& aNode,
|
||||
nsIAtom* aLocalName);
|
||||
static bool isRoot(const txXPathNode& aNode);
|
||||
|
@ -277,7 +277,7 @@ txFormatNumberFunctionCall::evaluate(txIEvalContext* aContext,
|
||||
char* buf = new char[bufsize];
|
||||
NS_ENSURE_TRUE(buf, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
PRIntn bufIntDigits, sign;
|
||||
int bufIntDigits, sign;
|
||||
char* endp;
|
||||
PR_dtoa(value, 0, 0, &bufIntDigits, &sign, &endp, buf, bufsize-1);
|
||||
|
||||
|
@ -205,7 +205,7 @@ Instantiation::Hash(const void* aKey)
|
||||
}
|
||||
|
||||
|
||||
PRIntn
|
||||
int
|
||||
Instantiation::Compare(const void* aLeft, const void* aRight)
|
||||
{
|
||||
const Instantiation* left = static_cast<const Instantiation*>(aLeft);
|
||||
|
@ -466,7 +466,7 @@ public:
|
||||
return !Equals(aInstantiation); }
|
||||
|
||||
static PLHashNumber Hash(const void* aKey);
|
||||
static PRIntn Compare(const void* aLeft, const void* aRight);
|
||||
static int Compare(const void* aLeft, const void* aRight);
|
||||
};
|
||||
|
||||
|
||||
|
@ -335,7 +335,7 @@ nsXULTemplateQueryProcessorStorage::CompileQuery(nsIXULTemplateBuilder* aBuilder
|
||||
rv = NS_ERROR_ILLEGAL_VALUE;
|
||||
PRInt32 valInt32 = 0;
|
||||
PRInt64 valInt64 = 0;
|
||||
PRFloat64 valFloat = 0;
|
||||
double valFloat = 0;
|
||||
|
||||
switch (typeValue) {
|
||||
case 0:
|
||||
|
@ -6055,17 +6055,19 @@ nsDocShell::OnStateChange(nsIWebProgress * aProgress, nsIRequest * aRequest,
|
||||
channel->GetURI(getter_AddRefs(uri));
|
||||
nsCAutoString aURI;
|
||||
uri->GetAsciiSpec(aURI);
|
||||
if (this == aProgress){
|
||||
|
||||
nsCOMPtr<nsIWyciwygChannel> wcwgChannel(do_QueryInterface(aRequest));
|
||||
nsCOMPtr<nsIWebProgress> webProgress =
|
||||
do_QueryInterface(GetAsSupports(this));
|
||||
|
||||
// We don't update navigation timing for wyciwyg channels
|
||||
if (this == aProgress && !wcwgChannel){
|
||||
rv = MaybeInitTiming();
|
||||
if (mTiming) {
|
||||
mTiming->NotifyFetchStart(uri, ConvertLoadTypeToNavigationType(mLoadType));
|
||||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIWyciwygChannel> wcwgChannel(do_QueryInterface(aRequest));
|
||||
nsCOMPtr<nsIWebProgress> webProgress =
|
||||
do_QueryInterface(GetAsSupports(this));
|
||||
|
||||
// Was the wyciwyg document loaded on this docshell?
|
||||
if (wcwgChannel && !mLSHE && (mItemType == typeContent) && aProgress == webProgress.get()) {
|
||||
bool equalUri = true;
|
||||
|
@ -95,6 +95,8 @@ MOCHITEST_FILES = \
|
||||
test_bug691547.html \
|
||||
bug691547_frame.html \
|
||||
test_bug694612.html \
|
||||
test_bug703855.html \
|
||||
file_bug703855.html \
|
||||
test_bug713825.html \
|
||||
test_bug728939.html \
|
||||
file_bug728939.html \
|
||||
|
2
docshell/test/file_bug703855.html
Normal file
2
docshell/test/file_bug703855.html
Normal file
@ -0,0 +1,2 @@
|
||||
<!DOCTYPE html>
|
||||
<!-- Just need an empty file here, as long as it's served over HTTP -->
|
@ -98,17 +98,18 @@ function isInaccessible(wnd, message) {
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function xpcEnumerateContentWindows(callback) {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
|
||||
var Ci = Components.interfaces;
|
||||
var ww = Components.classes["@mozilla.org/embedcomp/window-watcher;1"]
|
||||
.getService(Ci.nsIWindowWatcher);
|
||||
var ww = SpecialPowers.wrap(Components)
|
||||
.classes["@mozilla.org/embedcomp/window-watcher;1"]
|
||||
.getService(Ci.nsIWindowWatcher);
|
||||
var enumerator = ww.getWindowEnumerator();
|
||||
|
||||
var contentWindows = [];
|
||||
|
||||
while (enumerator.hasMoreElements()) {
|
||||
var win = enumerator.getNext();
|
||||
if (typeof ChromeWindow != "undefined" && win instanceof ChromeWindow) {
|
||||
if (typeof ChromeWindow != "undefined" && SpecialPowers.call_Instanceof(win, ChromeWindow)) {
|
||||
var docshellTreeNode = win.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebNavigation)
|
||||
.QueryInterface(Ci.nsIDocShellTreeNode);
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
function testDone() {
|
||||
document.body.removeChild(document.body.firstChild);
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var isOK = false;
|
||||
try {
|
||||
isOK = history.previous != location;
|
||||
|
@ -60,7 +60,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=386782
|
||||
}
|
||||
|
||||
function beginTest() {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
gTest.window.document.body.focus();
|
||||
|
||||
// WARNING: If the following test fails, give the setTimeout() in the onload()
|
||||
@ -74,7 +73,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=386782
|
||||
}
|
||||
|
||||
function goBack() {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
gTest.window.history.back();
|
||||
setTimeout(function() {
|
||||
SimpleTest.waitForFocus(checkStillEditable, gTest.window);
|
||||
@ -82,7 +80,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=386782
|
||||
}
|
||||
|
||||
function checkStillEditable() {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
|
||||
// Check that the contents are correct.
|
||||
is(gTest.window.document.body.innerHTML, gTest.expectedBodyAfterEdit, "Edited contents still correct?");
|
||||
|
@ -186,9 +186,9 @@ var gNextTest = 0;
|
||||
|
||||
function runNextTest()
|
||||
{
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var prefs = Components.classes["@mozilla.org/preferences-service;1"].
|
||||
getService(Components.interfaces.nsIPrefBranch);
|
||||
var prefs = SpecialPowers.wrap(Components)
|
||||
.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
|
||||
if (gNextTest < gTests.length) {
|
||||
gCurrentTest = gTests[gNextTest++];
|
||||
@ -214,9 +214,9 @@ function runNextTest()
|
||||
|
||||
function finishTest()
|
||||
{
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var prefs = Components.classes["@mozilla.org/preferences-service;1"].
|
||||
getService(Components.interfaces.nsIPrefBranch);
|
||||
var prefs = SpecialPowers.wrap(Components)
|
||||
.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
prefs.setBoolPref("network.jar.open-unsafe-types", false);
|
||||
|
||||
if (gNumPokes == 0) {
|
||||
@ -228,9 +228,9 @@ function finishTest()
|
||||
|
||||
function startTests()
|
||||
{
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var prefs = Components.classes["@mozilla.org/preferences-service;1"].
|
||||
getService(Components.interfaces.nsIPrefBranch);
|
||||
var prefs = SpecialPowers.wrap(Components)
|
||||
.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
gPrefValue = prefs.getBoolPref("network.jar.open-unsafe-types");
|
||||
}
|
||||
|
||||
|
@ -41,8 +41,6 @@ function onChildLoad(e) {
|
||||
}
|
||||
|
||||
function runTest() {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
|
||||
var popup = window.open("file_bug509055.html", "popup 0",
|
||||
"height=200,width=200,location=yes," +
|
||||
"menubar=yes,status=yes,toolbar=yes,dependent=yes");
|
||||
@ -72,9 +70,10 @@ function runTest() {
|
||||
dump('Got second hashchange. Spinning event loop.\n');
|
||||
yield;
|
||||
|
||||
var sh = popup.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||
.getInterface(Components.interfaces.nsIWebNavigation)
|
||||
.sessionHistory;
|
||||
var sh = SpecialPowers.wrap(popup)
|
||||
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||
.getInterface(Components.interfaces.nsIWebNavigation)
|
||||
.sessionHistory;
|
||||
|
||||
// Get the title of the inner popup's current SHEntry
|
||||
var sheTitle = sh.getEntryAtIndex(sh.index, false).title;
|
||||
|
@ -43,7 +43,6 @@ function pollForPage(f, w)
|
||||
|
||||
function windowLoaded()
|
||||
{
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
switch (phase)
|
||||
{
|
||||
case 0:
|
||||
@ -57,18 +56,16 @@ function windowLoaded()
|
||||
pollForPage(function(succeeded) {
|
||||
ok(succeeded, "Waiting for error page succeeded");
|
||||
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
/* 3. now, while we are on the error page, try to reload it, actually
|
||||
click the "Try Again" button */
|
||||
w.location.reload();
|
||||
SpecialPowers.wrap(w).location.reload();
|
||||
|
||||
pollForPage(function(succeeded) {
|
||||
ok(succeeded, "Waiting for error page succeeded");
|
||||
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
/* 4-finish, check we are still on the error page */
|
||||
is(w.location.href, faultyURL, "Is on an error page");
|
||||
isnot(w.location.href, workingURL, "Is not on the previous page");
|
||||
is(SpecialPowers.wrap(w).location.href, faultyURL, "Is on an error page");
|
||||
isnot(SpecialPowers.wrap(w).location.href, workingURL, "Is not on the previous page");
|
||||
is(gotWrongPageOnTryAgainClick, false,
|
||||
"Must not get www.example.com page on reload of an error page");
|
||||
w.close();
|
||||
|
@ -42,8 +42,6 @@ function pollForPage(expectErrorPage, f, w)
|
||||
|
||||
function windowLoaded()
|
||||
{
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
|
||||
/* 2. We have successfully loaded a page, now go to a faulty URL */
|
||||
// XXX The test fails when we change the location synchronously
|
||||
window.setTimeout(function() {
|
||||
@ -52,11 +50,9 @@ function windowLoaded()
|
||||
|
||||
pollForPage(true, function(succeeded) {
|
||||
ok(succeeded, "Waiting for error page succeeded");
|
||||
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
/* 3. now, while we are on the error page, navigate back */
|
||||
try {
|
||||
w.back();
|
||||
SpecialPowers.wrap(w).back();
|
||||
}
|
||||
catch(ex) {
|
||||
ok(false, "w.back() threw " + ex);
|
||||
@ -64,11 +60,9 @@ function windowLoaded()
|
||||
|
||||
pollForPage(false, function(succeeded) {
|
||||
ok(succeeded, "Waiting for original page succeeded");
|
||||
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
/* 4-finish, check we are back at the original page */
|
||||
isnot(w.location.href, faultyURL, "Is on an error page");
|
||||
is(w.location.href, workingURL, "Is not on the previous page");
|
||||
isnot(SpecialPowers.wrap(w).location.href, faultyURL, "Is on an error page");
|
||||
is(SpecialPowers.wrap(w).location.href, workingURL, "Is not on the previous page");
|
||||
w.close();
|
||||
SimpleTest.finish();
|
||||
}, w);
|
||||
|
79
docshell/test/test_bug703855.html
Normal file
79
docshell/test/test_bug703855.html
Normal file
@ -0,0 +1,79 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=703855
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 703855</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=703855">Mozilla Bug 703855</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
<iframe id="f" src="file_bug703855.html"></iframe>
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 703855 **/
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var timingAttributes = [
|
||||
'connectEnd',
|
||||
'connectStart',
|
||||
'domComplete',
|
||||
'domContentLoadedEventEnd',
|
||||
'domContentLoadedEventStart',
|
||||
'domInteractive',
|
||||
'domLoading',
|
||||
'domainLookupEnd',
|
||||
'domainLookupStart',
|
||||
'fetchStart',
|
||||
'loadEventEnd',
|
||||
'loadEventStart',
|
||||
'navigationStart',
|
||||
'redirectEnd',
|
||||
'redirectStart',
|
||||
'requestStart',
|
||||
'responseEnd',
|
||||
'responseStart',
|
||||
'unloadEventEnd',
|
||||
'unloadEventStart'
|
||||
];
|
||||
var originalTiming = {};
|
||||
|
||||
function runTest() {
|
||||
var timing = $("f").contentWindow.performance.timing;
|
||||
for (i in timingAttributes) {
|
||||
originalTiming[timingAttributes[i]] = timing[timingAttributes[i]];
|
||||
}
|
||||
|
||||
var doc = $("f").contentDocument;
|
||||
doc.open();
|
||||
doc.write("<!DOCTYPE html>");
|
||||
doc.close();
|
||||
|
||||
SimpleTest.executeSoon(function() {
|
||||
var newTiming = $("f").contentWindow.performance.timing;
|
||||
for (var i in timingAttributes) {
|
||||
is(timing[timingAttributes[i]], originalTiming[timingAttributes[i]],
|
||||
"document.open should not affect value of " + timingAttributes[i]);
|
||||
}
|
||||
SimpleTest.finish();
|
||||
});
|
||||
}
|
||||
|
||||
addLoadEvent(function() {
|
||||
SimpleTest.executeSoon(runTest);
|
||||
});
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -53,6 +53,26 @@ AppsService.prototype = {
|
||||
}
|
||||
},
|
||||
|
||||
getAppByLocalId: function getAppByLocalId(aLocalId) {
|
||||
debug("getAppByLocalId( " + aLocalId + " )");
|
||||
if (this.inParent) {
|
||||
return DOMApplicationRegistry.getAppByLocalId(aLocalId);
|
||||
} else {
|
||||
return this.cpmm.sendSyncMessage("WebApps:GetAppByLocalId",
|
||||
{ id: aLocalId })[0];
|
||||
}
|
||||
},
|
||||
|
||||
getManifestURLByLocalId: function getManifestURLByLocalId(aLocalId) {
|
||||
debug("getManifestURLByLocalId( " + aLocalId + " )");
|
||||
if (this.inParent) {
|
||||
return DOMApplicationRegistry.getManifestURLByLocalId(aLocalId);
|
||||
} else {
|
||||
return this.cpmm.sendSyncMessage("WebApps:GetManifestURLByLocalId",
|
||||
{ id: aLocalId })[0];
|
||||
}
|
||||
},
|
||||
|
||||
classID : APPS_SERVICE_CID,
|
||||
QueryInterface : XPCOMUtils.generateQI([Ci.nsIAppsService])
|
||||
}
|
||||
|
@ -57,7 +57,8 @@ let DOMApplicationRegistry = {
|
||||
"Webapps:GetInstalled", "Webapps:GetNotInstalled",
|
||||
"Webapps:Launch", "Webapps:GetAll",
|
||||
"Webapps:InstallPackage", "Webapps:GetBasePath",
|
||||
"WebApps:GetAppByManifestURL", "WebApps:GetAppLocalIdByManifestURL"];
|
||||
"WebApps:GetAppByManifestURL", "WebApps:GetAppLocalIdByManifestURL",
|
||||
"WebApps:GetAppByLocalId", "Webapps:GetManifestURLByLocalId"];
|
||||
|
||||
this.messages.forEach((function(msgName) {
|
||||
ppmm.addMessageListener(msgName, this);
|
||||
@ -220,6 +221,7 @@ let DOMApplicationRegistry = {
|
||||
this.getSelf(msg);
|
||||
break;
|
||||
case "Webapps:Uninstall":
|
||||
Services.obs.notifyObservers(this, "webapps-uninstall", JSON.stringify(msg));
|
||||
this.uninstall(msg);
|
||||
break;
|
||||
case "Webapps:Launch":
|
||||
@ -249,6 +251,12 @@ let DOMApplicationRegistry = {
|
||||
case "WebApps:GetAppLocalIdByManifestURL":
|
||||
return { id: this.getAppLocalIdByManifestURL(msg.url) };
|
||||
break;
|
||||
case "WebApps:GetAppByLocalId":
|
||||
return this.getAppByLocalId(msg.id);
|
||||
break;
|
||||
case "WebApps:GetManifestURLByLocalId":
|
||||
return this.getManifestURLByLocalId(msg.id);
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
@ -691,6 +699,35 @@ let DOMApplicationRegistry = {
|
||||
for (let id in this.webapps) {
|
||||
let app = this.webapps[id];
|
||||
if (app.manifestURL == aManifestURL) {
|
||||
let res = this._cloneAppObject(app);
|
||||
res.hasPermission = function(permission) {
|
||||
let localId = DOMApplicationRegistry.getAppLocalIdByManifestURL(
|
||||
this.manifestURL);
|
||||
let uri = Services.io.newURI(this.manifestURL, null, null);
|
||||
let secMan = Cc["@mozilla.org/scriptsecuritymanager;1"]
|
||||
.getService(Ci.nsIScriptSecurityManager);
|
||||
// XXX for the purposes of permissions checking, this helper
|
||||
// should always be called on !isBrowser frames, so we
|
||||
// assume false here.
|
||||
let principal = secMan.getAppCodebasePrincipal(uri, localId,
|
||||
/*mozbrowser*/false);
|
||||
let perm = Services.perms.testExactPermissionFromPrincipal(principal,
|
||||
permission);
|
||||
return (perm === Ci.nsIPermissionManager.ALLOW_ACTION);
|
||||
};
|
||||
res.QueryInterface = XPCOMUtils.generateQI([Ci.mozIDOMApplication,
|
||||
Ci.mozIApplication]);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
},
|
||||
|
||||
getAppByLocalId: function(aLocalId) {
|
||||
for (let id in this.webapps) {
|
||||
let app = this.webapps[id];
|
||||
if (app.localId == aLocalId) {
|
||||
return this._cloneAppObject(app);
|
||||
}
|
||||
}
|
||||
@ -698,6 +735,17 @@ let DOMApplicationRegistry = {
|
||||
return null;
|
||||
},
|
||||
|
||||
getManifestURLByLocalId: function(aLocalId) {
|
||||
for (let id in this.webapps) {
|
||||
let app = this.webapps[id];
|
||||
if (app.localId == aLocalId) {
|
||||
return app.manifestURL;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
},
|
||||
|
||||
getAppLocalIdByManifestURL: function(aManifestURL) {
|
||||
for (let id in this.webapps) {
|
||||
if (this.webapps[id].manifestURL == aManifestURL) {
|
||||
@ -928,6 +976,10 @@ DOMApplicationManifest.prototype = {
|
||||
return this._localeProp("appcache_path");
|
||||
},
|
||||
|
||||
get orientation() {
|
||||
return this._localeProp("orientation");
|
||||
},
|
||||
|
||||
iconURLForSize: function(aSize) {
|
||||
let icons = this._localeProp("icons");
|
||||
if (!icons)
|
||||
|
@ -7,10 +7,11 @@
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIDOMElement.h"
|
||||
|
||||
#include "nsIPrincipal.h"
|
||||
#include "mozilla/unused.h"
|
||||
|
||||
using mozilla::unused; // <snicker>
|
||||
using namespace mozilla::dom;
|
||||
|
||||
nsContentPermissionRequestProxy::nsContentPermissionRequestProxy()
|
||||
{
|
||||
@ -24,7 +25,7 @@ nsContentPermissionRequestProxy::~nsContentPermissionRequestProxy()
|
||||
|
||||
nsresult
|
||||
nsContentPermissionRequestProxy::Init(const nsACString & type,
|
||||
mozilla::dom::ContentPermissionRequestParent* parent)
|
||||
ContentPermissionRequestParent* parent)
|
||||
{
|
||||
NS_ASSERTION(parent, "null parent");
|
||||
mParent = parent;
|
||||
@ -63,13 +64,14 @@ nsContentPermissionRequestProxy::GetWindow(nsIDOMWindow * *aRequestingWindow)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsContentPermissionRequestProxy::GetUri(nsIURI * *aRequestingURI)
|
||||
nsContentPermissionRequestProxy::GetPrincipal(nsIPrincipal * *aRequestingPrincipal)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aRequestingURI);
|
||||
if (mParent == nullptr)
|
||||
NS_ENSURE_ARG_POINTER(aRequestingPrincipal);
|
||||
if (mParent == nullptr) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_ADDREF(*aRequestingURI = mParent->mURI);
|
||||
NS_ADDREF(*aRequestingPrincipal = mParent->mPrincipal);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -77,8 +79,10 @@ NS_IMETHODIMP
|
||||
nsContentPermissionRequestProxy::GetElement(nsIDOMElement * *aRequestingElement)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aRequestingElement);
|
||||
if (mParent == nullptr)
|
||||
if (mParent == nullptr) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_ADDREF(*aRequestingElement = mParent->mElement);
|
||||
return NS_OK;
|
||||
}
|
||||
@ -86,9 +90,11 @@ nsContentPermissionRequestProxy::GetElement(nsIDOMElement * *aRequestingElement)
|
||||
NS_IMETHODIMP
|
||||
nsContentPermissionRequestProxy::Cancel()
|
||||
{
|
||||
if (mParent == nullptr)
|
||||
if (mParent == nullptr) {
|
||||
return NS_ERROR_FAILURE;
|
||||
unused << mozilla::dom::ContentPermissionRequestParent::Send__delete__(mParent, false);
|
||||
}
|
||||
|
||||
unused << ContentPermissionRequestParent::Send__delete__(mParent, false);
|
||||
mParent = nullptr;
|
||||
return NS_OK;
|
||||
}
|
||||
@ -96,9 +102,10 @@ nsContentPermissionRequestProxy::Cancel()
|
||||
NS_IMETHODIMP
|
||||
nsContentPermissionRequestProxy::Allow()
|
||||
{
|
||||
if (mParent == nullptr)
|
||||
if (mParent == nullptr) {
|
||||
return NS_ERROR_FAILURE;
|
||||
unused << mozilla::dom::ContentPermissionRequestParent::Send__delete__(mParent, true);
|
||||
}
|
||||
unused << ContentPermissionRequestParent::Send__delete__(mParent, true);
|
||||
mParent = nullptr;
|
||||
return NS_OK;
|
||||
}
|
||||
@ -108,11 +115,11 @@ namespace dom {
|
||||
|
||||
ContentPermissionRequestParent::ContentPermissionRequestParent(const nsACString& aType,
|
||||
nsIDOMElement *aElement,
|
||||
const IPC::URI& aUri)
|
||||
const IPC::Principal& aPrincipal)
|
||||
{
|
||||
MOZ_COUNT_CTOR(ContentPermissionRequestParent);
|
||||
|
||||
mURI = aUri;
|
||||
|
||||
mPrincipal = aPrincipal;
|
||||
mElement = aElement;
|
||||
mType = aType;
|
||||
}
|
||||
@ -127,8 +134,9 @@ ContentPermissionRequestParent::Recvprompt()
|
||||
{
|
||||
mProxy = new nsContentPermissionRequestProxy();
|
||||
NS_ASSERTION(mProxy, "Alloc of request proxy failed");
|
||||
if (NS_FAILED(mProxy->Init(mType, this)))
|
||||
if (NS_FAILED(mProxy->Init(mType, this))) {
|
||||
mProxy->Cancel();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "nsString.h"
|
||||
#include "nsIDOMElement.h"
|
||||
|
||||
#include "mozilla/dom/PermissionMessageUtils.h"
|
||||
#include "mozilla/dom/PContentPermissionRequestParent.h"
|
||||
|
||||
class nsContentPermissionRequestProxy;
|
||||
@ -21,19 +22,19 @@ namespace dom {
|
||||
class ContentPermissionRequestParent : public PContentPermissionRequestParent
|
||||
{
|
||||
public:
|
||||
ContentPermissionRequestParent(const nsACString& type, nsIDOMElement *element, const IPC::URI& principal);
|
||||
ContentPermissionRequestParent(const nsACString& type, nsIDOMElement *element, const IPC::Principal& principal);
|
||||
virtual ~ContentPermissionRequestParent();
|
||||
|
||||
nsCOMPtr<nsIURI> mURI;
|
||||
|
||||
nsCOMPtr<nsIPrincipal> mPrincipal;
|
||||
nsCOMPtr<nsIDOMElement> mElement;
|
||||
nsCOMPtr<nsContentPermissionRequestProxy> mProxy;
|
||||
nsCString mType;
|
||||
|
||||
private:
|
||||
private:
|
||||
virtual bool Recvprompt();
|
||||
virtual void ActorDestroy(ActorDestroyReason why);
|
||||
};
|
||||
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
@ -42,10 +43,10 @@ class nsContentPermissionRequestProxy : public nsIContentPermissionRequest
|
||||
public:
|
||||
nsContentPermissionRequestProxy();
|
||||
virtual ~nsContentPermissionRequestProxy();
|
||||
|
||||
|
||||
nsresult Init(const nsACString& type, mozilla::dom::ContentPermissionRequestParent* parent);
|
||||
void OnParentDestroyed();
|
||||
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSICONTENTPERMISSIONREQUEST
|
||||
|
||||
|
@ -1707,24 +1707,30 @@ struct nsContractIDMapData
|
||||
const char *mContractID;
|
||||
};
|
||||
|
||||
#define NS_DEFINE_CONSTRUCTOR_DATA(_class, _contract_id) \
|
||||
{ eDOMClassInfo_##_class##_id, _contract_id },
|
||||
#define NS_DEFINE_CONTRACT_CTOR(_class, _contract_id) \
|
||||
nsresult \
|
||||
_class##Ctor(nsISupports** aInstancePtrResult) \
|
||||
{ \
|
||||
nsresult rv = NS_OK; \
|
||||
nsCOMPtr<nsISupports> native = do_CreateInstance(_contract_id, &rv); \
|
||||
native.forget(aInstancePtrResult); \
|
||||
return rv; \
|
||||
}
|
||||
|
||||
static const nsContractIDMapData kConstructorMap[] =
|
||||
{
|
||||
NS_DEFINE_CONSTRUCTOR_DATA(DOMParser, NS_DOMPARSER_CONTRACTID)
|
||||
NS_DEFINE_CONSTRUCTOR_DATA(FileReader, NS_FILEREADER_CONTRACTID)
|
||||
NS_DEFINE_CONSTRUCTOR_DATA(ArchiveReader, NS_ARCHIVEREADER_CONTRACTID)
|
||||
NS_DEFINE_CONSTRUCTOR_DATA(FormData, NS_FORMDATA_CONTRACTID)
|
||||
NS_DEFINE_CONSTRUCTOR_DATA(XMLSerializer, NS_XMLSERIALIZER_CONTRACTID)
|
||||
NS_DEFINE_CONSTRUCTOR_DATA(WebSocket, NS_WEBSOCKET_CONTRACTID)
|
||||
NS_DEFINE_CONSTRUCTOR_DATA(XPathEvaluator, NS_XPATH_EVALUATOR_CONTRACTID)
|
||||
NS_DEFINE_CONSTRUCTOR_DATA(XSLTProcessor,
|
||||
"@mozilla.org/document-transformer;1?type=xslt")
|
||||
NS_DEFINE_CONSTRUCTOR_DATA(EventSource, NS_EVENTSOURCE_CONTRACTID)
|
||||
NS_DEFINE_CONSTRUCTOR_DATA(MutationObserver, NS_DOMMUTATIONOBSERVER_CONTRACTID)
|
||||
NS_DEFINE_CONSTRUCTOR_DATA(MozActivity, NS_DOMACTIVITY_CONTRACTID)
|
||||
};
|
||||
NS_DEFINE_CONTRACT_CTOR(DOMParser, NS_DOMPARSER_CONTRACTID)
|
||||
NS_DEFINE_CONTRACT_CTOR(FileReader, NS_FILEREADER_CONTRACTID)
|
||||
NS_DEFINE_CONTRACT_CTOR(ArchiveReader, NS_ARCHIVEREADER_CONTRACTID)
|
||||
NS_DEFINE_CONTRACT_CTOR(FormData, NS_FORMDATA_CONTRACTID)
|
||||
NS_DEFINE_CONTRACT_CTOR(XMLSerializer, NS_XMLSERIALIZER_CONTRACTID)
|
||||
NS_DEFINE_CONTRACT_CTOR(WebSocket, NS_WEBSOCKET_CONTRACTID)
|
||||
NS_DEFINE_CONTRACT_CTOR(XPathEvaluator, NS_XPATH_EVALUATOR_CONTRACTID)
|
||||
NS_DEFINE_CONTRACT_CTOR(XSLTProcessor,
|
||||
"@mozilla.org/document-transformer;1?type=xslt")
|
||||
NS_DEFINE_CONTRACT_CTOR(EventSource, NS_EVENTSOURCE_CONTRACTID)
|
||||
NS_DEFINE_CONTRACT_CTOR(MutationObserver, NS_DOMMUTATIONOBSERVER_CONTRACTID)
|
||||
NS_DEFINE_CONTRACT_CTOR(MozActivity, NS_DOMACTIVITY_CONTRACTID)
|
||||
|
||||
#undef NS_DEFINE_CONTRACT_CTOR
|
||||
|
||||
#define NS_DEFINE_EVENT_CTOR(_class) \
|
||||
nsresult \
|
||||
@ -1787,6 +1793,17 @@ static const nsConstructorFuncMapData kConstructorFuncMap[] =
|
||||
#include "GeneratedEvents.h"
|
||||
NS_DEFINE_CONSTRUCTOR_FUNC_DATA(MozSmsFilter, sms::SmsFilter::NewSmsFilter)
|
||||
NS_DEFINE_CONSTRUCTOR_FUNC_DATA(XMLHttpRequest, NS_XMLHttpRequestCtor)
|
||||
NS_DEFINE_CONSTRUCTOR_FUNC_DATA(DOMParser, DOMParserCtor)
|
||||
NS_DEFINE_CONSTRUCTOR_FUNC_DATA(FileReader, FileReaderCtor)
|
||||
NS_DEFINE_CONSTRUCTOR_FUNC_DATA(ArchiveReader, ArchiveReaderCtor)
|
||||
NS_DEFINE_CONSTRUCTOR_FUNC_DATA(FormData, FormDataCtor)
|
||||
NS_DEFINE_CONSTRUCTOR_FUNC_DATA(XMLSerializer, XMLSerializerCtor)
|
||||
NS_DEFINE_CONSTRUCTOR_FUNC_DATA(WebSocket, WebSocketCtor)
|
||||
NS_DEFINE_CONSTRUCTOR_FUNC_DATA(XPathEvaluator, XPathEvaluatorCtor)
|
||||
NS_DEFINE_CONSTRUCTOR_FUNC_DATA(XSLTProcessor, XSLTProcessorCtor)
|
||||
NS_DEFINE_CONSTRUCTOR_FUNC_DATA(EventSource, EventSourceCtor)
|
||||
NS_DEFINE_CONSTRUCTOR_FUNC_DATA(MutationObserver, MutationObserverCtor)
|
||||
NS_DEFINE_CONSTRUCTOR_FUNC_DATA(MozActivity, MozActivityCtor)
|
||||
};
|
||||
|
||||
nsIXPConnect *nsDOMClassInfo::sXPConnect = nullptr;
|
||||
@ -1800,7 +1817,6 @@ jsid nsDOMClassInfo::sParent_id = JSID_VOID;
|
||||
jsid nsDOMClassInfo::sScrollbars_id = JSID_VOID;
|
||||
jsid nsDOMClassInfo::sLocation_id = JSID_VOID;
|
||||
jsid nsDOMClassInfo::sConstructor_id = JSID_VOID;
|
||||
jsid nsDOMClassInfo::s_content_id = JSID_VOID;
|
||||
jsid nsDOMClassInfo::sContent_id = JSID_VOID;
|
||||
jsid nsDOMClassInfo::sMenubar_id = JSID_VOID;
|
||||
jsid nsDOMClassInfo::sToolbar_id = JSID_VOID;
|
||||
@ -2077,7 +2093,6 @@ nsDOMClassInfo::DefineStaticJSVals(JSContext *cx)
|
||||
SET_JSID_TO_STRING(sScrollbars_id, cx, "scrollbars");
|
||||
SET_JSID_TO_STRING(sLocation_id, cx, "location");
|
||||
SET_JSID_TO_STRING(sConstructor_id, cx, "constructor");
|
||||
SET_JSID_TO_STRING(s_content_id, cx, "_content");
|
||||
SET_JSID_TO_STRING(sContent_id, cx, "content");
|
||||
SET_JSID_TO_STRING(sMenubar_id, cx, "menubar");
|
||||
SET_JSID_TO_STRING(sToolbar_id, cx, "toolbar");
|
||||
@ -2183,23 +2198,6 @@ CutPrefix(const char *aName) {
|
||||
return aName;
|
||||
}
|
||||
|
||||
// static
|
||||
nsresult
|
||||
nsDOMClassInfo::RegisterClassName(PRInt32 aClassInfoID)
|
||||
{
|
||||
nsScriptNameSpaceManager *nameSpaceManager =
|
||||
nsJSRuntime::GetNameSpaceManager();
|
||||
NS_ENSURE_TRUE(nameSpaceManager, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
nameSpaceManager->RegisterClassName(sClassInfoData[aClassInfoID].mName,
|
||||
aClassInfoID,
|
||||
sClassInfoData[aClassInfoID].mChromeOnly,
|
||||
sClassInfoData[aClassInfoID].mDisabled,
|
||||
&sClassInfoData[aClassInfoID].mNameUTF16);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// static
|
||||
nsresult
|
||||
nsDOMClassInfo::RegisterClassProtos(PRInt32 aClassInfoID)
|
||||
@ -4545,7 +4543,9 @@ nsDOMClassInfo::Init()
|
||||
PRInt32 i;
|
||||
|
||||
for (i = 0; i < eDOMClassInfoIDCount; ++i) {
|
||||
RegisterClassName(i);
|
||||
nsDOMClassInfoData& data = sClassInfoData[i];
|
||||
nameSpaceManager->RegisterClassName(data.mName, i, data.mChromeOnly,
|
||||
data.mDisabled, &data.mNameUTF16);
|
||||
}
|
||||
|
||||
for (i = 0; i < eDOMClassInfoIDCount; ++i) {
|
||||
@ -5204,7 +5204,6 @@ nsDOMClassInfo::ShutDown()
|
||||
sScrollbars_id = JSID_VOID;
|
||||
sLocation_id = JSID_VOID;
|
||||
sConstructor_id = JSID_VOID;
|
||||
s_content_id = JSID_VOID;
|
||||
sContent_id = JSID_VOID;
|
||||
sMenubar_id = JSID_VOID;
|
||||
sToolbar_id = JSID_VOID;
|
||||
@ -5643,19 +5642,6 @@ nsWindowSH::Enumerate(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static const char*
|
||||
FindConstructorContractID(const nsDOMClassInfoData *aDOMClassInfoData)
|
||||
{
|
||||
PRUint32 i;
|
||||
for (i = 0; i < ArrayLength(kConstructorMap); ++i) {
|
||||
if (&sClassInfoData[kConstructorMap[i].mDOMClassInfoID] ==
|
||||
aDOMClassInfoData) {
|
||||
return kConstructorMap[i].mContractID;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static nsDOMConstructorFunc
|
||||
FindConstructorFunc(const nsDOMClassInfoData *aDOMClassInfoData)
|
||||
{
|
||||
@ -5678,18 +5664,11 @@ BaseStubConstructor(nsIWeakReference* aWeakOwner,
|
||||
if (name_struct->mType == nsGlobalNameStruct::eTypeClassConstructor) {
|
||||
const nsDOMClassInfoData* ci_data =
|
||||
&sClassInfoData[name_struct->mDOMClassInfoID];
|
||||
const char *contractid = FindConstructorContractID(ci_data);
|
||||
if (contractid) {
|
||||
native = do_CreateInstance(contractid, &rv);
|
||||
}
|
||||
else {
|
||||
nsDOMConstructorFunc func = FindConstructorFunc(ci_data);
|
||||
if (func) {
|
||||
rv = func(getter_AddRefs(native));
|
||||
}
|
||||
else {
|
||||
rv = NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
nsDOMConstructorFunc func = FindConstructorFunc(ci_data);
|
||||
if (func) {
|
||||
rv = func(getter_AddRefs(native));
|
||||
} else {
|
||||
rv = NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
} else if (name_struct->mType == nsGlobalNameStruct::eTypeExternalConstructor) {
|
||||
native = do_CreateInstance(name_struct->mCID, &rv);
|
||||
@ -6102,7 +6081,7 @@ private:
|
||||
return data->mConstructorCID != nullptr;
|
||||
}
|
||||
|
||||
return FindConstructorContractID(aData) || FindConstructorFunc(aData);
|
||||
return FindConstructorFunc(aData);
|
||||
}
|
||||
static bool IsConstructable(const nsGlobalNameStruct *aNameStruct)
|
||||
{
|
||||
@ -6962,18 +6941,6 @@ nsWindowSH::GlobalResolve(nsGlobalWindow *aWin, JSContext *cx,
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Native code for window._content getter, this simply maps
|
||||
// window._content to window.content for backwards compatibility only.
|
||||
static JSBool
|
||||
ContentWindowGetter(JSContext *cx, unsigned argc, jsval *vp)
|
||||
{
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
if (!obj)
|
||||
return JS_FALSE;
|
||||
|
||||
return ::JS_GetProperty(cx, obj, "content", vp);
|
||||
}
|
||||
|
||||
static JSNewResolveOp sOtherResolveFuncs[] = {
|
||||
mozilla::dom::workers::ResolveWorkerClasses
|
||||
};
|
||||
@ -7085,68 +7052,66 @@ nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
|
||||
nsIScriptContext *my_context = win->GetContextInternal();
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
// Resolve standard classes on my_context's JSContext (or on cx,
|
||||
// if we don't have a my_context yet), in case the two contexts
|
||||
// have different origins. We want lazy standard class
|
||||
// initialization to behave as if it were done eagerly, on each
|
||||
// window's own context (not on some other window-caller's
|
||||
// context).
|
||||
|
||||
JSBool did_resolve = JS_FALSE;
|
||||
JSContext *my_cx;
|
||||
|
||||
JSBool ok = JS_TRUE;
|
||||
jsval exn = JSVAL_VOID;
|
||||
if (!ObjectIsNativeWrapper(cx, obj)) {
|
||||
JSAutoEnterCompartment ac;
|
||||
JSBool did_resolve = JS_FALSE;
|
||||
JSBool ok = JS_TRUE;
|
||||
JS::Value exn = JSVAL_VOID;
|
||||
|
||||
if (!my_context) {
|
||||
my_cx = cx;
|
||||
} else {
|
||||
my_cx = my_context->GetNativeContext();
|
||||
{
|
||||
JSAutoEnterCompartment ac;
|
||||
|
||||
if (my_cx != cx) {
|
||||
if (!ac.enter(my_cx, obj)) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
JSContext* my_cx;
|
||||
if (!my_context) {
|
||||
my_cx = cx;
|
||||
} else {
|
||||
my_cx = my_context->GetNativeContext();
|
||||
|
||||
if (my_cx != cx) {
|
||||
if (!ac.enter(my_cx, obj)) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
JSAutoRequest transfer(my_cx);
|
||||
|
||||
// Don't resolve standard classes on XPCNativeWrapper etc, only
|
||||
// resolve them if we're resolving on the real global object.
|
||||
ok = JS_ResolveStandardClass(my_cx, obj, id, &did_resolve);
|
||||
|
||||
if (!ok) {
|
||||
// Trust the JS engine (or the script security manager) to set
|
||||
// the exception in the JS engine.
|
||||
|
||||
if (!JS_GetPendingException(my_cx, &exn)) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
// Return NS_OK to avoid stomping over the exception that was passed
|
||||
// down from the ResolveStandardClass call.
|
||||
// Note that the order of the JS_ClearPendingException and
|
||||
// JS_SetPendingException is important in the case that my_cx == cx.
|
||||
|
||||
JS_ClearPendingException(my_cx);
|
||||
}
|
||||
}
|
||||
|
||||
JSAutoRequest transfer(my_cx);
|
||||
|
||||
// Don't resolve standard classes on XPCNativeWrapper etc, only
|
||||
// resolve them if we're resolving on the real global object.
|
||||
ok = JS_ResolveStandardClass(my_cx, obj, id, &did_resolve);
|
||||
|
||||
if (!ok) {
|
||||
// Trust the JS engine (or the script security manager) to set
|
||||
// the exception in the JS engine.
|
||||
|
||||
if (!JS_GetPendingException(my_cx, &exn)) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
// Return NS_OK to avoid stomping over the exception that was passed
|
||||
// down from the ResolveStandardClass call.
|
||||
// Note that the order of the JS_ClearPendingException and
|
||||
// JS_SetPendingException is important in the case that my_cx == cx.
|
||||
|
||||
JS_ClearPendingException(my_cx);
|
||||
JS_SetPendingException(cx, exn);
|
||||
*_retval = JS_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
if (!ok) {
|
||||
JS_SetPendingException(cx, exn);
|
||||
*_retval = JS_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (did_resolve) {
|
||||
*objp = obj;
|
||||
|
||||
return NS_OK;
|
||||
if (did_resolve) {
|
||||
*objp = obj;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(flags & JSRESOLVE_ASSIGNING)) {
|
||||
@ -7165,6 +7130,7 @@ nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (sLocation_id == id) {
|
||||
// This must be done even if we're just getting the value of
|
||||
// window.location (i.e. no checking flags & JSRESOLVE_ASSIGNING
|
||||
@ -7306,36 +7272,6 @@ nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
}
|
||||
}
|
||||
|
||||
if (s_content_id == id) {
|
||||
// Map window._content to window.content for backwards
|
||||
// compatibility, this should spit out an message on the JS
|
||||
// console.
|
||||
|
||||
JSObject *windowObj = win->GetGlobalJSObject();
|
||||
|
||||
JSAutoRequest ar(cx);
|
||||
|
||||
JSFunction *fun = ::JS_NewFunction(cx, ContentWindowGetter, 0, 0,
|
||||
windowObj, "_content");
|
||||
if (!fun) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
JSObject *funObj = ::JS_GetFunctionObject(fun);
|
||||
|
||||
if (!::JS_DefinePropertyById(cx, windowObj, id, JSVAL_VOID,
|
||||
JS_DATA_TO_FUNC_PTR(JSPropertyOp, funObj),
|
||||
nullptr,
|
||||
JSPROP_ENUMERATE | JSPROP_GETTER |
|
||||
JSPROP_SHARED)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
*objp = obj;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (flags & JSRESOLVE_ASSIGNING) {
|
||||
if (IsReadonlyReplaceable(id) ||
|
||||
(!(flags & JSRESOLVE_QUALIFIED) && IsWritableReplaceable(id))) {
|
||||
@ -9065,15 +9001,16 @@ GetDocumentAllHelper(JSObject *obj)
|
||||
static inline void *
|
||||
FlagsToPrivate(PRUint32 flags)
|
||||
{
|
||||
JS_ASSERT((flags & (1 << 31)) == 0);
|
||||
return (void *)(flags << 1);
|
||||
MOZ_ASSERT((flags & (1 << 31)) == 0);
|
||||
return reinterpret_cast<void*>(static_cast<uintptr_t>(flags << 1));
|
||||
}
|
||||
|
||||
static inline PRUint32
|
||||
PrivateToFlags(void *priv)
|
||||
{
|
||||
JS_ASSERT(size_t(priv) <= PR_UINT32_MAX && (size_t(priv) & 1) == 0);
|
||||
return (PRUint32)(size_t(priv) >> 1);
|
||||
uintptr_t intPriv = reinterpret_cast<uintptr_t>(priv);
|
||||
MOZ_ASSERT(intPriv <= PR_UINT32_MAX && (intPriv & 1) == 0);
|
||||
return static_cast<PRUint32>(intPriv >> 1);
|
||||
}
|
||||
|
||||
JSBool
|
||||
@ -9578,14 +9515,18 @@ nsHTMLSelectElementSH::SetOption(JSContext *cx, JS::Value *vp, PRUint32 aIndex,
|
||||
JSAutoRequest ar(cx);
|
||||
|
||||
// vp must refer to an object
|
||||
if (!vp->isObject()) {
|
||||
if (!vp->isObjectOrNull()) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLOptionElement> new_option = do_QueryWrapper(cx, &vp->toObject());
|
||||
if (!new_option) {
|
||||
// Someone is trying to set an option to a non-option object.
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
nsCOMPtr<nsIDOMHTMLOptionElement> new_option;
|
||||
|
||||
if (JSObject* obj = vp->toObjectOrNull()) {
|
||||
new_option = do_QueryWrapper(cx, obj);
|
||||
if (!new_option) {
|
||||
// Someone is trying to set an option to a non-option object.
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
}
|
||||
|
||||
return aOptCollection->SetOption(aIndex, new_option);
|
||||
|
@ -157,7 +157,6 @@ protected:
|
||||
}
|
||||
|
||||
static nsresult Init();
|
||||
static nsresult RegisterClassName(PRInt32 aDOMClassInfoID);
|
||||
static nsresult RegisterClassProtos(PRInt32 aDOMClassInfoID);
|
||||
static nsresult RegisterExternalClasses();
|
||||
nsresult ResolveConstructor(JSContext *cx, JSObject *obj,
|
||||
|
@ -41,6 +41,14 @@ nsDOMNavigationTiming::Clear()
|
||||
mDOMContentLoadedEventEnd = 0;
|
||||
mDOMComplete = 0;
|
||||
mRedirectCheck = NOT_CHECKED;
|
||||
|
||||
mLoadEventStartSet = false;
|
||||
mLoadEventEndSet = false;
|
||||
mDOMLoadingSet = false;
|
||||
mDOMInteractiveSet = false;
|
||||
mDOMContentLoadedEventStartSet = false;
|
||||
mDOMContentLoadedEventEndSet = false;
|
||||
mDOMCompleteSet = false;
|
||||
}
|
||||
|
||||
DOMTimeMilliSec
|
||||
@ -128,13 +136,19 @@ nsDOMNavigationTiming::NotifyUnloadEventEnd()
|
||||
void
|
||||
nsDOMNavigationTiming::NotifyLoadEventStart()
|
||||
{
|
||||
mLoadEventStart = DurationFromStart();
|
||||
if (!mLoadEventStartSet) {
|
||||
mLoadEventStart = DurationFromStart();
|
||||
mLoadEventStartSet = true;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsDOMNavigationTiming::NotifyLoadEventEnd()
|
||||
{
|
||||
mLoadEventEnd = DurationFromStart();
|
||||
if (!mLoadEventEndSet) {
|
||||
mLoadEventEnd = DurationFromStart();
|
||||
mLoadEventEndSet = true;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
@ -166,43 +180,61 @@ nsDOMNavigationTiming::ReportRedirects()
|
||||
void
|
||||
nsDOMNavigationTiming::SetDOMLoadingTimeStamp(nsIURI* aURI, mozilla::TimeStamp aValue)
|
||||
{
|
||||
mLoadedURI = aURI;
|
||||
mDOMLoading = TimeStampToDOM(aValue);
|
||||
if (!mDOMLoadingSet) {
|
||||
mLoadedURI = aURI;
|
||||
mDOMLoading = TimeStampToDOM(aValue);
|
||||
mDOMLoadingSet = true;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsDOMNavigationTiming::NotifyDOMLoading(nsIURI* aURI)
|
||||
{
|
||||
mLoadedURI = aURI;
|
||||
mDOMLoading = DurationFromStart();
|
||||
if (!mDOMLoadingSet) {
|
||||
mLoadedURI = aURI;
|
||||
mDOMLoading = DurationFromStart();
|
||||
mDOMLoadingSet = true;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsDOMNavigationTiming::NotifyDOMInteractive(nsIURI* aURI)
|
||||
{
|
||||
mLoadedURI = aURI;
|
||||
mDOMInteractive = DurationFromStart();
|
||||
if (!mDOMInteractiveSet) {
|
||||
mLoadedURI = aURI;
|
||||
mDOMInteractive = DurationFromStart();
|
||||
mDOMInteractiveSet = true;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsDOMNavigationTiming::NotifyDOMComplete(nsIURI* aURI)
|
||||
{
|
||||
mLoadedURI = aURI;
|
||||
mDOMComplete = DurationFromStart();
|
||||
if (!mDOMCompleteSet) {
|
||||
mLoadedURI = aURI;
|
||||
mDOMComplete = DurationFromStart();
|
||||
mDOMCompleteSet = true;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsDOMNavigationTiming::NotifyDOMContentLoadedStart(nsIURI* aURI)
|
||||
{
|
||||
mLoadedURI = aURI;
|
||||
mDOMContentLoadedEventStart = DurationFromStart();
|
||||
if (!mDOMContentLoadedEventStartSet) {
|
||||
mLoadedURI = aURI;
|
||||
mDOMContentLoadedEventStart = DurationFromStart();
|
||||
mDOMContentLoadedEventStartSet = true;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsDOMNavigationTiming::NotifyDOMContentLoadedEnd(nsIURI* aURI)
|
||||
{
|
||||
mLoadedURI = aURI;
|
||||
mDOMContentLoadedEventEnd = DurationFromStart();
|
||||
if (!mDOMContentLoadedEventEndSet) {
|
||||
mLoadedURI = aURI;
|
||||
mDOMContentLoadedEventEnd = DurationFromStart();
|
||||
mDOMContentLoadedEventEndSet = true;
|
||||
}
|
||||
}
|
||||
|
||||
PRUint16
|
||||
|
@ -136,6 +136,17 @@ private:
|
||||
DOMTimeMilliSec mDOMContentLoadedEventStart;
|
||||
DOMTimeMilliSec mDOMContentLoadedEventEnd;
|
||||
DOMTimeMilliSec mDOMComplete;
|
||||
|
||||
// Booleans to keep track of what things we've already been notified
|
||||
// about. We don't update those once we've been notified about them
|
||||
// once.
|
||||
bool mLoadEventStartSet : 1;
|
||||
bool mLoadEventEndSet : 1;
|
||||
bool mDOMLoadingSet : 1;
|
||||
bool mDOMInteractiveSet : 1;
|
||||
bool mDOMContentLoadedEventStartSet : 1;
|
||||
bool mDOMContentLoadedEventEndSet : 1;
|
||||
bool mDOMCompleteSet : 1;
|
||||
};
|
||||
|
||||
#endif /* nsDOMNavigationTiming_h___ */
|
||||
|
@ -1006,7 +1006,7 @@ nsDOMWindowUtils::SendSimpleGestureEvent(const nsAString& aType,
|
||||
float aX,
|
||||
float aY,
|
||||
PRUint32 aDirection,
|
||||
PRFloat64 aDelta,
|
||||
double aDelta,
|
||||
PRInt32 aModifiers,
|
||||
PRUint32 aClickCount)
|
||||
{
|
||||
|
@ -1956,6 +1956,17 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
|
||||
if (newInnerWindow->mNavigator) {
|
||||
newInnerWindow->mNavigator->SetWindow(newInnerWindow);
|
||||
}
|
||||
|
||||
// Make a copy of the old window's performance object on document.open.
|
||||
// Note that we have to force eager creation of it here, because we need
|
||||
// to grab the current document channel and whatnot before that changes.
|
||||
currentInner->CreatePerformanceObjectIfNeeded();
|
||||
if (currentInner->mPerformance) {
|
||||
newInnerWindow->mPerformance =
|
||||
new nsPerformance(newInnerWindow,
|
||||
currentInner->mPerformance->GetDOMTiming(),
|
||||
currentInner->mPerformance->GetChannel());
|
||||
}
|
||||
}
|
||||
|
||||
// Don't free objects on our current inner window if it's going to be
|
||||
@ -2931,27 +2942,31 @@ nsGlobalWindow::GetPerformance(nsISupports** aPerformance)
|
||||
*aPerformance = nullptr;
|
||||
|
||||
if (nsGlobalWindow::HasPerformanceSupport()) {
|
||||
if (!mPerformance) {
|
||||
if (!mDoc) {
|
||||
return NS_OK;
|
||||
}
|
||||
nsRefPtr<nsDOMNavigationTiming> timing = mDoc->GetNavigationTiming();
|
||||
nsCOMPtr<nsITimedChannel> timedChannel(do_QueryInterface(mDoc->GetChannel()));
|
||||
bool timingEnabled = false;
|
||||
if (!timedChannel ||
|
||||
!NS_SUCCEEDED(timedChannel->GetTimingEnabled(&timingEnabled)) ||
|
||||
!timingEnabled) {
|
||||
timedChannel = nullptr;
|
||||
}
|
||||
if (timing) {
|
||||
mPerformance = new nsPerformance(this, timing, timedChannel);
|
||||
}
|
||||
}
|
||||
CreatePerformanceObjectIfNeeded();
|
||||
NS_IF_ADDREF(*aPerformance = mPerformance);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsGlobalWindow::CreatePerformanceObjectIfNeeded()
|
||||
{
|
||||
if (mPerformance || !mDoc) {
|
||||
return;
|
||||
}
|
||||
nsRefPtr<nsDOMNavigationTiming> timing = mDoc->GetNavigationTiming();
|
||||
nsCOMPtr<nsITimedChannel> timedChannel(do_QueryInterface(mDoc->GetChannel()));
|
||||
bool timingEnabled = false;
|
||||
if (!timedChannel ||
|
||||
!NS_SUCCEEDED(timedChannel->GetTimingEnabled(&timingEnabled)) ||
|
||||
!timingEnabled) {
|
||||
timedChannel = nullptr;
|
||||
}
|
||||
if (timing) {
|
||||
mPerformance = new nsPerformance(this, timing, timedChannel);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* GetScriptableParent is called when script reads window.parent.
|
||||
*
|
||||
@ -3070,6 +3085,14 @@ nsGlobalWindow::GetTopImpl(nsIDOMWindow** aTop, bool aScriptable)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Map window._content to window.content for backwards compatibility, this
|
||||
// should spit out an message on the JS console.
|
||||
NS_IMETHODIMP
|
||||
nsGlobalWindow::GetContentForCompat(nsIDOMWindow** aContent)
|
||||
{
|
||||
return GetContent(aContent);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGlobalWindow::GetContent(nsIDOMWindow** aContent)
|
||||
{
|
||||
@ -3114,7 +3137,7 @@ nsGlobalWindow::GetContent(nsIDOMWindow** aContent)
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMWindow> domWindow(do_GetInterface(primaryContent));
|
||||
NS_IF_ADDREF(*aContent = domWindow);
|
||||
domWindow.forget(aContent);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -905,6 +905,9 @@ protected:
|
||||
// Implements Get{Real,Scriptable}Top.
|
||||
nsresult GetTopImpl(nsIDOMWindow **aWindow, bool aScriptable);
|
||||
|
||||
// Helper for creating performance objects.
|
||||
void CreatePerformanceObjectIfNeeded();
|
||||
|
||||
// When adding new member variables, be careful not to create cycles
|
||||
// through JavaScript. If there is any chance that a member variable
|
||||
// could own objects that are implemented in JavaScript, then those
|
||||
@ -990,6 +993,7 @@ protected:
|
||||
nsCOMPtr<nsIPrincipal> mArgumentsOrigin;
|
||||
nsRefPtr<Navigator> mNavigator;
|
||||
nsRefPtr<nsScreen> mScreen;
|
||||
// mPerformance is only used on inner windows.
|
||||
nsRefPtr<nsPerformance> mPerformance;
|
||||
nsRefPtr<nsDOMWindowList> mFrames;
|
||||
nsRefPtr<nsBarProp> mMenubar;
|
||||
|
@ -140,6 +140,11 @@ public:
|
||||
return mDOMTiming;
|
||||
}
|
||||
|
||||
nsITimedChannel* GetChannel() const
|
||||
{
|
||||
return mChannel;
|
||||
}
|
||||
|
||||
nsIDOMWindow* GetParentObject() const
|
||||
{
|
||||
return mWindow.get();
|
||||
|
@ -64,7 +64,7 @@ struct TypedArray : public TypedArray_base<T,UnboxArray> {
|
||||
|
||||
static inline JSObject*
|
||||
Create(JSContext* cx, nsWrapperCache* creator, uint32_t length,
|
||||
T* data = NULL) {
|
||||
const T* data = NULL) {
|
||||
JSObject* creatorWrapper;
|
||||
JSAutoEnterCompartment ac;
|
||||
if (creator && (creatorWrapper = creator->GetWrapperPreserveColor())) {
|
||||
|
@ -62,14 +62,18 @@ NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetHelper)
|
||||
NS_IMPL_ADDREF_INHERITED(BluetoothAdapter, nsDOMEventTargetHelper)
|
||||
NS_IMPL_RELEASE_INHERITED(BluetoothAdapter, nsDOMEventTargetHelper)
|
||||
|
||||
BluetoothAdapter::BluetoothAdapter(nsPIDOMWindow* aOwner, const nsAString& aPath)
|
||||
BluetoothAdapter::BluetoothAdapter(nsPIDOMWindow* aOwner, const BluetoothValue& aValue)
|
||||
: BluetoothPropertyContainer(BluetoothObjectType::TYPE_ADAPTER)
|
||||
, mJsUuids(nullptr)
|
||||
, mJsDeviceAddresses(nullptr)
|
||||
, mIsRooted(false)
|
||||
{
|
||||
BindToOwner(aOwner);
|
||||
mPath = aPath;
|
||||
const InfallibleTArray<BluetoothNamedValue>& values =
|
||||
aValue.get_ArrayOfBluetoothNamedValue();
|
||||
for (uint32_t i = 0; i < values.Length(); ++i) {
|
||||
SetPropertyByValue(values[i]);
|
||||
}
|
||||
}
|
||||
|
||||
BluetoothAdapter::~BluetoothAdapter()
|
||||
@ -175,21 +179,16 @@ BluetoothAdapter::SetPropertyByValue(const BluetoothNamedValue& aValue)
|
||||
|
||||
// static
|
||||
already_AddRefed<BluetoothAdapter>
|
||||
BluetoothAdapter::Create(nsPIDOMWindow* aOwner, const nsAString& aPath)
|
||||
BluetoothAdapter::Create(nsPIDOMWindow* aOwner, const BluetoothValue& aValue)
|
||||
{
|
||||
// Make sure we at least have a path
|
||||
NS_ASSERTION(!aPath.IsEmpty(), "Adapter created with empty path!");
|
||||
|
||||
BluetoothService* bs = BluetoothService::Get();
|
||||
if (!bs) {
|
||||
NS_WARNING("BluetoothService not available!");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsRefPtr<BluetoothAdapter> adapter = new BluetoothAdapter(aOwner, aPath);
|
||||
nsString path;
|
||||
path = adapter->GetPath();
|
||||
if (NS_FAILED(bs->RegisterBluetoothSignalHandler(path, adapter))) {
|
||||
nsRefPtr<BluetoothAdapter> adapter = new BluetoothAdapter(aOwner, aValue);
|
||||
if (NS_FAILED(bs->RegisterBluetoothSignalHandler(adapter->GetPath(), adapter))) {
|
||||
NS_WARNING("Failed to register object with observer!");
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ BEGIN_BLUETOOTH_NAMESPACE
|
||||
|
||||
class BluetoothSignal;
|
||||
class BluetoothNamedValue;
|
||||
class BluetoothValue;
|
||||
|
||||
class BluetoothAdapter : public nsDOMEventTargetHelper
|
||||
, public nsIDOMBluetoothAdapter
|
||||
@ -36,7 +37,7 @@ public:
|
||||
nsDOMEventTargetHelper)
|
||||
|
||||
static already_AddRefed<BluetoothAdapter>
|
||||
Create(nsPIDOMWindow* aOwner, const nsAString& name);
|
||||
Create(nsPIDOMWindow* aOwner, const BluetoothValue& aValue);
|
||||
|
||||
void Notify(const BluetoothSignal& aParam);
|
||||
|
||||
@ -57,7 +58,7 @@ public:
|
||||
virtual void SetPropertyByValue(const BluetoothNamedValue& aValue);
|
||||
private:
|
||||
|
||||
BluetoothAdapter(nsPIDOMWindow* aOwner, const nsAString& aPath);
|
||||
BluetoothAdapter(nsPIDOMWindow* aOwner, const BluetoothValue& aValue);
|
||||
~BluetoothAdapter();
|
||||
|
||||
void Root();
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user