Loading browser/base/content/test/newtab/Makefile.in +1 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ _BROWSER_FILES = \ browser_newtab_reset.js \ browser_newtab_tabsync.js \ browser_newtab_unpin.js \ browser_newtab_bug722273.js \ browser_newtab_bug723102.js \ browser_newtab_bug723121.js \ head.js \ Loading browser/base/content/test/newtab/browser_newtab_bug722273.js 0 → 100644 +62 −0 Original line number Diff line number Diff line /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ const NOW = Date.now() * 1000; const URL = "http://fake-site.com/"; let tmp = {}; Cu.import("resource:///modules/NewTabUtils.jsm", tmp); Cc["@mozilla.org/moz/jssubscript-loader;1"] .getService(Ci.mozIJSSubScriptLoader) .loadSubScript("chrome://browser/content/sanitize.js", tmp); let {NewTabUtils, Sanitizer} = tmp; let bhist = Cc["@mozilla.org/browser/global-history;2"] .getService(Ci.nsIBrowserHistory); function runTests() { clearHistory(); fillHistory(); yield addNewTabPageTab(); is(cells[0].site.url, URL, "first site is our fake site"); let page = { update: function () { executeSoon(TestRunner.next); }, observe: function () {} }; NewTabUtils.allPages.register(page); yield clearHistory(); NewTabUtils.allPages.unregister(page); ok(!cells[0].site, "the fake site is gone"); } function fillHistory() { let uri = makeURI(URL); for (let i = 59; i > 0; i--) bhist.addPageWithDetails(uri, "fake site", NOW - i * 60 * 1000000); } function clearHistory() { let s = new Sanitizer(); s.prefDomain = "privacy.cpd."; let prefs = gPrefService.getBranch(s.prefDomain); prefs.setBoolPref("history", true); prefs.setBoolPref("downloads", false); prefs.setBoolPref("cache", false); prefs.setBoolPref("cookies", false); prefs.setBoolPref("formdata", false); prefs.setBoolPref("offlineApps", false); prefs.setBoolPref("passwords", false); prefs.setBoolPref("sessions", false); prefs.setBoolPref("siteSettings", false); s.sanitize(); } browser/base/content/test/newtab/head.js +6 −3 Original line number Diff line number Diff line Loading @@ -129,10 +129,11 @@ function addNewTabPageTab() { cw = browser.contentWindow; if (NewTabUtils.allPages.enabled) { cells = cw.gGrid.cells; // Continue when the link cache has been populated. NewTabUtils.links.populateCache(TestRunner.next); NewTabUtils.links.populateCache(function () { cells = cw.gGrid.cells; executeSoon(TestRunner.next); }); } else { TestRunner.next(); } Loading Loading @@ -246,6 +247,8 @@ function unpinCell(aCell) { */ function simulateDrop(aDropTarget, aDragSource) { let event = { clientX: 0, clientY: 0, dataTransfer: { mozUserCancelled: false, setData: function () null, Loading browser/devtools/styleinspector/CssRuleView.jsm +25 −2 Original line number Diff line number Diff line Loading @@ -732,6 +732,24 @@ CssRuleView.prototype = { }.bind(this); this._createEditors(); // When creating a new property, we fake the normal property // editor behavior (focusing a property's value after entering its // name) by responding to the name's blur event, creating the // value editor, and grabbing focus to the value editor. But if // focus has already moved to another document, we won't be able // to move focus to the new editor. // Create a focusable item at the end of the editors to catch these // cases. this._focusBackstop = createChild(this.element, "div", { tabindex: 0, }); this._backstopHandler = function() { // If this item is actually focused long enough to get the focus // event, allow focus to move on out of this document. moveFocus(this.doc.defaultView, FOCUS_FORWARD); }.bind(this); this._focusBackstop.addEventListener("focus", this._backstopHandler, false); }, /** Loading Loading @@ -762,6 +780,12 @@ CssRuleView.prototype = { this._clearRules(); this._viewedElement = null; this._elementStyle = null; if (this._focusBackstop) { this._focusBackstop.removeEventListener("focus", this._backstopHandler, false); this._backstopHandler = null; this._focusBackstop = null; } }, /** Loading Loading @@ -845,7 +869,6 @@ RuleEditor.prototype = { this.openBrace = createChild(header, "span", { class: "ruleview-ruleopen", tabindex: "0", textContent: " {" }); Loading browser/devtools/styleinspector/test/Makefile.in +1 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,7 @@ _BROWSER_TEST_FILES = \ browser_ruleview_manipulation.js \ browser_ruleview_override.js \ browser_ruleview_ui.js \ browser_ruleview_focus.js \ browser_bug705707_is_content_stylesheet.js \ browser_bug722196_property_view_media_queries.js \ browser_bug722196_rule_view_media_queries.js \ Loading Loading
browser/base/content/test/newtab/Makefile.in +1 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ _BROWSER_FILES = \ browser_newtab_reset.js \ browser_newtab_tabsync.js \ browser_newtab_unpin.js \ browser_newtab_bug722273.js \ browser_newtab_bug723102.js \ browser_newtab_bug723121.js \ head.js \ Loading
browser/base/content/test/newtab/browser_newtab_bug722273.js 0 → 100644 +62 −0 Original line number Diff line number Diff line /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ const NOW = Date.now() * 1000; const URL = "http://fake-site.com/"; let tmp = {}; Cu.import("resource:///modules/NewTabUtils.jsm", tmp); Cc["@mozilla.org/moz/jssubscript-loader;1"] .getService(Ci.mozIJSSubScriptLoader) .loadSubScript("chrome://browser/content/sanitize.js", tmp); let {NewTabUtils, Sanitizer} = tmp; let bhist = Cc["@mozilla.org/browser/global-history;2"] .getService(Ci.nsIBrowserHistory); function runTests() { clearHistory(); fillHistory(); yield addNewTabPageTab(); is(cells[0].site.url, URL, "first site is our fake site"); let page = { update: function () { executeSoon(TestRunner.next); }, observe: function () {} }; NewTabUtils.allPages.register(page); yield clearHistory(); NewTabUtils.allPages.unregister(page); ok(!cells[0].site, "the fake site is gone"); } function fillHistory() { let uri = makeURI(URL); for (let i = 59; i > 0; i--) bhist.addPageWithDetails(uri, "fake site", NOW - i * 60 * 1000000); } function clearHistory() { let s = new Sanitizer(); s.prefDomain = "privacy.cpd."; let prefs = gPrefService.getBranch(s.prefDomain); prefs.setBoolPref("history", true); prefs.setBoolPref("downloads", false); prefs.setBoolPref("cache", false); prefs.setBoolPref("cookies", false); prefs.setBoolPref("formdata", false); prefs.setBoolPref("offlineApps", false); prefs.setBoolPref("passwords", false); prefs.setBoolPref("sessions", false); prefs.setBoolPref("siteSettings", false); s.sanitize(); }
browser/base/content/test/newtab/head.js +6 −3 Original line number Diff line number Diff line Loading @@ -129,10 +129,11 @@ function addNewTabPageTab() { cw = browser.contentWindow; if (NewTabUtils.allPages.enabled) { cells = cw.gGrid.cells; // Continue when the link cache has been populated. NewTabUtils.links.populateCache(TestRunner.next); NewTabUtils.links.populateCache(function () { cells = cw.gGrid.cells; executeSoon(TestRunner.next); }); } else { TestRunner.next(); } Loading Loading @@ -246,6 +247,8 @@ function unpinCell(aCell) { */ function simulateDrop(aDropTarget, aDragSource) { let event = { clientX: 0, clientY: 0, dataTransfer: { mozUserCancelled: false, setData: function () null, Loading
browser/devtools/styleinspector/CssRuleView.jsm +25 −2 Original line number Diff line number Diff line Loading @@ -732,6 +732,24 @@ CssRuleView.prototype = { }.bind(this); this._createEditors(); // When creating a new property, we fake the normal property // editor behavior (focusing a property's value after entering its // name) by responding to the name's blur event, creating the // value editor, and grabbing focus to the value editor. But if // focus has already moved to another document, we won't be able // to move focus to the new editor. // Create a focusable item at the end of the editors to catch these // cases. this._focusBackstop = createChild(this.element, "div", { tabindex: 0, }); this._backstopHandler = function() { // If this item is actually focused long enough to get the focus // event, allow focus to move on out of this document. moveFocus(this.doc.defaultView, FOCUS_FORWARD); }.bind(this); this._focusBackstop.addEventListener("focus", this._backstopHandler, false); }, /** Loading Loading @@ -762,6 +780,12 @@ CssRuleView.prototype = { this._clearRules(); this._viewedElement = null; this._elementStyle = null; if (this._focusBackstop) { this._focusBackstop.removeEventListener("focus", this._backstopHandler, false); this._backstopHandler = null; this._focusBackstop = null; } }, /** Loading Loading @@ -845,7 +869,6 @@ RuleEditor.prototype = { this.openBrace = createChild(header, "span", { class: "ruleview-ruleopen", tabindex: "0", textContent: " {" }); Loading
browser/devtools/styleinspector/test/Makefile.in +1 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,7 @@ _BROWSER_TEST_FILES = \ browser_ruleview_manipulation.js \ browser_ruleview_override.js \ browser_ruleview_ui.js \ browser_ruleview_focus.js \ browser_bug705707_is_content_stylesheet.js \ browser_bug722196_property_view_media_queries.js \ browser_bug722196_rule_view_media_queries.js \ Loading