TRRLoadInfo.cpp (14699B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #include "TRRLoadInfo.h" 8 #include "mozilla/dom/ClientSource.h" 9 #include "mozilla/dom/FeaturePolicy.h" 10 #include "mozilla/dom/DOMTypes.h" 11 #include "nsContentUtils.h" 12 #include "nsIRedirectHistoryEntry.h" 13 #include "LoadInfo.h" 14 15 using namespace mozilla::dom; 16 17 namespace mozilla { 18 namespace net { 19 20 NS_IMPL_ISUPPORTS(TRRLoadInfo, nsILoadInfo) 21 22 TRRLoadInfo::TRRLoadInfo(nsIURI* aResultPrincipalURI, 23 nsContentPolicyType aContentPolicyType) 24 : mResultPrincipalURI(aResultPrincipalURI), 25 mInternalContentPolicyType(aContentPolicyType) {} 26 27 already_AddRefed<nsILoadInfo> TRRLoadInfo::Clone() const { 28 nsCOMPtr<nsILoadInfo> loadInfo = 29 new TRRLoadInfo(mResultPrincipalURI, mInternalContentPolicyType); 30 31 return loadInfo.forget(); 32 } 33 34 NS_IMETHODIMP 35 TRRLoadInfo::GetLoadingPrincipal(nsIPrincipal** aLoadingPrincipal) { 36 return NS_ERROR_NOT_IMPLEMENTED; 37 } 38 39 nsIPrincipal* TRRLoadInfo::VirtualGetLoadingPrincipal() { return nullptr; } 40 41 NS_IMETHODIMP 42 TRRLoadInfo::GetTriggeringPrincipal(nsIPrincipal** aTriggeringPrincipal) { 43 return NS_ERROR_NOT_IMPLEMENTED; 44 } 45 46 NS_IMETHODIMP 47 TRRLoadInfo::SetTriggeringPrincipalForTesting( 48 nsIPrincipal* aTriggeringPrincipal) { 49 return NS_ERROR_NOT_IMPLEMENTED; 50 } 51 52 nsIPrincipal* TRRLoadInfo::TriggeringPrincipal() { return nullptr; } 53 54 NS_IMETHODIMP 55 TRRLoadInfo::GetPrincipalToInherit(nsIPrincipal** aPrincipalToInherit) { 56 return NS_ERROR_NOT_IMPLEMENTED; 57 } 58 59 NS_IMETHODIMP 60 TRRLoadInfo::SetPrincipalToInherit(nsIPrincipal* aPrincipalToInherit) { 61 return NS_ERROR_NOT_IMPLEMENTED; 62 } 63 64 NS_IMETHODIMP 65 TRRLoadInfo::GetUserNavigationInvolvement(uint8_t* aUserNavigationInvolvement) { 66 return NS_ERROR_NOT_IMPLEMENTED; 67 } 68 69 NS_IMETHODIMP 70 TRRLoadInfo::SetUserNavigationInvolvement(uint8_t aUserNavigationInvolvement) { 71 return NS_ERROR_NOT_IMPLEMENTED; 72 } 73 74 nsIPrincipal* TRRLoadInfo::PrincipalToInherit() { return nullptr; } 75 76 nsIPrincipal* TRRLoadInfo::FindPrincipalToInherit(nsIChannel* aChannel) { 77 return nullptr; 78 } 79 80 const nsID& TRRLoadInfo::GetSandboxedNullPrincipalID() { 81 return mSandboxedNullPrincipalID; 82 } 83 84 void TRRLoadInfo::ResetSandboxedNullPrincipalID() {} 85 86 nsIPrincipal* TRRLoadInfo::GetTopLevelPrincipal() { return nullptr; } 87 88 NS_IMETHODIMP 89 TRRLoadInfo::GetTriggeringRemoteType(nsACString& aTriggeringRemoteType) { 90 return NS_ERROR_NOT_IMPLEMENTED; 91 } 92 93 NS_IMETHODIMP 94 TRRLoadInfo::SetTriggeringRemoteType(const nsACString& aTriggeringRemoteType) { 95 return NS_ERROR_NOT_IMPLEMENTED; 96 } 97 98 NS_IMETHODIMP 99 TRRLoadInfo::GetLoadingDocument(Document** aResult) { 100 return NS_ERROR_NOT_IMPLEMENTED; 101 } 102 103 nsINode* TRRLoadInfo::LoadingNode() { return nullptr; } 104 105 already_AddRefed<nsISupports> TRRLoadInfo::ContextForTopLevelLoad() { 106 return nullptr; 107 } 108 109 already_AddRefed<nsISupports> TRRLoadInfo::GetLoadingContext() { 110 return nullptr; 111 } 112 113 NS_IMETHODIMP 114 TRRLoadInfo::GetLoadingContextXPCOM(nsISupports** aResult) { 115 return NS_ERROR_NOT_IMPLEMENTED; 116 } 117 118 NS_IMETHODIMP 119 TRRLoadInfo::GetSecurityFlags(nsSecurityFlags* aResult) { 120 return NS_ERROR_NOT_IMPLEMENTED; 121 } 122 123 NS_IMETHODIMP 124 TRRLoadInfo::GetSandboxFlags(uint32_t* aResult) { 125 return NS_ERROR_NOT_IMPLEMENTED; 126 } 127 128 NS_IMETHODIMP 129 TRRLoadInfo::GetSecurityMode(uint32_t* aFlags) { 130 return NS_ERROR_NOT_IMPLEMENTED; 131 } 132 133 NS_IMETHODIMP 134 TRRLoadInfo::GetIsInThirdPartyContext(bool* aIsInThirdPartyContext) { 135 return NS_ERROR_NOT_IMPLEMENTED; 136 } 137 138 NS_IMETHODIMP 139 TRRLoadInfo::SetIsInThirdPartyContext(bool aIsInThirdPartyContext) { 140 return NS_ERROR_NOT_IMPLEMENTED; 141 } 142 143 NS_IMETHODIMP 144 TRRLoadInfo::GetIsThirdPartyContextToTopWindow( 145 bool* aIsThirdPartyContextToTopWindow) { 146 return NS_ERROR_NOT_IMPLEMENTED; 147 } 148 149 NS_IMETHODIMP 150 TRRLoadInfo::SetIsThirdPartyContextToTopWindow( 151 bool aIsThirdPartyContextToTopWindow) { 152 return NS_ERROR_NOT_IMPLEMENTED; 153 } 154 155 NS_IMETHODIMP 156 TRRLoadInfo::GetCookiePolicy(uint32_t* aResult) { 157 return NS_ERROR_NOT_IMPLEMENTED; 158 } 159 160 NS_IMETHODIMP 161 TRRLoadInfo::GetCookieJarSettings(nsICookieJarSettings** aCookieJarSettings) { 162 return NS_ERROR_NOT_IMPLEMENTED; 163 } 164 165 NS_IMETHODIMP 166 TRRLoadInfo::SetCookieJarSettings(nsICookieJarSettings* aCookieJarSettings) { 167 return NS_ERROR_NOT_IMPLEMENTED; 168 } 169 170 const Maybe<RFPTargetSet>& TRRLoadInfo::GetOverriddenFingerprintingSettings() { 171 return mOverriddenFingerprintingSettings; 172 } 173 174 void TRRLoadInfo::SetOverriddenFingerprintingSettings(RFPTargetSet aTargets) {} 175 176 NS_IMETHODIMP 177 TRRLoadInfo::GetForceInheritPrincipal(bool* aInheritPrincipal) { 178 return NS_ERROR_NOT_IMPLEMENTED; 179 } 180 181 NS_IMETHODIMP 182 TRRLoadInfo::GetForceInheritPrincipalOverruleOwner(bool* aInheritPrincipal) { 183 return NS_ERROR_NOT_IMPLEMENTED; 184 } 185 186 NS_IMETHODIMP 187 TRRLoadInfo::GetLoadingSandboxed(bool* aLoadingSandboxed) { 188 return NS_ERROR_NOT_IMPLEMENTED; 189 } 190 191 NS_IMETHODIMP 192 TRRLoadInfo::GetAboutBlankInherits(bool* aResult) { 193 return NS_ERROR_NOT_IMPLEMENTED; 194 } 195 196 NS_IMETHODIMP 197 TRRLoadInfo::GetAllowChrome(bool* aResult) { return NS_ERROR_NOT_IMPLEMENTED; } 198 199 NS_IMETHODIMP 200 TRRLoadInfo::GetDisallowScript(bool* aResult) { 201 return NS_ERROR_NOT_IMPLEMENTED; 202 } 203 204 NS_IMETHODIMP 205 TRRLoadInfo::GetDontFollowRedirects(bool* aResult) { 206 return NS_ERROR_NOT_IMPLEMENTED; 207 } 208 209 NS_IMETHODIMP 210 TRRLoadInfo::GetLoadErrorPage(bool* aResult) { 211 return NS_ERROR_NOT_IMPLEMENTED; 212 } 213 214 NS_IMETHODIMP 215 TRRLoadInfo::GetExternalContentPolicyType(nsContentPolicyType* aResult) { 216 // We have to use nsContentPolicyType because ExtContentPolicyType is not 217 // visible from xpidl. 218 *aResult = static_cast<nsContentPolicyType>( 219 nsContentUtils::InternalContentPolicyTypeToExternal( 220 mInternalContentPolicyType)); 221 return NS_OK; 222 } 223 224 nsContentPolicyType TRRLoadInfo::InternalContentPolicyType() { 225 return mInternalContentPolicyType; 226 } 227 228 #define DEFINE_GETTER(type, name, _n, _d) \ 229 NS_IMETHODIMP TRRLoadInfo::Get##name(type* a##name) { \ 230 return NS_ERROR_NOT_IMPLEMENTED; \ 231 } 232 233 #define DEFINE_SETTER(type, name) \ 234 NS_IMETHODIMP TRRLoadInfo::Set##name(type a##name) { \ 235 return NS_ERROR_NOT_IMPLEMENTED; \ 236 } 237 238 LOADINFO_FOR_EACH_FIELD(DEFINE_GETTER, DEFINE_SETTER); 239 240 #undef DEFINE_GETTER 241 #undef DEFINE_SETTER 242 243 NS_IMETHODIMP 244 TRRLoadInfo::GetWorkerAssociatedBrowsingContextID(uint64_t* aResult) { 245 return NS_ERROR_NOT_IMPLEMENTED; 246 } 247 248 NS_IMETHODIMP 249 TRRLoadInfo::SetWorkerAssociatedBrowsingContextID(uint64_t aResult) { 250 return NS_ERROR_NOT_IMPLEMENTED; 251 } 252 253 NS_IMETHODIMP 254 TRRLoadInfo::GetTargetBrowsingContextID(uint64_t* aResult) { 255 return NS_ERROR_NOT_IMPLEMENTED; 256 } 257 258 NS_IMETHODIMP 259 TRRLoadInfo::GetBrowsingContext(dom::BrowsingContext** aResult) { 260 return NS_ERROR_NOT_IMPLEMENTED; 261 } 262 263 NS_IMETHODIMP 264 TRRLoadInfo::GetWorkerAssociatedBrowsingContext( 265 dom::BrowsingContext** aResult) { 266 return NS_ERROR_NOT_IMPLEMENTED; 267 } 268 269 NS_IMETHODIMP 270 TRRLoadInfo::GetFrameBrowsingContext(dom::BrowsingContext** aResult) { 271 return NS_ERROR_NOT_IMPLEMENTED; 272 } 273 274 NS_IMETHODIMP 275 TRRLoadInfo::GetTargetBrowsingContext(dom::BrowsingContext** aResult) { 276 return NS_ERROR_NOT_IMPLEMENTED; 277 } 278 279 NS_IMETHODIMP 280 TRRLoadInfo::GetScriptableOriginAttributes( 281 JSContext* aCx, JS::MutableHandle<JS::Value> aOriginAttributes) { 282 return NS_ERROR_NOT_IMPLEMENTED; 283 } 284 285 NS_IMETHODIMP 286 TRRLoadInfo::ResetPrincipalToInheritToNullPrincipal() { 287 return NS_ERROR_NOT_IMPLEMENTED; 288 } 289 290 NS_IMETHODIMP 291 TRRLoadInfo::SetScriptableOriginAttributes( 292 JSContext* aCx, JS::Handle<JS::Value> aOriginAttributes) { 293 return NS_ERROR_NOT_IMPLEMENTED; 294 } 295 296 nsresult TRRLoadInfo::GetOriginAttributes( 297 mozilla::OriginAttributes* aOriginAttributes) { 298 NS_ENSURE_ARG(aOriginAttributes); 299 *aOriginAttributes = mOriginAttributes; 300 return NS_OK; 301 } 302 303 nsresult TRRLoadInfo::SetOriginAttributes( 304 const mozilla::OriginAttributes& aOriginAttributes) { 305 return NS_ERROR_NOT_IMPLEMENTED; 306 } 307 308 NS_IMETHODIMP 309 TRRLoadInfo::SetInitialSecurityCheckDone(bool aInitialSecurityCheckDone) { 310 return NS_ERROR_NOT_IMPLEMENTED; 311 } 312 313 NS_IMETHODIMP 314 TRRLoadInfo::GetInitialSecurityCheckDone(bool* aResult) { 315 return NS_ERROR_NOT_IMPLEMENTED; 316 } 317 318 NS_IMETHODIMP 319 TRRLoadInfo::AppendRedirectHistoryEntry(nsIChannel* aChannelToDeriveFrom, 320 bool aIsInternalRedirect) { 321 return NS_ERROR_NOT_IMPLEMENTED; 322 } 323 324 NS_IMETHODIMP 325 TRRLoadInfo::GetRedirectChainIncludingInternalRedirects( 326 JSContext* aCx, JS::MutableHandle<JS::Value> aChain) { 327 return NS_ERROR_NOT_IMPLEMENTED; 328 } 329 330 const nsTArray<nsCOMPtr<nsIRedirectHistoryEntry>>& 331 TRRLoadInfo::RedirectChainIncludingInternalRedirects() { 332 return mEmptyRedirectChain; 333 } 334 335 NS_IMETHODIMP 336 TRRLoadInfo::GetRedirectChain(JSContext* aCx, 337 JS::MutableHandle<JS::Value> aChain) { 338 return NS_ERROR_NOT_IMPLEMENTED; 339 } 340 341 const nsTArray<nsCOMPtr<nsIRedirectHistoryEntry>>& 342 TRRLoadInfo::RedirectChain() { 343 return mEmptyRedirectChain; 344 } 345 346 const nsTArray<nsCOMPtr<nsIPrincipal>>& TRRLoadInfo::AncestorPrincipals() { 347 return mEmptyPrincipals; 348 } 349 350 const nsTArray<uint64_t>& TRRLoadInfo::AncestorBrowsingContextIDs() { 351 return mEmptyBrowsingContextIDs; 352 } 353 354 void TRRLoadInfo::SetCorsPreflightInfo(const nsTArray<nsCString>& aHeaders, 355 bool aForcePreflight) {} 356 357 const nsTArray<nsCString>& TRRLoadInfo::CorsUnsafeHeaders() { 358 return mCorsUnsafeHeaders; 359 } 360 361 NS_IMETHODIMP 362 TRRLoadInfo::SetLoadTriggeredFromExternal(bool aLoadTriggeredFromExternal) { 363 return NS_ERROR_NOT_IMPLEMENTED; 364 } 365 366 NS_IMETHODIMP 367 TRRLoadInfo::GetLoadTriggeredFromExternal(bool* aLoadTriggeredFromExternal) { 368 return NS_ERROR_NOT_IMPLEMENTED; 369 } 370 371 NS_IMETHODIMP 372 TRRLoadInfo::GetTainting(uint32_t* aTaintingOut) { 373 return NS_ERROR_NOT_IMPLEMENTED; 374 } 375 376 NS_IMETHODIMP 377 TRRLoadInfo::MaybeIncreaseTainting(uint32_t aTainting) { 378 return NS_ERROR_NOT_IMPLEMENTED; 379 } 380 381 void TRRLoadInfo::SynthesizeServiceWorkerTainting(LoadTainting aTainting) {} 382 383 NS_IMETHODIMP 384 TRRLoadInfo::GetCspNonce(nsAString& aCspNonce) { 385 return NS_ERROR_NOT_IMPLEMENTED; 386 } 387 388 NS_IMETHODIMP 389 TRRLoadInfo::SetCspNonce(const nsAString& aCspNonce) { 390 return NS_ERROR_NOT_IMPLEMENTED; 391 } 392 393 NS_IMETHODIMP 394 TRRLoadInfo::GetIntegrityMetadata(nsAString& aIntegrityMetadata) { 395 return NS_ERROR_NOT_IMPLEMENTED; 396 } 397 398 NS_IMETHODIMP 399 TRRLoadInfo::SetIntegrityMetadata(const nsAString& aIntegrityMetadata) { 400 return NS_ERROR_NOT_IMPLEMENTED; 401 } 402 403 NS_IMETHODIMP 404 TRRLoadInfo::GetIsTopLevelLoad(bool* aResult) { 405 return NS_ERROR_NOT_IMPLEMENTED; 406 } 407 408 NS_IMETHODIMP 409 TRRLoadInfo::GetResultPrincipalURI(nsIURI** aURI) { 410 nsCOMPtr<nsIURI> uri = mResultPrincipalURI; 411 uri.forget(aURI); 412 return NS_OK; 413 } 414 415 NS_IMETHODIMP 416 TRRLoadInfo::SetResultPrincipalURI(nsIURI* aURI) { 417 mResultPrincipalURI = aURI; 418 return NS_OK; 419 } 420 421 NS_IMETHODIMP 422 TRRLoadInfo::GetChannelCreationOriginalURI(nsIURI** aURI) { 423 return NS_ERROR_NOT_IMPLEMENTED; 424 } 425 426 NS_IMETHODIMP 427 TRRLoadInfo::SetChannelCreationOriginalURI(nsIURI* aURI) { 428 return NS_ERROR_NOT_IMPLEMENTED; 429 } 430 431 void TRRLoadInfo::SetClientInfo(const ClientInfo& aClientInfo) {} 432 433 const Maybe<ClientInfo>& TRRLoadInfo::GetClientInfo() { return mClientInfo; } 434 435 void TRRLoadInfo::GiveReservedClientSource( 436 UniquePtr<ClientSource>&& aClientSource) {} 437 438 UniquePtr<ClientSource> TRRLoadInfo::TakeReservedClientSource() { 439 return nullptr; 440 } 441 442 void TRRLoadInfo::SetReservedClientInfo(const ClientInfo& aClientInfo) {} 443 444 void TRRLoadInfo::OverrideReservedClientInfoInParent( 445 const ClientInfo& aClientInfo) {} 446 447 const Maybe<ClientInfo>& TRRLoadInfo::GetReservedClientInfo() { 448 return mReservedClientInfo; 449 } 450 451 void TRRLoadInfo::SetInitialClientInfo(const ClientInfo& aClientInfo) {} 452 453 const Maybe<ClientInfo>& TRRLoadInfo::GetInitialClientInfo() { 454 return mInitialClientInfo; 455 } 456 457 void TRRLoadInfo::SetController(const ServiceWorkerDescriptor& aServiceWorker) { 458 } 459 460 void TRRLoadInfo::ClearController() {} 461 462 const Maybe<ServiceWorkerDescriptor>& TRRLoadInfo::GetController() { 463 return mController; 464 } 465 466 void TRRLoadInfo::SetPerformanceStorage( 467 PerformanceStorage* aPerformanceStorage) {} 468 469 PerformanceStorage* TRRLoadInfo::GetPerformanceStorage() { return nullptr; } 470 471 NS_IMETHODIMP 472 TRRLoadInfo::GetCspEventListener(nsICSPEventListener** aCSPEventListener) { 473 return NS_ERROR_NOT_IMPLEMENTED; 474 } 475 476 NS_IMETHODIMP 477 TRRLoadInfo::SetCspEventListener(nsICSPEventListener* aCSPEventListener) { 478 return NS_ERROR_NOT_IMPLEMENTED; 479 } 480 481 already_AddRefed<nsIContentSecurityPolicy> TRRLoadInfo::GetPreloadCsp() { 482 return nullptr; 483 } 484 485 already_AddRefed<nsIPolicyContainer> TRRLoadInfo::GetPolicyContainer() { 486 return nullptr; 487 } 488 489 already_AddRefed<nsIPolicyContainer> 490 TRRLoadInfo::GetPolicyContainerToInherit() { 491 return nullptr; 492 } 493 494 Maybe<FeaturePolicyInfo> TRRLoadInfo::GetContainerFeaturePolicyInfo() { 495 return Nothing(); 496 } 497 498 void TRRLoadInfo::SetContainerFeaturePolicyInfo( 499 const FeaturePolicyInfo& aContainerFeaturePolicyInfo) {} 500 501 NS_IMETHODIMP 502 TRRLoadInfo::GetIsSameDocumentNavigation(bool* aTextDirectiveUserActivation) { 503 return NS_ERROR_NOT_IMPLEMENTED; 504 } 505 506 NS_IMETHODIMP 507 TRRLoadInfo::SetIsSameDocumentNavigation(bool aTextDirectiveUserActivation) { 508 return NS_ERROR_NOT_IMPLEMENTED; 509 } 510 511 NS_IMETHODIMP 512 TRRLoadInfo::GetInternalContentPolicyType(nsContentPolicyType* aResult) { 513 *aResult = mInternalContentPolicyType; 514 return NS_OK; 515 } 516 NS_IMETHODIMP 517 TRRLoadInfo::GetIsUserTriggeredSave(bool* aIsUserTriggeredSave) { 518 return NS_ERROR_NOT_IMPLEMENTED; 519 } 520 521 NS_IMETHODIMP 522 TRRLoadInfo::SetIsUserTriggeredSave(bool aIsUserTriggeredSave) { 523 return NS_ERROR_NOT_IMPLEMENTED; 524 } 525 526 NS_IMETHODIMP 527 TRRLoadInfo::GetUnstrippedURI(nsIURI** aURI) { 528 return NS_ERROR_NOT_IMPLEMENTED; 529 } 530 531 NS_IMETHODIMP 532 TRRLoadInfo::SetUnstrippedURI(nsIURI* aURI) { return NS_ERROR_NOT_IMPLEMENTED; } 533 534 nsIInterceptionInfo* TRRLoadInfo::InterceptionInfo() { return nullptr; } 535 void TRRLoadInfo::SetInterceptionInfo(nsIInterceptionInfo* aPrincipla) {} 536 537 NS_IMETHODIMP 538 TRRLoadInfo::GetSchemelessInput( 539 nsILoadInfo::SchemelessInputType* aSchemelessInput) { 540 *aSchemelessInput = nsILoadInfo::SchemelessInputTypeUnset; 541 return NS_OK; 542 } 543 544 NS_IMETHODIMP 545 TRRLoadInfo::SetSchemelessInput( 546 nsILoadInfo::SchemelessInputType aSchemelessInput) { 547 return NS_ERROR_NOT_IMPLEMENTED; 548 } 549 550 NS_IMETHODIMP 551 TRRLoadInfo::GetSkipHTTPSUpgrade(bool* aSkipHTTPSUpgrade) { 552 return NS_ERROR_NOT_IMPLEMENTED; 553 } 554 555 NS_IMETHODIMP 556 TRRLoadInfo::SetSkipHTTPSUpgrade(bool aSkipHTTPSUpgrade) { 557 return NS_ERROR_NOT_IMPLEMENTED; 558 } 559 560 NS_IMETHODIMP 561 TRRLoadInfo::GetFetchDestination(nsACString& aDestination) { 562 return NS_ERROR_NOT_IMPLEMENTED; 563 } 564 565 } // namespace net 566 } // namespace mozilla