TOP-9999999-port1646560-suite-91a1.patch 4.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. # HG changeset patch
  2. # User Bill Gianopoulos <wgianopoulos@gmail.com>
  3. # Date 1623804470 0
  4. # Parent 5baac9de16364064c2579f094bd64c65f13a7931
  5. Bug 9999999 - Port Bug 1646560 - Move allowJavascript and friends from DocShell to BrowsingContext and WindowContext.
  6. diff --git a/suite/base/content/nsContextMenu.js b/suite/base/content/nsContextMenu.js
  7. --- a/suite/base/content/nsContextMenu.js
  8. +++ b/suite/base/content/nsContextMenu.js
  9. @@ -56,17 +56,17 @@ nsContextMenu.prototype = {
  10. // Get contextual info.
  11. this.setTarget(document.popupNode, document.popupRangeParent,
  12. document.popupRangeOffset);
  13. if (!this.shouldDisplay)
  14. return;
  15. this.hasPageMenu = false;
  16. - if (!aIsShift && this.browser.docShell.allowJavascript &&
  17. + if (!aIsShift && this.browser.browsingContext.allowJavascript &&
  18. Services.prefs.getBoolPref("javascript.enabled"))
  19. this.hasPageMenu = PageMenuParent.buildAndAddToPopup(this.target, aXulMenu);
  20. this.isTextSelected = this.isTextSelection();
  21. this.isContentSelected = this.isContentSelection();
  22. // Initialize gContextMenuContentData.
  23. if (aEvent)
  24. diff --git a/suite/components/helpviewer/content/help.js b/suite/components/helpviewer/content/help.js
  25. --- a/suite/components/helpviewer/content/help.js
  26. +++ b/suite/components/helpviewer/content/help.js
  27. @@ -110,17 +110,17 @@ function init() {
  28. // Cache panel references.
  29. helpSearchPanel = document.getElementById("help-search-panel");
  30. helpTocPanel = document.getElementById("help-toc-panel");
  31. helpIndexPanel = document.getElementById("help-index-panel");
  32. helpGlossaryPanel = document.getElementById("help-glossary-panel");
  33. helpBrowser = document.getElementById("help-content");
  34. // Turn off unnecessary features for security
  35. - helpBrowser.docShell.allowJavascript = false;
  36. + helpBrowser.browsingContext.allowJavascript = false;
  37. helpBrowser.docShell.allowPlugins = false;
  38. helpBrowser.docShell.allowSubframes = false;
  39. helpBrowser.docShell.allowMetaRedirects = false;
  40. strBundle = document.getElementById("bundle_help");
  41. emptySearchText = strBundle.getString("emptySearchText");
  42. // Get the content pack, base URL, and help topic
  43. diff --git a/suite/components/sessionstore/nsSessionStore.js b/suite/components/sessionstore/nsSessionStore.js
  44. --- a/suite/components/sessionstore/nsSessionStore.js
  45. +++ b/suite/components/sessionstore/nsSessionStore.js
  46. @@ -65,17 +65,17 @@ const WINDOW_HIDEABLE_FEATURES = [
  47. docShell capabilities to (re)store
  48. Restored in restoreHistory()
  49. eg: browser.docShell["allow" + aCapability] = false;
  50. XXX keep these in sync with all the attributes starting
  51. with "allow" in /docshell/base/nsIDocShell.idl
  52. */
  53. const CAPABILITIES = [
  54. - "Subframes", "Plugins", "Javascript", "MetaRedirects", "Images",
  55. + "Subframes", "Plugins", "MetaRedirects", "Images",
  56. "DNSPrefetch", "Auth", "WindowControl"
  57. ];
  58. // These are tab events that we listen to.
  59. const TAB_EVENTS = ["TabOpen", "TabClose", "TabSelect", "TabShow", "TabHide"];
  60. var {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
  61. var {NetUtil} = ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
  62. diff --git a/suite/components/tests/browser/browser_493467.js b/suite/components/tests/browser/browser_493467.js
  63. --- a/suite/components/tests/browser/browser_493467.js
  64. +++ b/suite/components/tests/browser/browser_493467.js
  65. @@ -18,17 +18,17 @@ function test() {
  66. is(browserWindowsCount(), 1, "Only one browser window should be open initially");
  67. let tab = getBrowser().addTab();
  68. tab.linkedBrowser.stop();
  69. let tabState = JSON.parse(ss.getTabState(tab));
  70. is(tabState.disallow || "", "", "Everything is allowed per default");
  71. // collect all permissions that can be set on a docShell (i.e. all
  72. - // attributes starting with "allow" such as "allowJavascript") and
  73. + // attributes starting with "allow" such as "allowImages") and
  74. // disallow them all, as SessionStore only remembers disallowed ones
  75. let permissions = [];
  76. let docShell = tab.linkedBrowser.docShell;
  77. for (let attribute in docShell) {
  78. if (/^allow([A-Z].*)/.test(attribute)) {
  79. permissions.push(RegExp.$1);
  80. docShell[attribute] = false;
  81. }