From fe0509a62ee652a1261ba31f19ff198102c49b2f Mon Sep 17 00:00:00 2001 From: roytam1 Date: Fri, 1 Apr 2022 23:06:55 +0800 Subject: [PATCH] import changes from `dev' branch of rmottola/Arctic-Fox: - Bug 904479 - Added createPromiseWithId() that returns id of resolver r=kanru,nsm (2ac672d882) - Bug 1166580 - Disable mozHasPendingMessage tests on non-browser platform. r=me (03c689964b) - Bug 1162281 - Invalid system message handler in an App Manifest can break the entire system. r=fabrice (e192a95f9c) - Bug 1198988 - Turn off some useless dump() calls r=ferjm (34fc83b236) - Bug 1164498: Remove |DispatchBluetoothReply|, r=btian (6143335efa) - Bug 1001757 - Add ability to store core apps outside of profile on desktop b2g; r=fabrice (f6b605e7aa) - Bug 1155245 - Set the app status correctly for hosted certified apps in developer mode. r=fabrice (131178b80e) - Bug 1179052 - Add some raptor markers to b2g gecko startup r=gwagner (222256fad8) - Bug 1163904 - handle -url command line argument. r=fabrice (ee61af1ff9) - Bug 1167275 - JS error in shell.js handleCmdLine() r=me (32e75c604f) - Bug 1167197 - Fix GMPProvider on Android r=cpearce Bug 1181209 - Make changes to Gecko needed for b2gdroid to boot. r=fabrice (b35d3a372f) - Bug 1158544 - Remove FTPChannelChild::mWasOpened and make the base class mWasOpened protected; r=mcmanus (9111e1bc00) - Bug 1171716 - Part 2: Use NS_ReleaseOnMainThread in nsBaseChannel. r=froydnj (f138124f14) - partial of Bug 1177175 - Add a UITour target inside the TP panel. (603cc719b3) - Bug 1175545 - Dont process alt-svc on 421 r=hurley (ad0f2f6e91) - Bug 1191291 - convert nsHttpChannel::RetargetDeliveryTo warning to log r=michal.novotny (b9c6003df8) - Bug 1182487 - Don't try to write to HTTP cache entry in nsHttpChannel when entry is open for reading only. r=michal (b36d7014a0) - Bug 1173069 - Don't accumulate the cache hit telemetry for intercepted channels; r=mayhemer,jdm (aaed79183d) - Bug 1208755 HttpBaseChannel::ShouldIntercept() should not assume every channel has a LoadInfo. r=ckerschb (d55be94901) - Bug 1201229 - Return an empty string for a header when an error occurs; r=dragana (256d0462c8) - Bug 1048048 - add preload content policy types - web platform test updates (r=dveditz) (baa1004dd6) - Bug 1048048 - add preload content policy types - csp changes (r=dveditz) (17914dadba) - Bug 1048048 - add preload content policy types for stylesheets (r=cam) (29af13263a) - Bug 1048048 - add preload content policy types (r=ehsan) (f58a32d51b) - Bug 1201747 - Don't inspect the subject principal in StorageAllowedForPrincipal. r=mystor (4f2c100882) - Bug 1176829 - Remove custom elements base element queue. r=smaug (03a520c13d) - Bug 1176829 follow-up, finish removing unused member to fix bustage. CLOSED TREE (29c6150af8) - Bug 1179909: Build fix. r=me CLOSED TREE (40e3bdb971) - Bug 1188932 - Allow the User-Agent header to be explicitly set by requests, r=bkelly, r=jgraham (37aacbd37d) --- b2g/chrome/content/settings.js | 2 + b2g/chrome/content/shell.html | 9 +- b2g/chrome/content/shell.js | 39 ++- b2g/components/B2GComponents.manifest | 7 + b2g/components/CommandLine.js | 4 + b2g/components/DirectoryProvider.js | 26 +- b2g/components/moz.build | 10 +- build/pgo/certs/cert8.db | Bin 65536 -> 65536 bytes build/pgo/certs/key3.db | Bin 114688 -> 176128 bytes build/pgo/server-locations.txt | 11 +- configure.in | 4 + dom/apps/Webapps.js | 64 ++--- dom/apps/Webapps.jsm | 69 ++++-- dom/base/DOMRequestHelper.jsm | 11 + dom/base/nsContentPolicyUtils.h | 75 +++--- dom/base/nsContentUtils.cpp | 40 ++- dom/base/nsDocument.cpp | 63 +---- dom/base/nsDocument.h | 8 +- dom/base/nsIContentPolicy.idl | 2 +- dom/base/nsIContentPolicyBase.idl | 2 +- dom/base/test/file_explicit_user_agent.sjs | 8 + dom/base/test/mochitest.ini | 2 + dom/base/test/test_domrequesthelper.xul | 12 + dom/base/test/test_explicit_user_agent.html | 65 +++++ dom/base/test/test_xhr_forbidden_headers.html | 1 - dom/bluetooth/bluez/BluetoothDBusService.cpp | 8 +- dom/bluetooth/common/BluetoothUtils.cpp | 33 +-- dom/bluetooth/common/BluetoothUtils.h | 9 - dom/cache/DBSchema.cpp | 7 +- dom/engineeringmode/EngineeringModeAPI.js | 22 +- dom/fetch/InternalRequest.cpp | 7 +- dom/fetch/InternalRequest.h | 6 +- dom/inputmethod/MozKeyboard.js | 17 +- dom/messages/SystemMessageInternal.js | 71 +++--- .../interfaces/nsISystemMessagesInternal.idl | 6 +- dom/messages/test/chrome.ini | 11 +- dom/messages/test/invalid_manifest.webapp | 8 + .../test/invalid_manifest.webapp^headers^ | 1 + dom/messages/test/manifest.webapp | 9 + dom/messages/test/manifest.webapp^headers^ | 1 + dom/messages/test/test_hasPendingMessage.html | 16 +- .../test/test_sysmsg_registration.html | 232 ++++++++++++++++++ dom/nfc/nsNfc.js | 7 +- .../PresentationDeviceInfoManager.js | 5 +- dom/requestsync/RequestSyncManager.js | 5 +- dom/requestsync/RequestSyncScheduler.js | 5 +- dom/resourcestats/ResourceStatsManager.js | 28 +-- dom/secureelement/DOMSecureElement.js | 8 +- dom/security/nsCSPContext.cpp | 31 +-- dom/security/nsCSPService.cpp | 10 +- dom/security/test/cors/test_CrossSiteXHR.html | 9 + dom/system/SystemUpdateManager.js | 15 +- dom/tests/mochitest/fetch/test_fetch_cors.js | 9 + .../fetch/test_headers_mainthread.html | 156 ++++++++++++ .../mochitest/general/frameStorageChrome.html | 3 +- .../general/storagePermissionsUtils.js | 31 ++- .../test_storagePermissionsAccept.html | 4 +- .../test_storagePermissionsLimitForeign.html | 10 +- .../test_storagePermissionsReject.html | 7 +- .../test_storagePermissionsRejectForeign.html | 6 +- dom/tethering/TetheringManager.js | 17 +- dom/xbl/nsXBLResourceLoader.cpp | 2 +- dom/xslt/xslt/txMozillaStylesheetCompiler.cpp | 6 +- editor/libeditor/nsHTMLEditor.cpp | 2 +- hal/android/AndroidHal.cpp | 9 +- layout/style/Loader.cpp | 46 ++-- layout/style/Loader.h | 11 +- modules/libjar/nsJARChannel.cpp | 2 +- netwerk/base/nsBaseChannel.cpp | 11 +- netwerk/base/nsBaseChannel.h | 2 +- netwerk/protocol/ftp/FTPChannelChild.cpp | 1 - netwerk/protocol/ftp/FTPChannelChild.h | 3 +- netwerk/protocol/http/HttpBaseChannel.cpp | 6 +- netwerk/protocol/http/NullHttpChannel.cpp | 2 + netwerk/protocol/http/nsCORSListenerProxy.cpp | 3 - netwerk/protocol/http/nsHttpChannel.cpp | 10 +- .../viewsource/nsViewSourceChannel.cpp | 5 +- services/moz.build | 2 +- .../style-src/style-src-3_4.html.ini | 5 - toolkit/devtools/server/actors/styleeditor.js | 2 +- toolkit/devtools/server/actors/stylesheets.js | 6 +- .../extensions/internal/GMPProvider.jsm | 77 +++++- .../test/xpcshell/test_gmpProvider.js | 46 +++- 83 files changed, 1117 insertions(+), 506 deletions(-) create mode 100644 dom/base/test/file_explicit_user_agent.sjs create mode 100644 dom/base/test/test_explicit_user_agent.html create mode 100644 dom/messages/test/invalid_manifest.webapp create mode 100644 dom/messages/test/invalid_manifest.webapp^headers^ create mode 100644 dom/messages/test/manifest.webapp create mode 100644 dom/messages/test/manifest.webapp^headers^ create mode 100644 dom/messages/test/test_sysmsg_registration.html create mode 100644 dom/tests/mochitest/fetch/test_headers_mainthread.html delete mode 100644 testing/web-platform/meta/content-security-policy/style-src/style-src-3_4.html.ini diff --git a/b2g/chrome/content/settings.js b/b2g/chrome/content/settings.js index 49a9fc850e..8e94af6830 100644 --- a/b2g/chrome/content/settings.js +++ b/b2g/chrome/content/settings.js @@ -6,6 +6,8 @@ "use strict"; +window.performance.mark('gecko-settings-loadstart'); + const Cc = Components.classes; const Ci = Components.interfaces; const Cu = Components.utils; diff --git a/b2g/chrome/content/shell.html b/b2g/chrome/content/shell.html index a1941da8c2..7d2b620fc7 100644 --- a/b2g/chrome/content/shell.html +++ b/b2g/chrome/content/shell.html @@ -3,7 +3,7 @@ - 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/. --> - #endif - + -#ifndef MOZ_WIDGET_GONK +#ifndef ANDROID diff --git a/b2g/chrome/content/shell.js b/b2g/chrome/content/shell.js index a410c1be05..b251dd25e3 100644 --- a/b2g/chrome/content/shell.js +++ b/b2g/chrome/content/shell.js @@ -4,6 +4,8 @@ * 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/. */ +window.performance.mark('gecko-shell-loadstart'); + Cu.import('resource://gre/modules/ContactService.jsm'); Cu.import('resource://gre/modules/DataStoreChangeNotifier.jsm'); Cu.import('resource://gre/modules/AlarmService.jsm'); @@ -73,6 +75,8 @@ XPCOMUtils.defineLazyServiceGetter(Services, 'captivePortalDetector', '@mozilla.org/toolkit/captive-detector;1', 'nsICaptivePortalDetector'); +window.performance.measure('gecko-shell-jsm-loaded', 'gecko-shell-loadstart'); + function getContentWindow() { return shell.contentBrowser.contentWindow; } @@ -214,6 +218,12 @@ var shell = { }, bootstrap: function() { +#ifdef MOZ_B2GDROID + Cc["@mozilla.org/b2g/b2gdroid-setup;1"] + .getService(Ci.nsIObserver).observe(window, "shell-startup", null); +#endif + + window.performance.mark('gecko-shell-bootstrap'); let startManifestURL = Cc['@mozilla.org/commandlinehandler/general-startup;1?type=b2gbootstrap'] .getService(Ci.nsISupports).wrappedJSObject.startManifestURL; @@ -228,6 +238,7 @@ var shell = { }, start: function shell_start() { + window.performance.mark('gecko-shell-start'); this._started = true; // This forces the initialization of the cookie service before we hit the @@ -347,6 +358,8 @@ var shell = { this.contentBrowser.src = homeURL; this.isHomeLoaded = false; + window.performance.mark('gecko-shell-system-frame-set'); + ppmm.addMessageListener("content-handler", this); ppmm.addMessageListener("dial-handler", this); ppmm.addMessageListener("sms-handler", this); @@ -613,6 +626,7 @@ var shell = { }, notifyContentStart: function shell_notifyContentStart() { + window.performance.mark('gecko-shell-notify-content-start'); this.contentBrowser.removeEventListener('mozbrowserloadstart', this, true); this.contentBrowser.removeEventListener('mozbrowserlocationchange', this, true); @@ -650,7 +664,28 @@ var shell = { } delete shell.pendingChromeEvents; }); - } + + shell.handleCmdLine(); + }, + + handleCmdLine: function shell_handleCmdLine() { + // This isn't supported on devices. +#ifndef ANDROID + let b2gcmds = Cc["@mozilla.org/commandlinehandler/general-startup;1?type=b2gcmds"] + .getService(Ci.nsISupports); + let args = b2gcmds.wrappedJSObject.cmdLine; + try { + // Returns null if -url is not present + let url = args.handleFlagWithParam("url", false); + if (url) { + this.sendChromeEvent({type: "mozbrowseropenwindow", url}); + args.preventDefault = true; + } + } catch(e) { + // Throws if -url is present with no params + } +#endif + }, }; Services.obs.addObserver(function onFullscreenOriginChange(subject, topic, data) { @@ -905,6 +940,7 @@ window.addEventListener('ContentStart', function update_onContentStart() { Cu.import('resource://gre/modules/WebappsUpdater.jsm'); WebappsUpdater.handleContentStart(shell); +#ifdef MOZ_UPDATER let promptCc = Cc["@mozilla.org/updates/update-prompt;1"]; if (!promptCc) { return; @@ -916,6 +952,7 @@ window.addEventListener('ContentStart', function update_onContentStart() { } updatePrompt.wrappedJSObject.handleContentStart(shell); +#endif }); (function geolocationStatusTracker() { diff --git a/b2g/components/B2GComponents.manifest b/b2g/components/B2GComponents.manifest index 9f2ca1141a..f670b53f59 100644 --- a/b2g/components/B2GComponents.manifest +++ b/b2g/components/B2GComponents.manifest @@ -16,10 +16,15 @@ contract @mozilla.org/updates/update-prompt;1 {88b3eb21-d072-4e3b-886d-f89d8c49f category system-update-provider MozillaProvider @mozilla.org/updates/update-prompt;1,{88b3eb21-d072-4e3b-886d-f89d8c49fe59} #endif +# On b2gdroid we want to use the android implementation of the directory service. +#ifndef MOZ_B2GDROID +#ifdef MOZ_B2G # DirectoryProvider.js component {9181eb7c-6f87-11e1-90b1-4f59d80dd2e5} DirectoryProvider.js contract @mozilla.org/b2g/directory-provider;1 {9181eb7c-6f87-11e1-90b1-4f59d80dd2e5} category xpcom-directory-providers b2g-directory-provider @mozilla.org/b2g/directory-provider;1 +#endif +#endif # ActivitiesGlue.js component {3a54788b-48cc-4ab4-93d6-0d6a8ef74f8e} ActivitiesGlue.js @@ -87,6 +92,7 @@ contract @mozilla.org/fxaccounts/fxaccounts-ui-glue;1 {51875c14-91d7-4b8c-b65d-3 component {710322af-e6ae-4b0c-b2c9-1474a87b077e} HelperAppDialog.js contract @mozilla.org/helperapplauncherdialog;1 {710322af-e6ae-4b0c-b2c9-1474a87b077e} +#ifndef MOZ_B2GDROID #ifndef MOZ_WIDGET_GONK component {c83c02c0-5d43-4e3e-987f-9173b313e880} SimulatorScreen.js contract @mozilla.org/simulator-screen;1 {c83c02c0-5d43-4e3e-987f-9173b313e880} @@ -100,6 +106,7 @@ component {385993fe-8710-4621-9fb1-00a09d8bec37} CommandLine.js contract @mozilla.org/commandlinehandler/general-startup;1?type=b2gcmds {385993fe-8710-4621-9fb1-00a09d8bec37} category command-line-handler m-b2gcmds @mozilla.org/commandlinehandler/general-startup;1?type=b2gcmds #endif +#endif # BootstrapCommandLine.js component {fd663ec8-cf3f-4c2b-aacb-17a6915ccb44} BootstrapCommandLine.js diff --git a/b2g/components/CommandLine.js b/b2g/components/CommandLine.js index bdb1221e8b..6dc48bd338 100644 --- a/b2g/components/CommandLine.js +++ b/b2g/components/CommandLine.js @@ -15,6 +15,10 @@ function CommandlineHandler() { CommandlineHandler.prototype = { handle: function(cmdLine) { this.cmdLine = cmdLine; + let win = Services.wm.getMostRecentWindow("navigator:browser"); + if (win && win.shell) { + win.shell.handleCmdLine(); + } }, helpInfo: "", diff --git a/b2g/components/DirectoryProvider.js b/b2g/components/DirectoryProvider.js index 58eb8b4c4f..196bf67a51 100644 --- a/b2g/components/DirectoryProvider.js +++ b/b2g/components/DirectoryProvider.js @@ -15,6 +15,7 @@ const UPDATE_ARCHIVE_DIR = "UpdArchD" const LOCAL_DIR = "/data/local"; const UPDATES_DIR = "updates/0"; const FOTA_DIR = "updates/fota"; +const COREAPPSDIR_PREF = "b2g.coreappsdir" XPCOMUtils.defineLazyServiceGetter(Services, "env", "@mozilla.org/process/environment;1", @@ -97,12 +98,27 @@ DirectoryProvider.prototype = { return this.getUpdateDir(persistent, FOTA_DIR, 1.1); } #else - // In desktop builds, coreAppsDir is the same as the profile directory. - // We just need to get the path from the parent, and it is then used to - // build jar:remoteopenfile:// uris. + // In desktop builds, coreAppsDir is the same as the profile + // directory unless otherwise specified. We just need to get the + // path from the parent, and it is then used to build + // jar:remoteopenfile:// uris. if (prop == "coreAppsDir") { - let appsDir = Services.dirsvc.get("ProfD", Ci.nsIFile); - appsDir.append("webapps"); + let coreAppsDirPref; + try { + coreAppsDirPref = Services.prefs.getCharPref(COREAPPSDIR_PREF); + } catch (e) { + // coreAppsDirPref may not exist if we're on an older version + // of gaia, so just fail silently. + } + let appsDir; + // If pref doesn't exist or isn't set, default to old value + if (!coreAppsDirPref || coreAppsDirPref == "") { + appsDir = Services.dirsvc.get("ProfD", Ci.nsIFile); + appsDir.append("webapps"); + } else { + appsDir = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile) + appsDir.initWithPath(coreAppsDirPref); + } persistent.value = true; return appsDir; } else if (prop == "ProfD") { diff --git a/b2g/components/moz.build b/b2g/components/moz.build index 07a7943708..5e0c0be112 100644 --- a/b2g/components/moz.build +++ b/b2g/components/moz.build @@ -31,7 +31,7 @@ EXTRA_COMPONENTS += [ 'WebappsUpdateTimer.js', ] -if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk': +if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk' and CONFIG['MOZ_WIDGET_TOOLKIT'] != 'android': EXTRA_COMPONENTS += [ 'CommandLine.js', 'OopCommandLine.js', @@ -40,10 +40,14 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk': EXTRA_PP_COMPONENTS += [ 'B2GComponents.manifest', - 'DirectoryProvider.js', - 'RecoveryService.js', ] +if CONFIG['MOZ_B2G'] and not CONFIG['MOZ_B2GDROID']: + EXTRA_PP_COMPONENTS += [ + 'DirectoryProvider.js', + 'RecoveryService.js', + ] + if CONFIG['MOZ_UPDATER']: EXTRA_PP_COMPONENTS += [ 'UpdatePrompt.js', diff --git a/build/pgo/certs/cert8.db b/build/pgo/certs/cert8.db index 2835ad347018d1ab8caa04eda40603bd781d781c..3f2ef8379e08899323018f367e705ae17979a09c 100644 GIT binary patch delta 703 zcmZo@U}73F&MHQuu7el2s@1B*(F3Z8lz~KObtalm24VqYQ0<$RtV}sGPx>#eoHld&ZZ+o%cz5U57gVk}`G67ezk3W@r_lq^WFX?F0lUa8eFITVxOqc3CrLR40 zDOc|tj=Be2lc#Yu_;^=bx?msLY%uYl^of!-({m4Q+RX}FlEcEA{#)caw7=S(DK?ci#=`Mq=JZF7duxN|f2%*3RI4g>m3{sScVpj=51enW2|jsm$DOQC z%NJfVn{!)3r{dDav$nby<(Zfn85kEgF~=G-F-HP%C>wLAtRPDhvk#Et(Zrovk(gVM zld6}TpF6o?sruxcr7~jqMd?j~C8@l ziOJcSdFd#k5_$P0x>#l4>Nj6smdIEy|L@1bsH;le>$CH?%}+fQIXZu`tNRXTjp)S> z{~eXRoa^otJ;!Lz*?%*vZn&zv5GvR+V}}as-W_Sj472+#+p`49O`dqp_v_KQ{HHgI zc!-PXzftP=t8lPJkH6~1(`(;ijau66T*BKQWjtH=FQD?xhv#QbFZklL>iPZConAJA Oy3-kZHt$&B5e@+Sv?Ou> delta 558 zcmV+}0@3||fCPYm1h8Cy22UgHB2Oc+(ODX^yP9bSlh0xelaXW_lUbq5lh0xelaXX5 z8Xqtn1_KBI002V-Km9;if%8`g$A1NZ<)cCN>$SC*OvD3o zju=o@(r-Cn&4D!DK|}m9;7HlpnJFuX21os5VA<>RwPxSKx|SU=RM2p82|+S6Py`ct zvDh=?^?2lLe(Hllr6= zlU$_=vreTu0kh<$Q~`f%eZ0HTdj62t@Z>I7hhQjnB259S4u6dF4hc*ZLx=Z+xE|w5 zq&1MISS}NJaD`;mG8!;tW+7b%E!P12^?UmlD~p8rh*RPk1I4ebbt_Z1I3FU7KA=|$ wz(IuM0h=s%o)LiUy`3$K&#Mw6FMGvm7#G>I6M8?LpI?k&=*a-;w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CrAcu4Sv!q`@>?mj~Uj}QeFBG9t&BB#Eb${#GRi5Q};F>rn zaL&qIRL?}Z#?x2r%y`Wt<$8KCKOdJR$C37Vv=&q)F|3xmpG#L)A>6KE*p4#reyrX8 zi@P;fR^012cTGjh17RIbwQK|m$a!pZX?c5k2-8dJ`qrd-+7X=Y> zQ#FWYIhCPpD?)`jMUrY zK=+f4D0cQXeyTqJg0(;EA=8<3LF#>*%LnPQZ)APle~7`k#aeQ5hu-y&@~%=4SD1Dq zQbt#k-a+hq!yZCpO+>dJg`~e>5&2d5O*$~sUZbdb7|g#S1GLgV!8joW^N0a zxVii!qe}3QLfDT;dq|i--NRUUBbSeimkNwJ`i1(P3q3w_VvmOLHI$w>gK~J5V8cG? zr~_^uw8f6~eWdX|oDGZIZEWMiQIidP>`$s0YC|Lbtf+R+PHicONgp;X1NlSoqhAkk zWY!OwwDb!!a@9)|2do8I4dpYLup>bZ)(UG&L9Jl%ARBg@bE|s55qgy2;@4bmt~=TL JG5W^r{{yUbIaL4v delta 307 zcmZp8z}3*eK0#fSm4Sgl5Qyc0m>-B)fY@!KjXWdg#ETglkJ#ul-rvk<@SmR>D8bLf z#l*?N@@+G}!&m0X4gxHb6DCM+mUnr`&B?{^mH#1sBLC{moB;=UHouG!XP*A>JfplM z7efR8DIPDLDV!placuWkHJBMC7#R4NH8u+t@H02YNs K7uGOJI|Be-Us%8Z diff --git a/build/pgo/server-locations.txt b/build/pgo/server-locations.txt index d82c6d4333..da4c66e411 100644 --- a/build/pgo/server-locations.txt +++ b/build/pgo/server-locations.txt @@ -95,10 +95,14 @@ http://example.net:80 privileged # Used to test that clearing Service Workers for domain example.com, does not clear prefixexample.com http://prefixexample.com:80 +# The first HTTPS location is used to generate the Common Name (CN) value of the +# certificate's Issued To field. https://example.com:443 privileged -https://example.org:443 privileged https://test1.example.com:443 privileged https://test2.example.com:443 privileged +https://example.org:443 privileged +https://test1.example.org:443 privileged +https://test2.example.org:443 privileged https://sub1.test1.example.com:443 privileged https://sub1.test2.example.com:443 privileged https://sub2.test1.example.com:443 privileged @@ -168,6 +172,11 @@ http://tracking.example.com:80 http://not-tracking.example.com:80 http://tracking.example.org:80 +https://malware.example.com:443 +https://tracking.example.com:443 +https://not-tracking.example.com:443 +https://tracking.example.org:443 + # Bug 483437, 484111 https://www.bank1.com:443 privileged,cert=escapeattack1 diff --git a/configure.in b/configure.in index fbe4bdb9ff..2f4a1af5ac 100644 --- a/configure.in +++ b/configure.in @@ -4003,6 +4003,10 @@ b2g/dev) ;; esac +if test -n "$MOZ_B2GDROID"; then + AC_DEFINE(MOZ_B2GDROID) +fi + AC_SUBST(MOZ_BUILD_APP) AC_SUBST(MOZ_PHOENIX) AC_SUBST(MOZ_XULRUNNER) diff --git a/dom/apps/Webapps.js b/dom/apps/Webapps.js index aa712163cc..e46e99966d 100644 --- a/dom/apps/Webapps.js +++ b/dom/apps/Webapps.js @@ -316,7 +316,7 @@ WebappsRegistry.prototype = { } this.addMessageListeners(["Webapps:GetLocalizationResource:Return"]); - return this.createPromise((aResolve, aReject) => { + return this.createPromiseWithId((aResolverId) => { cpmm.sendAsyncMessage("Webapps:GetLocalizationResource", { manifestURL: manifestURL, lang: aLanguage, @@ -325,10 +325,7 @@ WebappsRegistry.prototype = { dataType: aType, oid: this._id, topId: this._topId, - requestID: this.getPromiseResolverId({ - resolve: aResolve, - reject: aReject - }) + requestID: aResolverId }); }); }, @@ -609,7 +606,7 @@ WebappsApplication.prototype = { connect: function(aKeyword, aRules) { this.addMessageListeners(["Webapps:Connect:Return:OK", "Webapps:Connect:Return:KO"]); - return this.createPromise(function (aResolve, aReject) { + return this.createPromiseWithId((aResolverId) => { let from = this._window.location.origin + this._window.location.pathname; cpmm.sendAsyncMessage("Webapps:Connect", { keyword: aKeyword, @@ -618,27 +615,21 @@ WebappsApplication.prototype = { pubPageURL: from, outerWindowID: this._id, topWindowID: this._topId, - requestID: this.getPromiseResolverId({ - resolve: aResolve, - reject: aReject - }) + requestID: aResolverId }); - }.bind(this)); + }); }, getConnections: function() { this.addMessageListeners("Webapps:GetConnections:Return:OK"); - return this.createPromise(function (aResolve, aReject) { + return this.createPromiseWithId((aResolverId) => { cpmm.sendAsyncMessage("Webapps:GetConnections", { manifestURL: this.manifestURL, outerWindowID: this._id, topWindowID: this._topId, - requestID: this.getPromiseResolverId({ - resolve: aResolve, - reject: aReject - }) + requestID: aResolverId }); - }.bind(this)); + }); }, addReceipt: function(receipt) { @@ -689,22 +680,19 @@ WebappsApplication.prototype = { export: function() { this.addMessageListeners(["Webapps:Export:Return"]); - return this.createPromise((aResolve, aReject) => { + return this.createPromiseWithId((aResolverId) => { cpmm.sendAsyncMessage("Webapps:Export", { manifestURL: this.manifestURL, oid: this._id, topId: this._topId, - requestID: this.getPromiseResolverId({ - resolve: aResolve, - reject: aReject - }) + requestID: aResolverId }); }); }, getLocalizedValue: function(aProperty, aLang, aEntryPoint) { this.addMessageListeners(["Webapps:GetLocalizedValue:Return"]); - return this.createPromise((aResolve, aReject) => { + return this.createPromiseWithId((aResolverId) => { cpmm.sendAsyncMessage("Webapps:GetLocalizedValue", { manifestURL: this.manifestURL, oid: this._id, @@ -712,10 +700,7 @@ WebappsApplication.prototype = { property: aProperty, lang: aLang, entryPoint: aEntryPoint, - requestID: this.getPromiseResolverId({ - resolve: aResolve, - reject: aReject - }) + requestID: aResolverId }); }); }, @@ -958,19 +943,16 @@ WebappsApplicationMgmt.prototype = { }, getIcon: function(aApp, aIconID, aEntryPoint) { - return this.createPromise(function(aResolve, aReject) { + return this.createPromiseWithId((aResolverId) => { cpmm.sendAsyncMessage("Webapps:GetIcon", { oid: this._id, topId: this._topId, manifestURL: aApp.manifestURL, iconID: aIconID, entryPoint: aEntryPoint, - requestID: this.getPromiseResolverId({ - resolve: aResolve, - reject: aReject - }) + requestID: aResolverId }); - }.bind(this)); + }); }, getNotInstalled: function() { @@ -988,29 +970,25 @@ WebappsApplicationMgmt.prototype = { import: function(aBlob) { let principal = this._window.document.nodePrincipal; - return this.createPromise((aResolve, aReject) => { + return this.createPromiseWithId((aResolverId) => { cpmm.sendAsyncMessage("Webapps:Import", { blob: aBlob, oid: this._id, topId: this._topId, - requestID: this.getPromiseResolverId({ - resolve: aResolve, - reject: aReject - })}, null, principal); + requestID: aResolverId + }, null, principal); }); }, extractManifest: function(aBlob) { let principal = this._window.document.nodePrincipal; - return this.createPromise((aResolve, aReject) => { + return this.createPromiseWithId((aResolverId) => { cpmm.sendAsyncMessage("Webapps:ExtractManifest", { blob: aBlob, oid: this._id, topId: this._topId, - requestID: this.getPromiseResolverId({ - resolve: aResolve, - reject: aReject - })}, null, principal); + requestID: aResolverId + }, null, principal); }); }, diff --git a/dom/apps/Webapps.jsm b/dom/apps/Webapps.jsm index 18d9785f83..187362ae7a 100755 --- a/dom/apps/Webapps.jsm +++ b/dom/apps/Webapps.jsm @@ -85,6 +85,9 @@ XPCOMUtils.defineLazyModuleGetter(this, "Langpacks", XPCOMUtils.defineLazyModuleGetter(this, "ImportExport", "resource://gre/modules/ImportExport.jsm"); +XPCOMUtils.defineLazyModuleGetter(this, "AppConstants", + "resource://gre/modules/AppConstants.jsm"); + #ifdef MOZ_WIDGET_GONK XPCOMUtils.defineLazyGetter(this, "libcutils", function() { Cu.import("resource://gre/modules/systemlibs.js"); @@ -774,9 +777,9 @@ this.DOMApplicationRegistry = { } } -#ifdef MOZ_WIDGET_GONK - yield this.installSystemApps(); -#endif + if (AppConstants.MOZ_B2GDROID || AppConstants.MOZ_B2G) { + yield this.installSystemApps(); + } // At first run, install preloaded apps and set up their permissions. for (let id in this.webapps) { @@ -851,8 +854,16 @@ this.DOMApplicationRegistry = { root = aManifest.entry_points[aEntryPoint]; } - if (!root.messages || !Array.isArray(root.messages) || - root.messages.length == 0) { + if (!root.messages) { + // This application just doesn't use system messages. + return; + } + + if (!Array.isArray(root.messages) || root.messages.length == 0) { + dump("Could not register invalid system message entry for " + aApp.manifestURL + "\n"); + try { + dump(JSON.stringify(root.messages) + "\n"); + } catch(e) {} return; } @@ -862,28 +873,32 @@ this.DOMApplicationRegistry = { root.messages.forEach(function registerPages(aMessage) { let handlerPageURI = launchPathURI; let messageName; - if (typeof(aMessage) === "object" && Object.keys(aMessage).length === 1) { - messageName = Object.keys(aMessage)[0]; - let handlerPath = aMessage[messageName]; - // Resolve the handler path from origin. If |handler_path| is absent, - // simply skip. - let fullHandlerPath; + if (typeof(aMessage) !== "object" || Object.keys(aMessage).length !== 1) { + dump("Could not register invalid system message entry for " + aApp.manifestURL + "\n"); try { - if (handlerPath && handlerPath.trim()) { - fullHandlerPath = manifest.resolveURL(handlerPath); - } else { - throw new Error("Empty or blank handler path."); - } - } catch(e) { - debug("system message handler path (" + handlerPath + ") is " + - "invalid, skipping. Error is: " + e); - return; - } - handlerPageURI = Services.io.newURI(fullHandlerPath, null, null); - } else { - messageName = aMessage; + dump(JSON.stringify(aMessage) + "\n"); + } catch(e) {} + return; } + messageName = Object.keys(aMessage)[0]; + let handlerPath = aMessage[messageName]; + // Resolve the handler path from origin. If |handler_path| is absent, + // simply skip. + let fullHandlerPath; + try { + if (handlerPath && handlerPath.trim()) { + fullHandlerPath = manifest.resolveURL(handlerPath); + } else { + throw new Error("Empty or blank handler path."); + } + } catch(e) { + debug("system message handler path (" + handlerPath + ") is " + + "invalid, skipping. Error is: " + e); + return; + } + handlerPageURI = Services.io.newURI(fullHandlerPath, null, null); + if (SystemMessagePermissionsChecker .isSystemMessagePermittedToRegister(messageName, aApp.manifestURL, @@ -2939,6 +2954,12 @@ this.DOMApplicationRegistry = { // don't update the permissions yet. if (!aData.isPackage) { if (supportUseCurrentProfile()) { + try { + if (Services.prefs.getBoolPref("dom.apps.developer_mode")) { + this.webapps[id].appStatus = + AppsUtils.getAppManifestStatus(app.manifest); + } + } catch(e) {}; PermissionsInstaller.installPermissions( { origin: appObject.origin, diff --git a/dom/base/DOMRequestHelper.jsm b/dom/base/DOMRequestHelper.jsm index 5c51dce998..3d594872cb 100644 --- a/dom/base/DOMRequestHelper.jsm +++ b/dom/base/DOMRequestHelper.jsm @@ -298,6 +298,17 @@ DOMRequestIpcHelper.prototype = { return new this._window.Promise(aPromiseInit); }, + /** + * createPromiseWithId() creates a new Promise, accepting a callback + * which is immediately called with the generated resolverId. + */ + createPromiseWithId: function(aCallback) { + return this.createPromise(function(aResolve, aReject) { + let resolverId = this.getPromiseResolverId({ resolve: aResolve, reject: aReject }); + aCallback(resolverId); + }.bind(this)); + }, + forEachRequest: function(aCallback) { if (!this._requests) { return; diff --git a/dom/base/nsContentPolicyUtils.h b/dom/base/nsContentPolicyUtils.h index 3b4ae32b9e..6a8535fc5c 100644 --- a/dom/base/nsContentPolicyUtils.h +++ b/dom/base/nsContentPolicyUtils.h @@ -93,41 +93,46 @@ inline const char * NS_CP_ContentTypeName(uint32_t contentType) { switch (contentType) { - CASE_RETURN( TYPE_OTHER ); - CASE_RETURN( TYPE_SCRIPT ); - CASE_RETURN( TYPE_IMAGE ); - CASE_RETURN( TYPE_STYLESHEET ); - CASE_RETURN( TYPE_OBJECT ); - CASE_RETURN( TYPE_DOCUMENT ); - CASE_RETURN( TYPE_SUBDOCUMENT ); - CASE_RETURN( TYPE_REFRESH ); - CASE_RETURN( TYPE_XBL ); - CASE_RETURN( TYPE_PING ); - CASE_RETURN( TYPE_XMLHTTPREQUEST ); - CASE_RETURN( TYPE_OBJECT_SUBREQUEST ); - CASE_RETURN( TYPE_DTD ); - CASE_RETURN( TYPE_FONT ); - CASE_RETURN( TYPE_MEDIA ); - CASE_RETURN( TYPE_WEBSOCKET ); - CASE_RETURN( TYPE_CSP_REPORT ); - CASE_RETURN( TYPE_XSLT ); - CASE_RETURN( TYPE_BEACON ); - CASE_RETURN( TYPE_FETCH ); - CASE_RETURN( TYPE_IMAGESET ); - CASE_RETURN( TYPE_WEB_MANIFEST ); - CASE_RETURN( TYPE_INTERNAL_SCRIPT ); - CASE_RETURN( TYPE_INTERNAL_WORKER ); - CASE_RETURN( TYPE_INTERNAL_SHARED_WORKER ); - CASE_RETURN( TYPE_INTERNAL_EMBED ); - CASE_RETURN( TYPE_INTERNAL_OBJECT ); - CASE_RETURN( TYPE_INTERNAL_FRAME ); - CASE_RETURN( TYPE_INTERNAL_IFRAME ); - CASE_RETURN( TYPE_INTERNAL_AUDIO ); - CASE_RETURN( TYPE_INTERNAL_VIDEO ); - CASE_RETURN( TYPE_INTERNAL_TRACK ); - CASE_RETURN( TYPE_INTERNAL_XMLHTTPREQUEST ); - CASE_RETURN( TYPE_INTERNAL_EVENTSOURCE ); - CASE_RETURN( TYPE_INTERNAL_SERVICE_WORKER ); + CASE_RETURN( TYPE_OTHER ); + CASE_RETURN( TYPE_SCRIPT ); + CASE_RETURN( TYPE_IMAGE ); + CASE_RETURN( TYPE_STYLESHEET ); + CASE_RETURN( TYPE_OBJECT ); + CASE_RETURN( TYPE_DOCUMENT ); + CASE_RETURN( TYPE_SUBDOCUMENT ); + CASE_RETURN( TYPE_REFRESH ); + CASE_RETURN( TYPE_XBL ); + CASE_RETURN( TYPE_PING ); + CASE_RETURN( TYPE_XMLHTTPREQUEST ); + CASE_RETURN( TYPE_OBJECT_SUBREQUEST ); + CASE_RETURN( TYPE_DTD ); + CASE_RETURN( TYPE_FONT ); + CASE_RETURN( TYPE_MEDIA ); + CASE_RETURN( TYPE_WEBSOCKET ); + CASE_RETURN( TYPE_CSP_REPORT ); + CASE_RETURN( TYPE_XSLT ); + CASE_RETURN( TYPE_BEACON ); + CASE_RETURN( TYPE_FETCH ); + CASE_RETURN( TYPE_IMAGESET ); + CASE_RETURN( TYPE_WEB_MANIFEST ); + CASE_RETURN( TYPE_INTERNAL_SCRIPT ); + CASE_RETURN( TYPE_INTERNAL_WORKER ); + CASE_RETURN( TYPE_INTERNAL_SHARED_WORKER ); + CASE_RETURN( TYPE_INTERNAL_EMBED ); + CASE_RETURN( TYPE_INTERNAL_OBJECT ); + CASE_RETURN( TYPE_INTERNAL_FRAME ); + CASE_RETURN( TYPE_INTERNAL_IFRAME ); + CASE_RETURN( TYPE_INTERNAL_AUDIO ); + CASE_RETURN( TYPE_INTERNAL_VIDEO ); + CASE_RETURN( TYPE_INTERNAL_TRACK ); + CASE_RETURN( TYPE_INTERNAL_XMLHTTPREQUEST ); + CASE_RETURN( TYPE_INTERNAL_EVENTSOURCE ); + CASE_RETURN( TYPE_INTERNAL_SERVICE_WORKER ); + CASE_RETURN( TYPE_INTERNAL_SCRIPT_PRELOAD ); + CASE_RETURN( TYPE_INTERNAL_IMAGE ); + CASE_RETURN( TYPE_INTERNAL_IMAGE_PRELOAD ); + CASE_RETURN( TYPE_INTERNAL_STYLESHEET ); + CASE_RETURN( TYPE_INTERNAL_STYLESHEET_PRELOAD ); default: return ""; } diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp index 5ca978b96a..5c56d6737b 100644 --- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -95,7 +95,6 @@ #include "nsHostObjectProtocolHandler.h" #include "nsHtml5Module.h" #include "nsHtml5StringParser.h" -#include "nsIAppShell.h" #include "nsIAsyncVerifyRedirectCallback.h" #include "nsICategoryManager.h" #include "nsIChannelEventSink.h" @@ -357,7 +356,6 @@ namespace { static NS_DEFINE_CID(kParserServiceCID, NS_PARSERSERVICE_CID); static NS_DEFINE_CID(kCParserCID, NS_PARSER_CID); -static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID); static PLDHashTable* sEventListenerManagersHash; @@ -5266,7 +5264,6 @@ nsContentUtils::LeaveMicroTask() MOZ_ASSERT(NS_IsMainThread()); if (--sMicroTaskLevel == 0) { PerformMainThreadMicroTaskCheckpoint(); - nsDocument::ProcessBaseElementQueue(); } } @@ -7173,7 +7170,7 @@ nsContentUtils::IsForbiddenSystemRequestHeader(const nsACString& aHeader) "access-control-request-method", "connection", "content-length", "cookie", "cookie2", "content-transfer-encoding", "date", "dnt", "expect", "host", "keep-alive", "origin", "referer", "te", "trailer", - "transfer-encoding", "upgrade", "user-agent", "via" + "transfer-encoding", "upgrade", "via" }; for (uint32_t i = 0; i < ArrayLength(kInvalidHeaders); ++i) { if (aHeader.LowerCaseEqualsASCII(kInvalidHeaders[i])) { @@ -7972,13 +7969,13 @@ nsContentUtils::GetWindowRoot(nsIDocument* aDoc) return nullptr; } - /* static */ nsContentPolicyType nsContentUtils::InternalContentPolicyTypeToExternal(nsContentPolicyType aType) { switch (aType) { case nsIContentPolicy::TYPE_INTERNAL_SCRIPT: + case nsIContentPolicy::TYPE_INTERNAL_SCRIPT_PRELOAD: case nsIContentPolicy::TYPE_INTERNAL_WORKER: case nsIContentPolicy::TYPE_INTERNAL_SHARED_WORKER: case nsIContentPolicy::TYPE_INTERNAL_SERVICE_WORKER: @@ -8001,6 +7998,14 @@ nsContentUtils::InternalContentPolicyTypeToExternal(nsContentPolicyType aType) case nsIContentPolicy::TYPE_INTERNAL_EVENTSOURCE: return nsIContentPolicy::TYPE_XMLHTTPREQUEST; + case nsIContentPolicy::TYPE_INTERNAL_IMAGE: + case nsIContentPolicy::TYPE_INTERNAL_IMAGE_PRELOAD: + return nsIContentPolicy::TYPE_IMAGE; + + case nsIContentPolicy::TYPE_INTERNAL_STYLESHEET: + case nsIContentPolicy::TYPE_INTERNAL_STYLESHEET_PRELOAD: + return nsIContentPolicy::TYPE_STYLESHEET; + default: return aType; } @@ -8211,28 +8216,17 @@ nsContentUtils::InternalStorageAllowedForPrincipal(nsIPrincipal* aPrincipal, access = std::min(StorageAccess::eSessionScoped, access); } - // If the caller is chrome privileged, then it is allowed to access any - // storage it likes, no matter whether the storage for that window/principal - // would normally be permitted. - if (IsSystemPrincipal(SubjectPrincipal())) { - return access; - } - - if (!SubjectPrincipal()->Subsumes(aPrincipal)) { - NS_WARNING("A principal is attempting to access storage for a principal " - "which it doesn't subsume!"); - return StorageAccess::eDeny; - } - // About URIs are allowed to access storage, even if they don't have chrome // privileges. If this is not desired, than the consumer will have to // implement their own restriction functionality. nsCOMPtr uri; - MOZ_ALWAYS_TRUE(NS_SUCCEEDED(aPrincipal->GetURI(getter_AddRefs(uri)))); - bool isAbout = false; - MOZ_ALWAYS_TRUE(NS_SUCCEEDED(uri->SchemeIs("about", &isAbout))); - if (isAbout) { - return access; + nsresult rv = aPrincipal->GetURI(getter_AddRefs(uri)); + if (NS_SUCCEEDED(rv) && uri) { + bool isAbout = false; + MOZ_ALWAYS_TRUE(NS_SUCCEEDED(uri->SchemeIs("about", &isAbout))); + if (isAbout) { + return access; + } } nsCOMPtr permissionManager = diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp index 63ea62c8cd..ed343cdc18 100644 --- a/dom/base/nsDocument.cpp +++ b/dom/base/nsDocument.cpp @@ -5915,29 +5915,6 @@ nsDocument::RegisterUnresolvedElement(Element* aElement, nsIAtom* aTypeName) return NS_OK; } -namespace { - -class ProcessStackRunner final : public nsIRunnable -{ - ~ProcessStackRunner() {} -public: - explicit ProcessStackRunner(bool aIsBaseQueue = false) - : mIsBaseQueue(aIsBaseQueue) - { - } - NS_DECL_ISUPPORTS - NS_IMETHOD Run() override - { - nsDocument::ProcessTopElementQueue(mIsBaseQueue); - return NS_OK; - } - bool mIsBaseQueue; -}; - -NS_IMPL_ISUPPORTS(ProcessStackRunner, nsIRunnable); - -} // namespace - void nsDocument::EnqueueLifecycleCallback(nsIDocument::ElementCallbackType aType, Element* aCustomElement, @@ -6039,10 +6016,7 @@ nsDocument::EnqueueLifecycleCallback(nsIDocument::ElementCallbackType aType, // A new element queue needs to be pushed if the queue at the // top of the stack is associated with another microtask level. - // Don't push a queue for the level 0 microtask (base element queue) - // because we don't want to process the queue until the - // microtask checkpoint. - bool shouldPushElementQueue = nsContentUtils::MicroTaskLevel() > 0 && + bool shouldPushElementQueue = (!lastData || lastData->mAssociatedMicroTask < static_cast(nsContentUtils::MicroTaskLevel())); @@ -6065,39 +6039,22 @@ nsDocument::EnqueueLifecycleCallback(nsIDocument::ElementCallbackType aType, // should be invoked prior to returning control back to script. // Create a script runner to process the top of the processing // stack as soon as it is safe to run script. - nsContentUtils::AddScriptRunner(new ProcessStackRunner()); + nsCOMPtr runnable = + NS_NewRunnableFunction(&nsDocument::ProcessTopElementQueue); + nsContentUtils::AddScriptRunner(runnable); } } } // static void -nsDocument::ProcessBaseElementQueue() -{ - // Prevent re-entrance. Also, if a microtask checkpoint is reached - // and there is no processing stack to process, then we are done. - if (sProcessingBaseElementQueue || !sProcessingStack) { - return; - } - - MOZ_ASSERT(nsContentUtils::MicroTaskLevel() == 0); - sProcessingBaseElementQueue = true; - nsContentUtils::AddScriptRunner(new ProcessStackRunner(true)); -} - -// static -void -nsDocument::ProcessTopElementQueue(bool aIsBaseQueue) +nsDocument::ProcessTopElementQueue() { MOZ_ASSERT(nsContentUtils::IsSafeToRunScript()); nsTArray>& stack = *sProcessingStack; uint32_t firstQueue = stack.LastIndexOf((CustomElementData*) nullptr); - if (aIsBaseQueue && firstQueue != 0) { - return; - } - for (uint32_t i = firstQueue + 1; i < stack.Length(); ++i) { // Callback queue may have already been processed in an earlier // element queue or in an element queue that was popped @@ -6115,7 +6072,6 @@ nsDocument::ProcessTopElementQueue(bool aIsBaseQueue) } else { // Don't pop sentinel for base element queue. stack.SetLength(1); - sProcessingBaseElementQueue = false; } } @@ -6131,10 +6087,6 @@ nsDocument::RegisterEnabled() Maybe>> nsDocument::sProcessingStack; -// static -bool -nsDocument::sProcessingBaseElementQueue; - void nsDocument::RegisterElement(JSContext* aCx, const nsAString& aType, const ElementRegistrationOptions& aOptions, @@ -8594,9 +8546,6 @@ nsDocument::RetrieveRelevantHeaders(nsIChannel *aChannel) // The misspelled key 'referer' is as per the HTTP spec rv = httpChannel->GetRequestHeader(NS_LITERAL_CSTRING("referer"), mReferrer); - if (NS_FAILED(rv)) { - mReferrer.Truncate(); - } static const char *const headers[] = { "default-style", @@ -9907,7 +9856,7 @@ nsDocument::PreloadStyle(nsIURI* uri, const nsAString& charset, nsCOMPtr obs = new StubCSSLoaderObserver(); // Charset names are always ASCII. - CSSLoader()->LoadSheet(uri, NodePrincipal(), + CSSLoader()->LoadSheet(uri, true, NodePrincipal(), NS_LossyConvertUTF16toASCII(charset), obs, Element::StringToCORSMode(aCrossOriginAttr), diff --git a/dom/base/nsDocument.h b/dom/base/nsDocument.h index 4bd77b27d3..96670d6a32 100644 --- a/dom/base/nsDocument.h +++ b/dom/base/nsDocument.h @@ -1296,7 +1296,7 @@ public: mozilla::dom::LifecycleCallbackArgs* aArgs = nullptr, mozilla::dom::CustomElementDefinition* aDefinition = nullptr) override; - static void ProcessTopElementQueue(bool aIsBaseQueue = false); + static void ProcessTopElementQueue(); void GetCustomPrototype(int32_t aNamespaceID, nsIAtom* aAtom, @@ -1584,15 +1584,9 @@ private: // queue in the stack is the base element queue. static mozilla::Maybe>> sProcessingStack; - // Flag to prevent re-entrance into base element queue as described in the - // custom elements speicification. - static bool sProcessingBaseElementQueue; - static bool CustomElementConstructor(JSContext* aCx, unsigned aArgc, JS::Value* aVp); public: - static void ProcessBaseElementQueue(); - // Enqueue created callback or register upgrade candidate for // newly created custom elements, possibly extending an existing type. // ex. ,