mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge m-c to inbound.
This commit is contained in:
commit
34c7adfeaf
@ -198,7 +198,7 @@
|
||||
<menuitem id="appmenu_debugger"
|
||||
hidden="true"
|
||||
type="checkbox"
|
||||
label="&debuggerMenu.label;"
|
||||
label="&debuggerMenu.label2;"
|
||||
key="key_debugger"
|
||||
command="Tools:Debugger"/>
|
||||
<menuitem id="appmenu_remoteDebugger"
|
||||
|
@ -574,7 +574,7 @@
|
||||
<menuitem id="menu_debugger"
|
||||
hidden="true"
|
||||
type="checkbox"
|
||||
label="&debuggerMenu.label;"
|
||||
label="&debuggerMenu.label2;"
|
||||
key="key_debugger"
|
||||
command="Tools:Debugger"/>
|
||||
<menuitem id="menu_remoteDebugger"
|
||||
|
@ -8,8 +8,18 @@
|
||||
* Keeps thumbnails of open web pages up-to-date.
|
||||
*/
|
||||
let gBrowserThumbnails = {
|
||||
/**
|
||||
* Pref that controls whether we can store SSL content on disk
|
||||
*/
|
||||
PREF_DISK_CACHE_SSL: "browser.cache.disk_cache_ssl",
|
||||
|
||||
_captureDelayMS: 1000,
|
||||
|
||||
/**
|
||||
* Used to keep track of disk_cache_ssl preference
|
||||
*/
|
||||
_sslDiskCacheEnabled: null,
|
||||
|
||||
/**
|
||||
* Map of capture() timeouts assigned to their browsers.
|
||||
*/
|
||||
@ -32,6 +42,10 @@ let gBrowserThumbnails = {
|
||||
} catch (e) {}
|
||||
|
||||
gBrowser.addTabsProgressListener(this);
|
||||
Services.prefs.addObserver(this.PREF_DISK_CACHE_SSL, this, false);
|
||||
|
||||
this._sslDiskCacheEnabled =
|
||||
Services.prefs.getBoolPref(this.PREF_DISK_CACHE_SSL);
|
||||
|
||||
this._tabEvents.forEach(function (aEvent) {
|
||||
gBrowser.tabContainer.addEventListener(aEvent, this, false);
|
||||
@ -45,6 +59,7 @@ let gBrowserThumbnails = {
|
||||
|
||||
uninit: function Thumbnails_uninit() {
|
||||
gBrowser.removeTabsProgressListener(this);
|
||||
Services.prefs.removeObserver(this.PREF_DISK_CACHE_SSL, this);
|
||||
|
||||
this._tabEvents.forEach(function (aEvent) {
|
||||
gBrowser.tabContainer.removeEventListener(aEvent, this, false);
|
||||
@ -68,6 +83,11 @@ let gBrowserThumbnails = {
|
||||
}
|
||||
},
|
||||
|
||||
observe: function Thumbnails_observe() {
|
||||
this._sslDiskCacheEnabled =
|
||||
Services.prefs.getBoolPref(this.PREF_DISK_CACHE_SSL);
|
||||
},
|
||||
|
||||
/**
|
||||
* State change progress listener for all tabs.
|
||||
*/
|
||||
@ -129,19 +149,30 @@ let gBrowserThumbnails = {
|
||||
|
||||
// Don't take screenshots of internally redirecting about: pages.
|
||||
// This includes error pages.
|
||||
if (channel.originalURI.schemeIs("about"))
|
||||
let uri = channel.originalURI;
|
||||
if (uri.schemeIs("about"))
|
||||
return false;
|
||||
|
||||
let httpChannel;
|
||||
try {
|
||||
// If the channel is a nsIHttpChannel get its http status code.
|
||||
let httpChannel = channel.QueryInterface(Ci.nsIHttpChannel);
|
||||
httpChannel = channel.QueryInterface(Ci.nsIHttpChannel);
|
||||
} catch (e) { /* Not an HTTP channel. */ }
|
||||
|
||||
if (httpChannel) {
|
||||
// Continue only if we have a 2xx status code.
|
||||
return Math.floor(httpChannel.responseStatus / 100) == 2;
|
||||
} catch (e) {
|
||||
// Not a http channel, we just assume a success status code.
|
||||
return true;
|
||||
if (Math.floor(httpChannel.responseStatus / 100) != 2)
|
||||
return false;
|
||||
|
||||
// Cache-Control: no-store.
|
||||
if (httpChannel.isNoStoreResponse())
|
||||
return false;
|
||||
|
||||
// Don't capture HTTPS pages unless the user explicitly enabled it.
|
||||
if (uri.schemeIs("https") && !this._sslDiskCacheEnabled)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
_clearTimeout: function Thumbnails_clearTimeout(aBrowser) {
|
||||
|
@ -1078,6 +1078,7 @@
|
||||
hidden="true">
|
||||
#ifdef XP_MACOSX
|
||||
<toolbarbutton id="developer-toolbar-closebutton"
|
||||
class="devtools-closebutton"
|
||||
oncommand="DeveloperToolbar.hide();"
|
||||
tooltiptext="&devToolbarCloseButton.tooltiptext;"/>
|
||||
#endif
|
||||
@ -1102,6 +1103,7 @@
|
||||
command="Tools:Debugger"/>
|
||||
#ifndef XP_MACOSX
|
||||
<toolbarbutton id="developer-toolbar-closebutton"
|
||||
class="devtools-closebutton"
|
||||
oncommand="DeveloperToolbar.hide();"
|
||||
tooltiptext="&devToolbarCloseButton.tooltiptext;"/>
|
||||
#endif
|
||||
|
@ -111,12 +111,15 @@ html|*#highlighter-nodeinfobar-tagname {
|
||||
}
|
||||
|
||||
#inspector-layoutview-container > iframe {
|
||||
-moz-transition-property: height;
|
||||
-moz-transition-duration: 0.1s;
|
||||
/* header size */
|
||||
height: 22px;
|
||||
}
|
||||
|
||||
#inspector-layoutview-container:not([disable-transitions]) > iframe {
|
||||
-moz-transition-property: height;
|
||||
-moz-transition-duration: 0.2s;
|
||||
}
|
||||
|
||||
#inspector-layoutview-container > iframe[open] {
|
||||
/* header size + layout view size: 22px + 155px */
|
||||
height: 177px;
|
||||
|
@ -3806,7 +3806,6 @@
|
||||
role="presentation"/>
|
||||
<xul:toolbarbutton anonid="close-button"
|
||||
xbl:inherits="fadein,pinned,selected"
|
||||
clickthrough="never"
|
||||
class="tab-close-button"/>
|
||||
</xul:hbox>
|
||||
</xul:stack>
|
||||
|
@ -13,6 +13,7 @@ include $(topsrcdir)/config/rules.mk
|
||||
|
||||
_BROWSER_FILES = \
|
||||
browser_thumbnails_capture.js \
|
||||
browser_thumbnails_privacy.js \
|
||||
browser_thumbnails_redirect.js \
|
||||
browser_thumbnails_storage.js \
|
||||
browser_thumbnails_bug726727.js \
|
||||
@ -20,6 +21,7 @@ _BROWSER_FILES = \
|
||||
head.js \
|
||||
background_red.html \
|
||||
background_red_redirect.sjs \
|
||||
privacy_cache_control.sjs \
|
||||
$(NULL)
|
||||
|
||||
libs:: $(_BROWSER_FILES)
|
||||
|
@ -0,0 +1,66 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
const PREF_DISK_CACHE_SSL = "browser.cache.disk_cache_ssl";
|
||||
const URL = "://example.com/browser/browser/components/thumbnails/" +
|
||||
"test/privacy_cache_control.sjs";
|
||||
|
||||
function runTests() {
|
||||
registerCleanupFunction(function () {
|
||||
Services.prefs.clearUserPref(PREF_DISK_CACHE_SSL);
|
||||
});
|
||||
|
||||
let positive = [
|
||||
// A normal HTTP page without any Cache-Control header.
|
||||
{scheme: "http", cacheControl: null, diskCacheSSL: false},
|
||||
|
||||
// A normal HTTP page with 'Cache-Control: private'.
|
||||
{scheme: "http", cacheControl: "private", diskCacheSSL: false},
|
||||
|
||||
// Capture HTTPS pages if browser.cache.disk_cache_ssl == true.
|
||||
{scheme: "https", cacheControl: null, diskCacheSSL: true},
|
||||
{scheme: "https", cacheControl: "public", diskCacheSSL: true},
|
||||
{scheme: "https", cacheControl: "private", diskCacheSSL: true}
|
||||
];
|
||||
|
||||
let negative = [
|
||||
// Never capture pages with 'Cache-Control: no-store'.
|
||||
{scheme: "http", cacheControl: "no-store", diskCacheSSL: false},
|
||||
{scheme: "http", cacheControl: "no-store", diskCacheSSL: true},
|
||||
{scheme: "https", cacheControl: "no-store", diskCacheSSL: false},
|
||||
{scheme: "https", cacheControl: "no-store", diskCacheSSL: true},
|
||||
|
||||
// Don't capture HTTPS pages by default.
|
||||
{scheme: "https", cacheControl: null, diskCacheSSL: false},
|
||||
{scheme: "https", cacheControl: "public", diskCacheSSL: false},
|
||||
{scheme: "https", cacheControl: "private", diskCacheSSL: false}
|
||||
];
|
||||
|
||||
yield checkCombinations(positive, true);
|
||||
yield checkCombinations(negative, false);
|
||||
}
|
||||
|
||||
function checkCombinations(aCombinations, aResult) {
|
||||
let combi = aCombinations.shift();
|
||||
if (!combi) {
|
||||
next();
|
||||
return;
|
||||
}
|
||||
|
||||
let url = combi.scheme + URL;
|
||||
if (combi.cacheControl)
|
||||
url += "?" + combi.cacheControl;
|
||||
Services.prefs.setBoolPref(PREF_DISK_CACHE_SSL, combi.diskCacheSSL);
|
||||
|
||||
let tab = gBrowser.selectedTab = gBrowser.addTab(url);
|
||||
let browser = gBrowser.selectedBrowser;
|
||||
|
||||
whenLoaded(browser, function () {
|
||||
let msg = JSON.stringify(combi) + " == " + aResult;
|
||||
is(gBrowserThumbnails._shouldCapture(browser), aResult, msg);
|
||||
gBrowser.removeTab(tab);
|
||||
|
||||
// Continue with the next combination.
|
||||
checkCombinations(aCombinations, aResult);
|
||||
});
|
||||
}
|
@ -117,52 +117,24 @@ function checkThumbnailColor(aURL, aRed, aGreen, aBlue, aMessage) {
|
||||
let width = 100, height = 100;
|
||||
let thumb = PageThumbs.getThumbnailURL(aURL, width, height);
|
||||
|
||||
getXULDocument(function (aDocument) {
|
||||
let htmlns = "http://www.w3.org/1999/xhtml";
|
||||
let img = aDocument.createElementNS(htmlns, "img");
|
||||
img.setAttribute("src", thumb);
|
||||
let htmlns = "http://www.w3.org/1999/xhtml";
|
||||
let img = document.createElementNS(htmlns, "img");
|
||||
img.setAttribute("src", thumb);
|
||||
|
||||
whenLoaded(img, function () {
|
||||
let canvas = aDocument.createElementNS(htmlns, "canvas");
|
||||
canvas.setAttribute("width", width);
|
||||
canvas.setAttribute("height", height);
|
||||
whenLoaded(img, function () {
|
||||
let canvas = document.createElementNS(htmlns, "canvas");
|
||||
canvas.setAttribute("width", width);
|
||||
canvas.setAttribute("height", height);
|
||||
|
||||
// Draw the image to a canvas and compare the pixel color values.
|
||||
let ctx = canvas.getContext("2d");
|
||||
ctx.drawImage(img, 0, 0, width, height);
|
||||
checkCanvasColor(ctx, aRed, aGreen, aBlue, aMessage);
|
||||
// Draw the image to a canvas and compare the pixel color values.
|
||||
let ctx = canvas.getContext("2d");
|
||||
ctx.drawImage(img, 0, 0, width, height);
|
||||
checkCanvasColor(ctx, aRed, aGreen, aBlue, aMessage);
|
||||
|
||||
next();
|
||||
});
|
||||
next();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Passes a XUL document (created if necessary) to the given callback.
|
||||
* @param aCallback The function to be called when the XUL document has been
|
||||
* created. The first argument will be the document.
|
||||
*/
|
||||
function getXULDocument(aCallback) {
|
||||
let hiddenWindow = Services.appShell.hiddenDOMWindow;
|
||||
let doc = cachedXULDocument || hiddenWindow.document;
|
||||
|
||||
if (doc instanceof XULDocument) {
|
||||
aCallback(cachedXULDocument = doc);
|
||||
return;
|
||||
}
|
||||
|
||||
let iframe = doc.createElement("iframe");
|
||||
iframe.setAttribute("src", "chrome://global/content/mozilla.xhtml");
|
||||
|
||||
iframe.addEventListener("DOMContentLoaded", function onLoad() {
|
||||
iframe.removeEventListener("DOMContentLoaded", onLoad, false);
|
||||
aCallback(cachedXULDocument = iframe.contentDocument);
|
||||
}, false);
|
||||
|
||||
doc.body.appendChild(iframe);
|
||||
registerCleanupFunction(function () { doc.body.removeChild(iframe); });
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the top-left pixel of a given canvas' 2d context for a given color.
|
||||
* @param aContext The 2D context of a canvas.
|
||||
|
16
browser/components/thumbnails/test/privacy_cache_control.sjs
Normal file
16
browser/components/thumbnails/test/privacy_cache_control.sjs
Normal file
@ -0,0 +1,16 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
function handleRequest(aRequest, aResponse) {
|
||||
// Set HTTP Status
|
||||
aResponse.setStatusLine(aRequest.httpVersion, 200, "OK");
|
||||
|
||||
// Set Cache-Control header.
|
||||
let value = aRequest.queryString;
|
||||
if (value)
|
||||
aResponse.setHeader("Cache-Control", value);
|
||||
|
||||
// Set the response body.
|
||||
aResponse.write("<!DOCTYPE html><html><body></body></html>");
|
||||
}
|
@ -1505,6 +1505,10 @@ InspectorStyleSidebar.prototype = {
|
||||
let frame = this._chromeDoc.createElement("iframe");
|
||||
frame.setAttribute("flex", "1");
|
||||
frame._toolID = aRegObj.id;
|
||||
|
||||
// This is needed to enable tooltips inside the iframe document.
|
||||
frame.setAttribute("tooltip", "aHTMLTooltip");
|
||||
|
||||
this._deck.appendChild(frame);
|
||||
|
||||
// wire up button to show the iframe
|
||||
|
@ -97,6 +97,9 @@ LayoutView.prototype = {
|
||||
// Build the layout view in the sidebar.
|
||||
this.buildView();
|
||||
|
||||
this.bound_handleKeypress = this.handleKeypress.bind(this);
|
||||
this.iframe.addEventListener("keypress", this.bound_handleKeypress, true);
|
||||
|
||||
// Get messages from the iframe.
|
||||
this.inspector.chromeWindow.addEventListener("message", this.onMessage, true);
|
||||
|
||||
@ -151,6 +154,7 @@ LayoutView.prototype = {
|
||||
this.inspector.removeListener("locked", this.onLock);
|
||||
this.inspector.removeListener("unlocked", this.onUnlock);
|
||||
this.browser.removeEventListener("MozAfterPaint", this.update, true);
|
||||
this.iframe.removeEventListener("keypress", this.bound_handleKeypress, true);
|
||||
this.inspector.chromeWindow.removeEventListener("message", this.onMessage, true);
|
||||
this.close();
|
||||
this.iframe = null;
|
||||
@ -215,6 +219,28 @@ LayoutView.prototype = {
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Handle keypress.
|
||||
*/
|
||||
handleKeypress: function LV_handleKeypress(event) {
|
||||
let win = this.inspector.chromeWindow;
|
||||
|
||||
// avoid scroll
|
||||
if (event.keyCode == win.KeyEvent.DOM_VK_LEFT ||
|
||||
event.keyCode == win.KeyEvent.DOM_VK_RIGHT ||
|
||||
event.keyCode == win.KeyEvent.DOM_VK_UP ||
|
||||
event.keyCode == win.KeyEvent.DOM_VK_DOWN ||
|
||||
event.keyCode == win.KeyEvent.DOM_VK_PAGE_UP ||
|
||||
event.keyCode == win.KeyEvent.DOM_VK_PAGE_DOWN) {
|
||||
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
if (event.charCode == win.KeyEvent.DOM_VK_SPACE) {
|
||||
this.toggle(true);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Open the view container.
|
||||
*
|
||||
@ -228,6 +254,9 @@ LayoutView.prototype = {
|
||||
if (aUserAction) {
|
||||
this.inspector._layoutViewIsOpen = true;
|
||||
Services.prefs.setBoolPref("devtools.layoutview.open", true);
|
||||
this.view.removeAttribute("disable-transitions");
|
||||
} else {
|
||||
this.view.setAttribute("disable-transitions", "true");
|
||||
}
|
||||
this.iframe.setAttribute("open", "true");
|
||||
this.update();
|
||||
@ -246,6 +275,9 @@ LayoutView.prototype = {
|
||||
if (aUserAction) {
|
||||
this.inspector._layoutViewIsOpen = false;
|
||||
Services.prefs.setBoolPref("devtools.layoutview.open", false);
|
||||
this.view.removeAttribute("disable-transitions");
|
||||
} else {
|
||||
this.view.setAttribute("disable-transitions", "true");
|
||||
}
|
||||
this.iframe.removeAttribute("open");
|
||||
},
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -3,6 +3,12 @@
|
||||
|
||||
// Tests that the developer toolbar works properly
|
||||
|
||||
let imported = {};
|
||||
Components.utils.import("resource:///modules/HUDService.jsm", imported);
|
||||
registerCleanupFunction(function() {
|
||||
imported = {};
|
||||
});
|
||||
|
||||
const URL = "http://example.com/browser/browser/devtools/shared/test/browser_toolbar_basic.html";
|
||||
|
||||
function test() {
|
||||
@ -13,24 +19,106 @@ function test() {
|
||||
}
|
||||
|
||||
function runTest() {
|
||||
Services.obs.addObserver(checkOpen, DeveloperToolbar.NOTIFICATIONS.SHOW, false);
|
||||
// TODO: reopen the window so the pref has a chance to take effect
|
||||
// EventUtils.synthesizeKey("v", { ctrlKey: true, shiftKey: true });
|
||||
DeveloperToolbarTest.show();
|
||||
ok(!DeveloperToolbar.visible, "DeveloperToolbar is not visible in runTest");
|
||||
|
||||
oneTimeObserve(DeveloperToolbar.NOTIFICATIONS.SHOW, catchFail(checkOpen));
|
||||
document.getElementById("Tools:DevToolbar").doCommand();
|
||||
}
|
||||
|
||||
function checkOpen() {
|
||||
Services.obs.removeObserver(checkOpen, DeveloperToolbar.NOTIFICATIONS.SHOW, false);
|
||||
ok(DeveloperToolbar.visible, "DeveloperToolbar is visible");
|
||||
ok(DeveloperToolbar.visible, "DeveloperToolbar is visible in checkOpen");
|
||||
|
||||
Services.obs.addObserver(checkClosed, DeveloperToolbar.NOTIFICATIONS.HIDE, false);
|
||||
// EventUtils.synthesizeKey("v", { ctrlKey: true, shiftKey: true });
|
||||
DeveloperToolbarTest.hide();
|
||||
let close = document.getElementById("developer-toolbar-closebutton");
|
||||
let webconsole = document.getElementById("developer-toolbar-webconsole");
|
||||
let inspector = document.getElementById("developer-toolbar-inspector");
|
||||
let debuggr = document.getElementById("developer-toolbar-debugger");
|
||||
|
||||
ok(close, "Close button exists");
|
||||
|
||||
ok(!webconsole.checked, "web console button state 1");
|
||||
ok(!inspector.checked, "inspector button state 1");
|
||||
ok(!debuggr.checked, "debugger button state 1");
|
||||
|
||||
document.getElementById("Tools:WebConsole").doCommand();
|
||||
|
||||
ok(webconsole.checked, "web console button state 2");
|
||||
ok(!inspector.checked, "inspector button state 2");
|
||||
ok(!debuggr.checked, "debugger button state 2");
|
||||
|
||||
document.getElementById("Tools:Inspect").doCommand();
|
||||
|
||||
ok(webconsole.checked, "web console button state 3");
|
||||
ok(inspector.checked, "inspector button state 3");
|
||||
ok(!debuggr.checked, "debugger button state 3");
|
||||
|
||||
// Christmas tree!
|
||||
|
||||
// The web console opens synchronously, but closes asynchronously.
|
||||
let hud = imported.HUDService.getHudByWindow(content);
|
||||
imported.HUDService.disableAnimation(hud.hudId);
|
||||
|
||||
document.getElementById("Tools:WebConsole").doCommand();
|
||||
|
||||
ok(!webconsole.checked, "web console button state 6");
|
||||
ok(inspector.checked, "inspector button state 6");
|
||||
ok(!debuggr.checked, "debugger button state 6");
|
||||
|
||||
document.getElementById("Tools:Inspect").doCommand();
|
||||
|
||||
ok(!webconsole.checked, "web console button state 7");
|
||||
ok(!inspector.checked, "inspector button state 7");
|
||||
ok(!debuggr.checked, "debugger button state 7");
|
||||
|
||||
// All closed
|
||||
|
||||
// Check we can open and close and retain button state
|
||||
document.getElementById("Tools:Inspect").doCommand();
|
||||
|
||||
ok(!webconsole.checked, "web console button state 8");
|
||||
ok(inspector.checked, "inspector button state 8");
|
||||
ok(!debuggr.checked, "debugger button state 8");
|
||||
|
||||
oneTimeObserve(DeveloperToolbar.NOTIFICATIONS.HIDE, catchFail(checkClosed));
|
||||
document.getElementById("Tools:DevToolbar").doCommand();
|
||||
}
|
||||
|
||||
function checkClosed() {
|
||||
Services.obs.removeObserver(checkClosed, DeveloperToolbar.NOTIFICATIONS.HIDE, false);
|
||||
ok(!DeveloperToolbar.visible, "DeveloperToolbar is not visible");
|
||||
ok(!DeveloperToolbar.visible, "DeveloperToolbar is not visible in checkClosed");
|
||||
|
||||
// Check we grok state even when closed
|
||||
document.getElementById("Tools:WebConsole").doCommand();
|
||||
|
||||
oneTimeObserve(DeveloperToolbar.NOTIFICATIONS.SHOW, catchFail(checkReOpen));
|
||||
document.getElementById("Tools:DevToolbar").doCommand();
|
||||
}
|
||||
|
||||
function checkReOpen() {
|
||||
ok(DeveloperToolbar.visible, "DeveloperToolbar is visible in checkReOpen");
|
||||
|
||||
let webconsole = document.getElementById("developer-toolbar-webconsole");
|
||||
let inspector = document.getElementById("developer-toolbar-inspector");
|
||||
let debuggr = document.getElementById("developer-toolbar-debugger");
|
||||
|
||||
ok(webconsole.checked, "web console button state 9");
|
||||
ok(inspector.checked, "inspector button state 9");
|
||||
ok(!debuggr.checked, "debugger button state 9");
|
||||
|
||||
oneTimeObserve(DeveloperToolbar.NOTIFICATIONS.HIDE, catchFail(checkReClosed));
|
||||
document.getElementById("developer-toolbar-closebutton").doCommand();
|
||||
}
|
||||
|
||||
function checkReClosed() {
|
||||
ok(!DeveloperToolbar.visible, "DeveloperToolbar is not visible in checkReClosed");
|
||||
|
||||
finish();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function oneTimeObserve(name, callback) {
|
||||
var func = function() {
|
||||
Services.obs.removeObserver(func, name);
|
||||
callback();
|
||||
};
|
||||
Services.obs.addObserver(func, name, false);
|
||||
}
|
||||
|
@ -310,12 +310,24 @@ let DeveloperToolbarTest = {
|
||||
testFunc(browser, tab);
|
||||
}
|
||||
catch (ex) {
|
||||
ok(false, "" + ex);
|
||||
ok(false, ex);
|
||||
console.error(ex);
|
||||
finish();
|
||||
throw ex;
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
function catchFail(func) {
|
||||
return function() {
|
||||
try {
|
||||
return func.apply(null, arguments);
|
||||
}
|
||||
catch (ex) {
|
||||
ok(false, ex);
|
||||
console.error(ex);
|
||||
finish();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -768,17 +768,6 @@ var types = require('gcli/types');
|
||||
var Status = require('gcli/types').Status;
|
||||
var BooleanType = require('gcli/types/basic').BooleanType;
|
||||
|
||||
|
||||
/**
|
||||
* A lookup hash of our registered commands
|
||||
*/
|
||||
var commands = {};
|
||||
|
||||
/**
|
||||
* A sorted list of command names, we regularly want them in order, so pre-sort
|
||||
*/
|
||||
var commandNames = [];
|
||||
|
||||
/**
|
||||
* Implement the localization algorithm for any documentation objects (i.e.
|
||||
* description and manual) in a command.
|
||||
@ -1030,6 +1019,21 @@ Object.defineProperty(Parameter.prototype, 'isPositionalAllowed', {
|
||||
canon.Parameter = Parameter;
|
||||
|
||||
|
||||
/**
|
||||
* A lookup hash of our registered commands
|
||||
*/
|
||||
var commands = {};
|
||||
|
||||
/**
|
||||
* A sorted list of command names, we regularly want them in order, so pre-sort
|
||||
*/
|
||||
var commandNames = [];
|
||||
|
||||
/**
|
||||
* A lookup of the original commandSpecs by command name
|
||||
*/
|
||||
var commandSpecs = {};
|
||||
|
||||
/**
|
||||
* Add a command to the canon of known commands.
|
||||
* This function is exposed to the outside world (via gcli/index). It is
|
||||
@ -1038,11 +1042,21 @@ canon.Parameter = Parameter;
|
||||
* @return The new command
|
||||
*/
|
||||
canon.addCommand = function addCommand(commandSpec) {
|
||||
if (commands[commandSpec.name] != null) {
|
||||
// Roughly canon.removeCommand() without the event call, which we do later
|
||||
delete commands[commandSpec.name];
|
||||
commandNames = commandNames.filter(function(test) {
|
||||
return test !== commandSpec.name;
|
||||
});
|
||||
}
|
||||
|
||||
var command = new Command(commandSpec);
|
||||
commands[commandSpec.name] = command;
|
||||
commandNames.push(commandSpec.name);
|
||||
commandNames.sort();
|
||||
|
||||
commandSpecs[commandSpec.name] = commandSpec;
|
||||
|
||||
canon.onCanonChange();
|
||||
return command;
|
||||
};
|
||||
@ -1055,7 +1069,10 @@ canon.removeCommand = function removeCommand(commandOrName) {
|
||||
var name = typeof commandOrName === 'string' ?
|
||||
commandOrName :
|
||||
commandOrName.name;
|
||||
|
||||
// See start of canon.addCommand if changing this code
|
||||
delete commands[name];
|
||||
delete commandSpecs[name];
|
||||
commandNames = commandNames.filter(function(test) {
|
||||
return test !== name;
|
||||
});
|
||||
@ -1089,6 +1106,14 @@ canon.getCommandNames = function getCommandNames() {
|
||||
return commandNames.slice(0);
|
||||
};
|
||||
|
||||
/**
|
||||
* Get access to the stored commandMetaDatas (i.e. before they were made into
|
||||
* instances of Command/Parameters) so we can remote them.
|
||||
*/
|
||||
canon.getCommandSpecs = function getCommandSpecs() {
|
||||
return commandSpecs;
|
||||
};
|
||||
|
||||
/**
|
||||
* Enable people to be notified of changes to the list of commands
|
||||
*/
|
||||
@ -1226,9 +1251,17 @@ exports.createEvent = function(name) {
|
||||
* @param scope Optional 'this' object for the function call
|
||||
*/
|
||||
event.remove = function(func, scope) {
|
||||
var found = false;
|
||||
handlers = handlers.filter(function(test) {
|
||||
return test.func !== func && test.scope !== scope;
|
||||
var noMatch = (test.func !== func && test.scope !== scope);
|
||||
if (!noMatch) {
|
||||
found = true;
|
||||
}
|
||||
return noMatch;
|
||||
});
|
||||
if (!found) {
|
||||
console.warn('Failed to remove handler from ' + name);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
@ -1590,6 +1623,13 @@ exports.createUrlLookup = function(callingModule) {
|
||||
return require('text!gcli/ui/' + path);
|
||||
}
|
||||
catch (ex) {
|
||||
// Under node/unamd callingModule is provided by node. This code isn't
|
||||
// the right answer but it's enough to pass all the unit tests and get
|
||||
// test coverage information, which is all we actually care about here.
|
||||
if (callingModule.filename) {
|
||||
return callingModule.filename + path;
|
||||
}
|
||||
|
||||
var filename = callingModule.id.split('/').pop() + '.js';
|
||||
|
||||
if (callingModule.uri.substr(-filename.length) !== filename) {
|
||||
@ -5000,7 +5040,8 @@ define('gcli/ui/intro', ['require', 'exports', 'module' , 'gcli/settings', 'gcli
|
||||
var hideIntroSettingSpec = {
|
||||
name: 'hideIntro',
|
||||
type: 'boolean',
|
||||
description: l10n.lookup('hideIntroDesc')
|
||||
description: l10n.lookup('hideIntroDesc'),
|
||||
defaultValue: false
|
||||
};
|
||||
var hideIntro;
|
||||
|
||||
@ -5713,6 +5754,9 @@ Requisition.prototype.cloneAssignments = function() {
|
||||
*/
|
||||
Requisition.prototype.getStatus = function() {
|
||||
var status = Status.VALID;
|
||||
if (!this._unassigned.arg.isBlank()) {
|
||||
return Status.ERROR;
|
||||
}
|
||||
this.getAssignments(true).forEach(function(assignment) {
|
||||
var assignStatus = assignment.getStatus();
|
||||
if (assignStatus > status) {
|
||||
@ -6669,9 +6713,21 @@ Output.prototype.toDom = function(element) {
|
||||
}
|
||||
else {
|
||||
if (this.command.returnType === 'terminal') {
|
||||
node = util.createElement(document, 'textarea');
|
||||
node.classList.add('gcli-row-terminal');
|
||||
node.readOnly = true;
|
||||
if (Array.isArray(output)) {
|
||||
node = util.createElement(document, 'div');
|
||||
output.forEach(function() {
|
||||
var child = util.createElement(document, 'textarea');
|
||||
child.classList.add('gcli-row-subterminal');
|
||||
child.readOnly = true;
|
||||
|
||||
node.appendChild(child);
|
||||
});
|
||||
}
|
||||
else {
|
||||
node = util.createElement(document, 'textarea');
|
||||
node.classList.add('gcli-row-terminal');
|
||||
node.readOnly = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
node = util.createElement(document, 'p');
|
||||
@ -6812,7 +6868,6 @@ exports.shutdown = function() {
|
||||
* something else takes focus.
|
||||
* @param options Object containing user customization properties, including:
|
||||
* - blurDelay (default=150ms)
|
||||
* - slowTypingDelay (default=3000ms)
|
||||
* - debug (default=false)
|
||||
* - commandOutputManager (default=canon.commandOutputManager)
|
||||
* @param components Object that links to other UI components. GCLI provided:
|
||||
@ -6838,12 +6893,6 @@ function FocusManager(options, components) {
|
||||
this._helpRequested = false;
|
||||
this._recentOutput = false;
|
||||
|
||||
// Be more helpful if the user pauses
|
||||
// this._slowTyping = false;
|
||||
// this._keyPressTimeout = null;
|
||||
// this._onSlowTyping = this._onSlowTyping.bind(this);
|
||||
// this._slowTypingDelay = options.slowTypingDelay || 3000;
|
||||
|
||||
this.onVisibilityChange = util.createEvent('FocusManager.onVisibilityChange');
|
||||
|
||||
this._focused = this._focused.bind(this);
|
||||
@ -6878,7 +6927,6 @@ FocusManager.prototype.destroy = function() {
|
||||
this._blurDelayTimeout = null;
|
||||
}
|
||||
|
||||
// delete this._onSlowTyping;
|
||||
delete this._focused;
|
||||
delete this._document;
|
||||
delete this._window;
|
||||
@ -6969,8 +7017,6 @@ FocusManager.prototype._reportFocus = function(where) {
|
||||
console.log('FocusManager._reportFocus(' + (where || 'unknown') + ')');
|
||||
}
|
||||
|
||||
// this._resetSlowTypingAlarm();
|
||||
|
||||
if (this._blurDelayTimeout) {
|
||||
if (this._debug) {
|
||||
console.log('FocusManager.cancelBlur');
|
||||
@ -6996,8 +7042,6 @@ FocusManager.prototype._reportBlur = function(where) {
|
||||
console.log('FocusManager._reportBlur(' + where + ')');
|
||||
}
|
||||
|
||||
// this._cancelSlowTypingAlarm();
|
||||
|
||||
if (this._hasFocus) {
|
||||
if (this._blurDelayTimeout) {
|
||||
if (this._debug) {
|
||||
@ -7017,35 +7061,6 @@ FocusManager.prototype._reportBlur = function(where) {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Called on keypress or new focus. Sets off a timer to explode if the user
|
||||
* stops typing.
|
||||
*/
|
||||
FocusManager.prototype._resetSlowTypingAlarm = function() {
|
||||
// this._cancelSlowTypingAlarm();
|
||||
// this._keyPressTimeout = this._window.setTimeout(this._onSlowTyping,
|
||||
// this._slowTypingDelay);
|
||||
};
|
||||
|
||||
/**
|
||||
* Don't kick off a slow typing alarm
|
||||
*/
|
||||
FocusManager.prototype._cancelSlowTypingAlarm = function() {
|
||||
// if (this._keyPressTimeout) {
|
||||
// this._window.clearTimeout(this._keyPressTimeout);
|
||||
// this._keyPressTimeout = null;
|
||||
// }
|
||||
// this._slowTyping = false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Called from the key-press timeout
|
||||
*/
|
||||
FocusManager.prototype._onSlowTyping = function() {
|
||||
// this._slowTyping = true;
|
||||
// this._checkShow();
|
||||
};
|
||||
|
||||
/**
|
||||
* The setting has changed
|
||||
*/
|
||||
@ -7058,8 +7073,6 @@ FocusManager.prototype._eagerHelperChanged = function() {
|
||||
* showing the tooltip element, (or if the keypress is F1, show it now)
|
||||
*/
|
||||
FocusManager.prototype.onInputChange = function(ev) {
|
||||
// this._resetSlowTypingAlarm();
|
||||
// this._slowTyping = false;
|
||||
this._recentOutput = false;
|
||||
this._checkShow();
|
||||
};
|
||||
@ -7073,8 +7086,6 @@ FocusManager.prototype.helpRequest = function() {
|
||||
console.log('FocusManager.helpRequest');
|
||||
}
|
||||
|
||||
// this._cancelSlowTypingAlarm();
|
||||
// this._slowTyping = true;
|
||||
this._helpRequested = true;
|
||||
this._recentOutput = false;
|
||||
this._checkShow();
|
||||
@ -7089,8 +7100,6 @@ FocusManager.prototype.removeHelp = function() {
|
||||
console.log('FocusManager.removeHelp');
|
||||
}
|
||||
|
||||
// this._cancelSlowTypingAlarm();
|
||||
// this._slowTyping = false;
|
||||
this._importantFieldFlag = false;
|
||||
this._isError = false;
|
||||
this._helpRequested = false;
|
||||
@ -7176,10 +7185,6 @@ FocusManager.prototype._shouldShowTooltip = function() {
|
||||
return { visible: true, reason: 'importantFieldFlag' };
|
||||
}
|
||||
|
||||
// if (this._slowTyping) {
|
||||
// return { visible: true, reason: 'slowTyping' };
|
||||
// }
|
||||
|
||||
return { visible: false, reason: 'default' };
|
||||
};
|
||||
|
||||
@ -8007,8 +8012,8 @@ function Menu(options) {
|
||||
*/
|
||||
Menu.prototype.destroy = function() {
|
||||
delete this.element;
|
||||
delete this.items;
|
||||
delete this.template;
|
||||
delete this.document;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -8388,7 +8393,7 @@ var helpCommandSpec = {
|
||||
name: 'search',
|
||||
type: 'string',
|
||||
description: l10n.lookup('helpSearchDesc'),
|
||||
manual: l10n.lookup('helpSearchManual'),
|
||||
manual: l10n.lookup('helpSearchManual2'),
|
||||
defaultValue: null
|
||||
}
|
||||
],
|
||||
@ -9463,7 +9468,8 @@ History.prototype.backward = function() {
|
||||
|
||||
exports.History = History;
|
||||
|
||||
});define("text!gcli/ui/inputter.css", [], "");
|
||||
});
|
||||
define("text!gcli/ui/inputter.css", [], "");
|
||||
|
||||
/*
|
||||
* Copyright 2009-2011 Mozilla Foundation and contributors
|
||||
@ -9829,8 +9835,6 @@ Tooltip.prototype.destroy = function() {
|
||||
delete this.descriptionEle;
|
||||
delete this.highlightEle;
|
||||
|
||||
delete this.field;
|
||||
delete this.focusManager;
|
||||
delete this.document;
|
||||
delete this.element;
|
||||
delete this.panelElement;
|
||||
|
@ -1,4 +1,4 @@
|
||||
<!-- LOCALIZATION NOTE : FILE This file contains the Script Debugger strings -->
|
||||
<!-- LOCALIZATION NOTE : FILE This file contains the Debugger strings -->
|
||||
<!-- LOCALIZATION NOTE : FILE Do not translate commandkey -->
|
||||
|
||||
<!-- LOCALIZATION NOTE : FILE The correct localization of this file might be to
|
||||
@ -9,7 +9,7 @@
|
||||
|
||||
<!-- LOCALIZATION NOTE (debuggerMenu.label): This is the label for the
|
||||
- application menu item that opens the debugger UI. -->
|
||||
<!ENTITY debuggerMenu.label "Script Debugger">
|
||||
<!ENTITY debuggerMenu.label2 "Debugger">
|
||||
|
||||
<!-- LOCALIZATION NOTE (remoteDebuggerMenu.label): This is the label for the
|
||||
- application menu item that opens the remote debugger UI. -->
|
||||
|
@ -1,5 +1,5 @@
|
||||
# LOCALIZATION NOTE These strings are used inside the Script Debugger
|
||||
# which is available from the Web Developer sub-menu -> 'Script Debugger'.
|
||||
# LOCALIZATION NOTE These strings are used inside the Debugger
|
||||
# which is available from the Web Developer sub-menu -> 'Debugger'.
|
||||
# The correct localization of this file might be to keep it in
|
||||
# English, or another language commonly spoken among web developers.
|
||||
# You want to make that choice consistent across the developer tools.
|
||||
|
@ -105,15 +105,16 @@ helpDesc=Get help on the available commands
|
||||
helpManual=Provide help either on a specific command (if a search string is provided and an exact match is found) or on the available commands (if a search string is not provided, or if no exact match is found).
|
||||
|
||||
# LOCALIZATION NOTE (helpSearchDesc): A very short description of the 'search'
|
||||
# parameter to the 'help' command. See helpSearchManual for a fuller
|
||||
# parameter to the 'help' command. See helpSearchManual2 for a fuller
|
||||
# description of what it does. This string is designed to be shown in a dialog
|
||||
# with restricted space, which is why it should be as short as possible.
|
||||
helpSearchDesc=Search string
|
||||
|
||||
# LOCALIZATION NOTE (helpSearchManual): A fuller description of the 'search'
|
||||
# LOCALIZATION NOTE (helpSearchManual2): A fuller description of the 'search'
|
||||
# parameter to the 'help' command. Displayed when the user asks for help on
|
||||
# what it does.
|
||||
helpSearchManual=<strong>search string</strong> to use in narrowing down the displayed commands. Regular expressions not supported.
|
||||
# what it does. Inline HTML (e.g. <strong>) can be used to emphasize the core
|
||||
# concept.
|
||||
helpSearchManual2=<strong>search string</strong> to use in narrowing down the displayed commands. Regular expressions not supported.
|
||||
|
||||
# LOCALIZATION NOTE (helpManSynopsis): A heading shown at the top of a help
|
||||
# page for a command in the console It labels a summary of the parameters to
|
||||
@ -220,6 +221,28 @@ prefSetCheckBody=Changing these advanced settings can be harmful to the stabilit
|
||||
# prefSetCheckBody
|
||||
prefSetCheckGo=I'll be careful, I promise!
|
||||
|
||||
# LOCALIZATION NOTE (prefResetDesc): A very short description of the 'pref
|
||||
# reset' command. This string is designed to be shown in a menu alongside the
|
||||
# command name, which is why it should be as short as possible. See
|
||||
# prefResetManual for a fuller description of what it does.
|
||||
prefResetDesc=Reset a setting
|
||||
|
||||
# LOCALIZATION NOTE (prefResetManual): A fuller description of the 'pref
|
||||
# reset' command. Displayed when the user asks for help on what it does.
|
||||
prefResetManual=Reset the value of a setting to the system defaults
|
||||
|
||||
# LOCALIZATION NOTE (prefResetSettingDesc): A short description of the
|
||||
# 'setting' parameter to the 'pref reset' command. See prefResetSettingManual
|
||||
# for a fuller description of what it does. This string is designed to be
|
||||
# shown in a dialog with restricted space, which is why it should be as short
|
||||
# as possible.
|
||||
prefResetSettingDesc=Setting to reset
|
||||
|
||||
# LOCALIZATION NOTE (prefResetSettingManual): A fuller description of the
|
||||
# 'setting' parameter to the 'pref reset' command. Displayed when the user
|
||||
# asks for help on what it does.
|
||||
prefResetSettingManual=The name of the setting to reset to the system default value
|
||||
|
||||
# LOCALIZATION NOTE (prefOutputFilter): Displayed in the output from the 'pref
|
||||
# list' command as a label to an input element that allows the user to filter
|
||||
# the results
|
||||
@ -235,6 +258,16 @@ prefOutputName=Name
|
||||
# available preferences
|
||||
prefOutputValue=Value
|
||||
|
||||
# LOCALIZATION NOTE (introDesc): A very short description of the 'intro'
|
||||
# command. This string is designed to be shown in a menu alongside the command
|
||||
# name, which is why it should be as short as possible. See introManual for a
|
||||
# fuller description of what it does.
|
||||
introDesc=Show the opening message
|
||||
|
||||
# LOCALIZATION NOTE (introManual): A fuller description of the 'intro'
|
||||
# command. Displayed when the user asks for help on what it does.
|
||||
introManual=Redisplay the message that is shown to new users until they click the 'Got it!' button
|
||||
|
||||
# LOCALIZATION NOTE (hideIntroDesc): Short description of the 'hideIntro'
|
||||
# setting. Displayed when the user asks for help on the settings.
|
||||
hideIntroDesc=Show the initial welcome message
|
||||
|
@ -222,7 +222,10 @@ IDBDatabase::Invalidate()
|
||||
// When the IndexedDatabaseManager needs to invalidate databases, all it has
|
||||
// is an origin, so we call back into the manager to cancel any prompts for
|
||||
// our owner.
|
||||
IndexedDatabaseManager::CancelPromptsForWindow(GetOwner());
|
||||
nsPIDOMWindow* owner = GetOwner();
|
||||
if (owner) {
|
||||
IndexedDatabaseManager::CancelPromptsForWindow(owner);
|
||||
}
|
||||
|
||||
mInvalidated = true;
|
||||
}
|
||||
@ -284,8 +287,6 @@ void
|
||||
IDBDatabase::OnUnlink()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
NS_ASSERTION(!GetOwner() && !GetScriptOwner(),
|
||||
"Should have been cleared already!");
|
||||
|
||||
// We've been unlinked, at the very least we should be able to prevent further
|
||||
// transactions from starting and unblock any other SetVersion callers.
|
||||
@ -680,7 +681,8 @@ IDBDatabase::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
|
||||
{
|
||||
NS_ENSURE_TRUE(aVisitor.mDOMEvent, NS_ERROR_UNEXPECTED);
|
||||
|
||||
if (!GetOwner()) {
|
||||
nsPIDOMWindow* owner = GetOwner();
|
||||
if (!owner) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -694,7 +696,7 @@ IDBDatabase::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
|
||||
CreateGenericEvent(type, eDoesNotBubble, eNotCancelable);
|
||||
NS_ENSURE_STATE(duplicateEvent);
|
||||
|
||||
nsCOMPtr<nsIDOMEventTarget> target(do_QueryInterface(GetOwner()));
|
||||
nsCOMPtr<nsIDOMEventTarget> target(do_QueryInterface(owner));
|
||||
NS_ASSERTION(target, "How can this happen?!");
|
||||
|
||||
bool dummy;
|
||||
|
Loading…
Reference in New Issue
Block a user