1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
#include "nsDocShellLoadState.h"
#include "nsIDocShell.h"
#include "nsDocShell.h"
#include "nsILoadInfo.h"
#include "nsIProtocolHandler.h"
#include "nsISHEntry.h"
#include "nsIURIFixup.h"
#include "nsIWebNavigation.h"
#include "nsIChannel.h"
#include "nsIURLQueryStringStripper.h"
#include "nsIXULRuntime.h"
#include "nsNetUtil.h"
#include "nsQueryObject.h"
#include "ReferrerInfo.h"
#include "mozilla/BasePrincipal.h"
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/Components.h"
#include "mozilla/dom/BrowsingContext.h"
#include "mozilla/dom/ContentChild.h"
#include "mozilla/dom/ContentParent.h"
#include "mozilla/dom/FormData.h"
#include "mozilla/dom/LoadURIOptionsBinding.h"
#include "mozilla/dom/Navigation.h"
#include "mozilla/dom/NavigationUtils.h"
#include "mozilla/dom/nsHTTPSOnlyUtils.h"
#include "mozilla/StaticPrefs_browser.h"
#include "mozilla/StaticPrefs_fission.h"
#include "mozilla/glean/AntitrackingMetrics.h"
#include "mozilla/OriginAttributes.h"
#include "mozilla/NullPrincipal.h"
#include "mozilla/StaticPtr.h"
#include "mozilla/dom/PContent.h"
using namespace mozilla;
using namespace mozilla::dom;
// Global reference to the URI fixup service.
static mozilla::StaticRefPtr<nsIURIFixup> sURIFixup;
nsDocShellLoadState::nsDocShellLoadState(nsIURI* aURI)
: nsDocShellLoadState(aURI, nsContentUtils::GenerateLoadIdentifier()) {}
nsDocShellLoadState::nsDocShellLoadState(
const DocShellLoadStateInit& aLoadState, mozilla::ipc::IProtocol* aActor,
bool* aReadSuccess)
: mNotifiedBeforeUnloadListeners(false),
mLoadIdentifier(aLoadState.LoadIdentifier()) {
// If we return early, we failed to read in the data.
*aReadSuccess = false;
if (!aLoadState.URI()) {
MOZ_ASSERT_UNREACHABLE("Cannot create a LoadState with a null URI!");
return;
}
mResultPrincipalURI = aLoadState.ResultPrincipalURI();
mResultPrincipalURIIsSome = aLoadState.ResultPrincipalURIIsSome();
mKeepResultPrincipalURIIfSet = aLoadState.KeepResultPrincipalURIIfSet();
mLoadReplace = aLoadState.LoadReplace();
mInheritPrincipal = aLoadState.InheritPrincipal();
mPrincipalIsExplicit = aLoadState.PrincipalIsExplicit();
mNotifiedBeforeUnloadListeners = aLoadState.NotifiedBeforeUnloadListeners();
mForceAllowDataURI = aLoadState.ForceAllowDataURI();
mIsExemptFromHTTPSFirstMode = aLoadState.IsExemptFromHTTPSFirstMode();
mOriginalFrameSrc = aLoadState.OriginalFrameSrc();
mShouldCheckForRecursion = aLoadState.ShouldCheckForRecursion();
mIsFormSubmission = aLoadState.IsFormSubmission();
mNeedsCompletelyLoadedDocument = aLoadState.NeedsCompletelyLoadedDocument();
mHistoryBehavior = aLoadState.HistoryBehavior();
mLoadType = aLoadState.LoadType();
mTarget = aLoadState.Target();
mTargetBrowsingContext = aLoadState.TargetBrowsingContext();
mLoadFlags = aLoadState.LoadFlags();
mInternalLoadFlags = aLoadState.InternalLoadFlags();
mFirstParty = aLoadState.FirstParty();
mHasValidUserGestureActivation = aLoadState.HasValidUserGestureActivation();
mTextDirectiveUserActivation = aLoadState.TextDirectiveUserActivation();
mAllowFocusMove = aLoadState.AllowFocusMove();
mTypeHint = aLoadState.TypeHint();
mFileName = aLoadState.FileName();
mIsFromProcessingFrameAttributes =
aLoadState.IsFromProcessingFrameAttributes();
mReferrerInfo = aLoadState.ReferrerInfo();
mURI = aLoadState.URI();
mOriginalURI = aLoadState.OriginalURI();
mSourceBrowsingContext = aLoadState.SourceBrowsingContext();
mBaseURI = aLoadState.BaseURI();
mTriggeringPrincipal = aLoadState.TriggeringPrincipal();
mPrincipalToInherit = aLoadState.PrincipalToInherit();
mPartitionedPrincipalToInherit = aLoadState.PartitionedPrincipalToInherit();
mTriggeringSandboxFlags = aLoadState.TriggeringSandboxFlags();
mTriggeringWindowId = aLoadState.TriggeringWindowId();
mTriggeringStorageAccess = aLoadState.TriggeringStorageAccess();
mTriggeringClassificationFlags = aLoadState.TriggeringClassificationFlags();
mTriggeringRemoteType = aLoadState.TriggeringRemoteType();
mSchemelessInput = aLoadState.SchemelessInput();
mForceMediaDocument = aLoadState.forceMediaDocument();
mHttpsUpgradeTelemetry = aLoadState.HttpsUpgradeTelemetry();
mPolicyContainer = aLoadState.PolicyContainer();
mOriginalURIString = aLoadState.OriginalURIString();
mCancelContentJSEpoch = aLoadState.CancelContentJSEpoch();
mPostDataStream = aLoadState.PostDataStream();
mHeadersStream = aLoadState.HeadersStream();
mSrcdocData = aLoadState.SrcdocData();
mChannelInitialized = aLoadState.ChannelInitialized();
mIsMetaRefresh = aLoadState.IsMetaRefresh();
if (aLoadState.loadingSessionHistoryInfo().isSome()) {
mLoadingSessionHistoryInfo = MakeUnique<LoadingSessionHistoryInfo>(
aLoadState.loadingSessionHistoryInfo().ref());
}
mUnstrippedURI = aLoadState.UnstrippedURI();
mRemoteTypeOverride = aLoadState.RemoteTypeOverride();
mIsCaptivePortalTab = aLoadState.IsCaptivePortalTab();
if (aLoadState.NavigationAPIState()) {
mNavigationAPIState = MakeRefPtr<nsStructuredCloneContainer>();
mNavigationAPIState->CopyFromClonedMessageData(
*aLoadState.NavigationAPIState());
}
// We know this was created remotely, as we just received it over IPC.
mWasCreatedRemotely = true;
// If we're in the parent process, potentially validate against a LoadState
// which we sent to the source content process.
if (XRE_IsParentProcess()) {
mozilla::ipc::IToplevelProtocol* top = aActor->ToplevelProtocol();
if (!top ||
top->GetProtocolId() != mozilla::ipc::ProtocolId::PContentMsgStart ||
top->GetSide() != mozilla::ipc::ParentSide) {
aActor->FatalError("nsDocShellLoadState must be received over PContent");
return;
}
ContentParent* cp = static_cast<ContentParent*>(top);
// If this load was sent down to the content process as a navigation
// request, ensure it still matches the one we sent down.
if (RefPtr<nsDocShellLoadState> originalState =
cp->TakePendingLoadStateForId(mLoadIdentifier)) {
if (const char* mismatch = ValidateWithOriginalState(originalState)) {
aActor->FatalError(
nsPrintfCString(
"nsDocShellLoadState %s changed while in content process",
mismatch)
.get());
return;
}
} else if (mTriggeringRemoteType != cp->GetRemoteType()) {
// If we don't have a previous load to compare to, the content process
// must be the triggering process.
aActor->FatalError(
"nsDocShellLoadState with invalid triggering remote type");
return;
}
}
// We successfully read in the data - return a success value.
*aReadSuccess = true;
}
nsDocShellLoadState::nsDocShellLoadState(const nsDocShellLoadState& aOther)
: mReferrerInfo(aOther.mReferrerInfo),
mURI(aOther.mURI),
mOriginalURI(aOther.mOriginalURI),
mResultPrincipalURI(aOther.mResultPrincipalURI),
mResultPrincipalURIIsSome(aOther.mResultPrincipalURIIsSome),
mTriggeringPrincipal(aOther.mTriggeringPrincipal),
mTriggeringSandboxFlags(aOther.mTriggeringSandboxFlags),
mTriggeringWindowId(aOther.mTriggeringWindowId),
mTriggeringStorageAccess(aOther.mTriggeringStorageAccess),
mTriggeringClassificationFlags(aOther.mTriggeringClassificationFlags),
mPolicyContainer(aOther.mPolicyContainer),
mKeepResultPrincipalURIIfSet(aOther.mKeepResultPrincipalURIIfSet),
mLoadReplace(aOther.mLoadReplace),
mInheritPrincipal(aOther.mInheritPrincipal),
mPrincipalIsExplicit(aOther.mPrincipalIsExplicit),
mNotifiedBeforeUnloadListeners(aOther.mNotifiedBeforeUnloadListeners),
mPrincipalToInherit(aOther.mPrincipalToInherit),
mPartitionedPrincipalToInherit(aOther.mPartitionedPrincipalToInherit),
mForceAllowDataURI(aOther.mForceAllowDataURI),
mIsExemptFromHTTPSFirstMode(aOther.mIsExemptFromHTTPSFirstMode),
mHttpsFirstDowngradeData(aOther.GetHttpsFirstDowngradeData()),
mOriginalFrameSrc(aOther.mOriginalFrameSrc),
mShouldCheckForRecursion(aOther.mShouldCheckForRecursion),
mIsFormSubmission(aOther.mIsFormSubmission),
mNeedsCompletelyLoadedDocument(aOther.mNeedsCompletelyLoadedDocument),
mHistoryBehavior(aOther.mHistoryBehavior),
mLoadType(aOther.mLoadType),
mSHEntry(aOther.mSHEntry),
mTarget(aOther.mTarget),
mTargetBrowsingContext(aOther.mTargetBrowsingContext),
mPostDataStream(aOther.mPostDataStream),
mHeadersStream(aOther.mHeadersStream),
mSrcdocData(aOther.mSrcdocData),
mSourceBrowsingContext(aOther.mSourceBrowsingContext),
mBaseURI(aOther.mBaseURI),
mLoadFlags(aOther.mLoadFlags),
mInternalLoadFlags(aOther.mInternalLoadFlags),
mFirstParty(aOther.mFirstParty),
mHasValidUserGestureActivation(aOther.mHasValidUserGestureActivation),
mTextDirectiveUserActivation(aOther.mTextDirectiveUserActivation),
mAllowFocusMove(aOther.mAllowFocusMove),
mTypeHint(aOther.mTypeHint),
mFileName(aOther.mFileName),
mIsFromProcessingFrameAttributes(aOther.mIsFromProcessingFrameAttributes),
mPendingRedirectedChannel(aOther.mPendingRedirectedChannel),
mOriginalURIString(aOther.mOriginalURIString),
mCancelContentJSEpoch(aOther.mCancelContentJSEpoch),
mLoadIdentifier(aOther.mLoadIdentifier),
mChannelInitialized(aOther.mChannelInitialized),
mIsMetaRefresh(aOther.mIsMetaRefresh),
mWasCreatedRemotely(aOther.mWasCreatedRemotely),
mUnstrippedURI(aOther.mUnstrippedURI),
mRemoteTypeOverride(aOther.mRemoteTypeOverride),
mTriggeringRemoteType(aOther.mTriggeringRemoteType),
mSchemelessInput(aOther.mSchemelessInput),
mForceMediaDocument(aOther.mForceMediaDocument),
mHttpsUpgradeTelemetry(aOther.mHttpsUpgradeTelemetry),
mNavigationAPIState(aOther.mNavigationAPIState) {
MOZ_DIAGNOSTIC_ASSERT(
XRE_IsParentProcess(),
"Cloning a nsDocShellLoadState with the same load identifier is only "
"allowed in the parent process, as it could break triggering remote type "
"tracking in content.");
if (aOther.mLoadingSessionHistoryInfo) {
mLoadingSessionHistoryInfo = MakeUnique<LoadingSessionHistoryInfo>(
*aOther.mLoadingSessionHistoryInfo);
}
}
nsDocShellLoadState::nsDocShellLoadState(nsIURI* aURI, uint64_t aLoadIdentifier)
: mURI(aURI),
mResultPrincipalURIIsSome(false),
mTriggeringSandboxFlags(0),
mTriggeringWindowId(0),
mTriggeringStorageAccess(false),
mTriggeringClassificationFlags({0, 0}),
mKeepResultPrincipalURIIfSet(false),
mLoadReplace(false),
mInheritPrincipal(false),
mPrincipalIsExplicit(false),
mNotifiedBeforeUnloadListeners(false),
mForceAllowDataURI(false),
mIsExemptFromHTTPSFirstMode(false),
mOriginalFrameSrc(false),
mShouldCheckForRecursion(false),
mIsFormSubmission(false),
mNeedsCompletelyLoadedDocument(false),
mHistoryBehavior(Nothing()),
mLoadType(LOAD_NORMAL),
mSrcdocData(VoidString()),
mLoadFlags(0),
mInternalLoadFlags(0),
mFirstParty(false),
mHasValidUserGestureActivation(false),
mAllowFocusMove(false),
mTypeHint(VoidCString()),
mFileName(VoidString()),
mIsFromProcessingFrameAttributes(false),
mLoadIdentifier(aLoadIdentifier),
mChannelInitialized(false),
mIsMetaRefresh(false),
mWasCreatedRemotely(false),
mTriggeringRemoteType(XRE_IsContentProcess()
? ContentChild::GetSingleton()->GetRemoteType()
: NOT_REMOTE_TYPE),
mSchemelessInput(nsILoadInfo::SchemelessInputTypeUnset) {
MOZ_ASSERT(aURI, "Cannot create a LoadState with a null URI!");
// For https telemetry we set a flag indicating whether the load is https.
// There are some corner cases, e.g. view-source and also about: pages.
// about: pages, when hitting the network, always redirect to https.
// Since we record https telemetry only within nsHTTPSChannel, it's fine
// to set the flag here.
nsCOMPtr<nsIURI> innerURI = NS_GetInnermostURI(aURI);
if (innerURI->SchemeIs("https") || innerURI->SchemeIs("about")) {
mHttpsUpgradeTelemetry = nsILoadInfo::ALREADY_HTTPS;
} else {
mHttpsUpgradeTelemetry = nsILoadInfo::NO_UPGRADE;
}
}
nsDocShellLoadState::~nsDocShellLoadState() {
if (mWasCreatedRemotely && XRE_IsContentProcess() &&
ContentChild::GetSingleton()->CanSend()) {
ContentChild::GetSingleton()->SendCleanupPendingLoadState(mLoadIdentifier);
}
}
nsresult nsDocShellLoadState::CreateFromPendingChannel(
nsIChannel* aPendingChannel, uint64_t aLoadIdentifier,
uint64_t aRegistrarId, nsDocShellLoadState** aResult) {
// Create the nsDocShellLoadState object with default state pulled from the
// passed-in channel.
nsCOMPtr<nsIURI> uri;
nsresult rv = aPendingChannel->GetURI(getter_AddRefs(uri));
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
RefPtr<nsDocShellLoadState> loadState =
new nsDocShellLoadState(uri, aLoadIdentifier);
loadState->mPendingRedirectedChannel = aPendingChannel;
loadState->mChannelRegistrarId = aRegistrarId;
// Pull relevant state from the channel, and store it on the
// nsDocShellLoadState.
nsCOMPtr<nsIURI> originalUri;
rv = aPendingChannel->GetOriginalURI(getter_AddRefs(originalUri));
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
loadState->SetOriginalURI(originalUri);
nsCOMPtr<nsILoadInfo> loadInfo = aPendingChannel->LoadInfo();
loadState->SetTriggeringPrincipal(loadInfo->TriggeringPrincipal());
// Return the newly created loadState.
loadState.forget(aResult);
return NS_OK;
}
static uint32_t WebNavigationFlagsToFixupFlags(nsIURI* aURI,
const nsACString& aURIString,
uint32_t aNavigationFlags) {
if (aURI) {
aNavigationFlags &= ~nsIWebNavigation::LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP;
}
uint32_t fixupFlags = nsIURIFixup::FIXUP_FLAG_NONE;
if (aNavigationFlags & nsIWebNavigation::LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP) {
fixupFlags |= nsIURIFixup::FIXUP_FLAG_ALLOW_KEYWORD_LOOKUP;
}
if (aNavigationFlags & nsIWebNavigation::LOAD_FLAGS_FIXUP_SCHEME_TYPOS) {
fixupFlags |= nsIURIFixup::FIXUP_FLAG_FIX_SCHEME_TYPOS;
}
return fixupFlags;
};
nsresult nsDocShellLoadState::CreateFromLoadURIOptions(
BrowsingContext* aBrowsingContext, const nsAString& aURI,
const LoadURIOptions& aLoadURIOptions, nsDocShellLoadState** aResult) {
uint32_t loadFlags = aLoadURIOptions.mLoadFlags;
NS_ASSERTION(
(loadFlags & nsDocShell::INTERNAL_LOAD_FLAGS_LOADURI_SETUP_FLAGS) == 0,
"Unexpected flags");
nsCOMPtr<nsIURI> uri;
nsresult rv = NS_OK;
NS_ConvertUTF16toUTF8 uriString(aURI);
// Cleanup the empty spaces that might be on each end.
uriString.Trim(" ");
// Eliminate embedded newlines, which single-line text fields now allow:
uriString.StripCRLF();
NS_ENSURE_TRUE(!uriString.IsEmpty(), NS_ERROR_FAILURE);
// Just create a URI and see what happens...
rv = NS_NewURI(getter_AddRefs(uri), uriString);
bool fixup = true;
if (NS_SUCCEEDED(rv) && uri &&
(uri->SchemeIs("about") || uri->SchemeIs("chrome"))) {
// Avoid third party fixup as a performance optimization.
loadFlags &= ~nsIWebNavigation::LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP;
fixup = false;
} else if (!sURIFixup && !XRE_IsContentProcess()) {
nsCOMPtr<nsIURIFixup> uriFixup = components::URIFixup::Service();
if (uriFixup) {
sURIFixup = uriFixup;
ClearOnShutdown(&sURIFixup);
} else {
fixup = false;
}
}
nsAutoString searchProvider, keyword;
RefPtr<nsIInputStream> fixupStream;
if (fixup) {
uint32_t fixupFlags =
WebNavigationFlagsToFixupFlags(uri, uriString, loadFlags);
// If we don't allow keyword lookups for this URL string, make sure to
// update loadFlags to indicate this as well.
if (!(fixupFlags & nsIURIFixup::FIXUP_FLAG_ALLOW_KEYWORD_LOOKUP)) {
loadFlags &= ~nsIWebNavigation::LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP;
}
// Ensure URIFixup will use the right search engine in Private Browsing.
if (aBrowsingContext->UsePrivateBrowsing()) {
fixupFlags |= nsIURIFixup::FIXUP_FLAG_PRIVATE_CONTEXT;
}
if (!XRE_IsContentProcess()) {
nsCOMPtr<nsIURIFixupInfo> fixupInfo;
sURIFixup->GetFixupURIInfo(uriString, fixupFlags,
getter_AddRefs(fixupInfo));
if (fixupInfo) {
// We could fix the uri, clear NS_ERROR_MALFORMED_URI.
rv = NS_OK;
fixupInfo->GetPreferredURI(getter_AddRefs(uri));
fixupInfo->SetConsumer(aBrowsingContext);
fixupInfo->GetKeywordProviderName(searchProvider);
fixupInfo->GetKeywordAsSent(keyword);
// GetFixupURIInfo only returns a post data stream if it succeeded
// and changed the URI, in which case we should override the
// passed-in post data by passing this as an override arg to
// our internal method.
fixupInfo->GetPostData(getter_AddRefs(fixupStream));
if (fixupInfo &&
loadFlags & nsIWebNavigation::LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP) {
nsCOMPtr<nsIObserverService> serv = services::GetObserverService();
if (serv) {
serv->NotifyObservers(fixupInfo, "keyword-uri-fixup",
PromiseFlatString(aURI).get());
}
}
nsDocShell::MaybeNotifyKeywordSearchLoading(searchProvider, keyword);
}
}
}
if (rv == NS_ERROR_MALFORMED_URI) {
MOZ_ASSERT(!uri);
return rv;
}
if (NS_FAILED(rv) || !uri) {
return NS_ERROR_FAILURE;
}
RefPtr<nsDocShellLoadState> loadState;
rv = CreateFromLoadURIOptions(
aBrowsingContext, uri, aLoadURIOptions, loadFlags,
fixupStream ? fixupStream : aLoadURIOptions.mPostData,
getter_AddRefs(loadState));
NS_ENSURE_SUCCESS(rv, rv);
loadState->SetOriginalURIString(uriString);
loadState.forget(aResult);
return NS_OK;
}
nsresult nsDocShellLoadState::CreateFromLoadURIOptions(
BrowsingContext* aBrowsingContext, nsIURI* aURI,
const LoadURIOptions& aLoadURIOptions, nsDocShellLoadState** aResult) {
return CreateFromLoadURIOptions(aBrowsingContext, aURI, aLoadURIOptions,
aLoadURIOptions.mLoadFlags,
aLoadURIOptions.mPostData, aResult);
}
nsresult nsDocShellLoadState::CreateFromLoadURIOptions(
BrowsingContext* aBrowsingContext, nsIURI* aURI,
const LoadURIOptions& aLoadURIOptions, uint32_t aLoadFlagsOverride,
nsIInputStream* aPostDataOverride, nsDocShellLoadState** aResult) {
nsresult rv = NS_OK;
uint32_t loadFlags = aLoadFlagsOverride;
RefPtr<nsIInputStream> postData = aPostDataOverride;
uint64_t available;
if (postData) {
rv = postData->Available(&available);
NS_ENSURE_SUCCESS(rv, rv);
if (available == 0) {
return NS_ERROR_INVALID_ARG;
}
}
if (aLoadURIOptions.mHeaders) {
rv = aLoadURIOptions.mHeaders->Available(&available);
NS_ENSURE_SUCCESS(rv, rv);
if (available == 0) {
return NS_ERROR_INVALID_ARG;
}
}
bool forceAllowDataURI =
loadFlags & nsIWebNavigation::LOAD_FLAGS_FORCE_ALLOW_DATA_URI;
// Don't pass certain flags that aren't needed and end up confusing
// ConvertLoadTypeToDocShellInfoLoadType. We do need to ensure that they are
// passed to LoadURI though, since it uses them.
uint32_t extraFlags = (loadFlags & EXTRA_LOAD_FLAGS);
loadFlags &= ~EXTRA_LOAD_FLAGS;
RefPtr<nsDocShellLoadState> loadState = new nsDocShellLoadState(aURI);
loadState->SetReferrerInfo(aLoadURIOptions.mReferrerInfo);
loadState->SetLoadType(MAKE_LOAD_TYPE(LOAD_NORMAL, loadFlags));
loadState->SetLoadFlags(extraFlags);
loadState->SetFirstParty(true);
loadState->SetHasValidUserGestureActivation(
aLoadURIOptions.mHasValidUserGestureActivation);
loadState->SetTextDirectiveUserActivation(
aLoadURIOptions.mTextDirectiveUserActivation);
loadState->SetTriggeringSandboxFlags(aLoadURIOptions.mTriggeringSandboxFlags);
loadState->SetTriggeringWindowId(aLoadURIOptions.mTriggeringWindowId);
loadState->SetTriggeringStorageAccess(
aLoadURIOptions.mTriggeringStorageAccess);
// The load is assumed to be first-party, so the triggering classification
// should be both zero.
loadState->SetTriggeringClassificationFlags({0, 0});
loadState->SetPostDataStream(postData);
loadState->SetHeadersStream(aLoadURIOptions.mHeaders);
loadState->SetBaseURI(aLoadURIOptions.mBaseURI);
loadState->SetTriggeringPrincipal(aLoadURIOptions.mTriggeringPrincipal);
loadState->SetPolicyContainer(aLoadURIOptions.mPolicyContainer);
loadState->SetForceAllowDataURI(forceAllowDataURI);
if (aLoadURIOptions.mCancelContentJSEpoch) {
loadState->SetCancelContentJSEpoch(aLoadURIOptions.mCancelContentJSEpoch);
}
if (aLoadURIOptions.mTriggeringRemoteType.WasPassed()) {
if (XRE_IsParentProcess()) {
loadState->SetTriggeringRemoteType(
aLoadURIOptions.mTriggeringRemoteType.Value());
} else if (ContentChild::GetSingleton()->GetRemoteType() !=
aLoadURIOptions.mTriggeringRemoteType.Value()) {
NS_WARNING("Invalid TriggeringRemoteType from LoadURIOptions in content");
return NS_ERROR_INVALID_ARG;
}
}
if (aLoadURIOptions.mRemoteTypeOverride.WasPassed()) {
loadState->SetRemoteTypeOverride(
aLoadURIOptions.mRemoteTypeOverride.Value());
}
loadState->SetSchemelessInput(static_cast<nsILoadInfo::SchemelessInputType>(
aLoadURIOptions.mSchemelessInput));
loadState->SetForceMediaDocument(aLoadURIOptions.mForceMediaDocument);
loadState->SetAppLinkLaunchType(aLoadURIOptions.mAppLinkLaunchType);
loadState->SetIsCaptivePortalTab(aLoadURIOptions.mIsCaptivePortalTab);
loadState.forget(aResult);
return NS_OK;
}
nsIReferrerInfo* nsDocShellLoadState::GetReferrerInfo() const {
return mReferrerInfo;
}
void nsDocShellLoadState::SetReferrerInfo(nsIReferrerInfo* aReferrerInfo) {
mReferrerInfo = aReferrerInfo;
}
nsIURI* nsDocShellLoadState::URI() const { return mURI; }
void nsDocShellLoadState::SetURI(nsIURI* aURI) { mURI = aURI; }
nsIURI* nsDocShellLoadState::OriginalURI() const { return mOriginalURI; }
void nsDocShellLoadState::SetOriginalURI(nsIURI* aOriginalURI) {
mOriginalURI = aOriginalURI;
}
nsIURI* nsDocShellLoadState::ResultPrincipalURI() const {
return mResultPrincipalURI;
}
void nsDocShellLoadState::SetResultPrincipalURI(nsIURI* aResultPrincipalURI) {
mResultPrincipalURI = aResultPrincipalURI;
}
bool nsDocShellLoadState::ResultPrincipalURIIsSome() const {
return mResultPrincipalURIIsSome;
}
void nsDocShellLoadState::SetResultPrincipalURIIsSome(bool aIsSome) {
mResultPrincipalURIIsSome = aIsSome;
}
bool nsDocShellLoadState::KeepResultPrincipalURIIfSet() const {
return mKeepResultPrincipalURIIfSet;
}
void nsDocShellLoadState::SetKeepResultPrincipalURIIfSet(bool aKeep) {
mKeepResultPrincipalURIIfSet = aKeep;
}
bool nsDocShellLoadState::LoadReplace() const { return mLoadReplace; }
void nsDocShellLoadState::SetLoadReplace(bool aLoadReplace) {
mLoadReplace = aLoadReplace;
}
nsIPrincipal* nsDocShellLoadState::TriggeringPrincipal() const {
return mTriggeringPrincipal;
}
void nsDocShellLoadState::SetTriggeringPrincipal(
nsIPrincipal* aTriggeringPrincipal) {
mTriggeringPrincipal = aTriggeringPrincipal;
}
nsIPrincipal* nsDocShellLoadState::PrincipalToInherit() const {
return mPrincipalToInherit;
}
void nsDocShellLoadState::SetPrincipalToInherit(
nsIPrincipal* aPrincipalToInherit) {
mPrincipalToInherit = aPrincipalToInherit;
}
nsIPrincipal* nsDocShellLoadState::PartitionedPrincipalToInherit() const {
return mPartitionedPrincipalToInherit;
}
void nsDocShellLoadState::SetPartitionedPrincipalToInherit(
nsIPrincipal* aPartitionedPrincipalToInherit) {
mPartitionedPrincipalToInherit = aPartitionedPrincipalToInherit;
}
void nsDocShellLoadState::SetPolicyContainer(
nsIPolicyContainer* aPolicyContainer) {
mPolicyContainer = aPolicyContainer;
}
nsIPolicyContainer* nsDocShellLoadState::PolicyContainer() const {
return mPolicyContainer;
}
void nsDocShellLoadState::SetTriggeringSandboxFlags(uint32_t flags) {
mTriggeringSandboxFlags = flags;
}
uint32_t nsDocShellLoadState::TriggeringSandboxFlags() const {
return mTriggeringSandboxFlags;
}
void nsDocShellLoadState::SetTriggeringWindowId(uint64_t aTriggeringWindowId) {
mTriggeringWindowId = aTriggeringWindowId;
}
uint64_t nsDocShellLoadState::TriggeringWindowId() const {
return mTriggeringWindowId;
}
void nsDocShellLoadState::SetTriggeringStorageAccess(
bool aTriggeringStorageAccess) {
mTriggeringStorageAccess = aTriggeringStorageAccess;
}
bool nsDocShellLoadState::TriggeringStorageAccess() const {
return mTriggeringStorageAccess;
}
mozilla::net::ClassificationFlags
nsDocShellLoadState::TriggeringClassificationFlags() const {
return mTriggeringClassificationFlags;
}
void nsDocShellLoadState::SetTriggeringClassificationFlags(
mozilla::net::ClassificationFlags aFlags) {
mTriggeringClassificationFlags = aFlags;
}
bool nsDocShellLoadState::InheritPrincipal() const { return mInheritPrincipal; }
void nsDocShellLoadState::SetInheritPrincipal(bool aInheritPrincipal) {
mInheritPrincipal = aInheritPrincipal;
}
bool nsDocShellLoadState::PrincipalIsExplicit() const {
return mPrincipalIsExplicit;
}
void nsDocShellLoadState::SetPrincipalIsExplicit(bool aPrincipalIsExplicit) {
mPrincipalIsExplicit = aPrincipalIsExplicit;
}
bool nsDocShellLoadState::NotifiedBeforeUnloadListeners() const {
return mNotifiedBeforeUnloadListeners;
}
void nsDocShellLoadState::SetNotifiedBeforeUnloadListeners(
bool aNotifiedBeforeUnloadListeners) {
mNotifiedBeforeUnloadListeners = aNotifiedBeforeUnloadListeners;
}
bool nsDocShellLoadState::ForceAllowDataURI() const {
return mForceAllowDataURI;
}
void nsDocShellLoadState::SetForceAllowDataURI(bool aForceAllowDataURI) {
mForceAllowDataURI = aForceAllowDataURI;
}
bool nsDocShellLoadState::IsExemptFromHTTPSFirstMode() const {
return mIsExemptFromHTTPSFirstMode;
}
void nsDocShellLoadState::SetIsExemptFromHTTPSFirstMode(
bool aIsExemptFromHTTPSFirstMode) {
mIsExemptFromHTTPSFirstMode = aIsExemptFromHTTPSFirstMode;
}
RefPtr<HTTPSFirstDowngradeData>
nsDocShellLoadState::GetHttpsFirstDowngradeData() const {
return mHttpsFirstDowngradeData;
}
void nsDocShellLoadState::SetHttpsFirstDowngradeData(
RefPtr<HTTPSFirstDowngradeData> const& aHttpsFirstTelemetryData) {
mHttpsFirstDowngradeData = aHttpsFirstTelemetryData;
}
bool nsDocShellLoadState::OriginalFrameSrc() const { return mOriginalFrameSrc; }
void nsDocShellLoadState::SetOriginalFrameSrc(bool aOriginalFrameSrc) {
mOriginalFrameSrc = aOriginalFrameSrc;
}
bool nsDocShellLoadState::ShouldCheckForRecursion() const {
return mShouldCheckForRecursion;
}
void nsDocShellLoadState::SetShouldCheckForRecursion(
bool aShouldCheckForRecursion) {
mShouldCheckForRecursion = aShouldCheckForRecursion;
}
bool nsDocShellLoadState::IsFormSubmission() const { return mIsFormSubmission; }
void nsDocShellLoadState::SetIsFormSubmission(bool aIsFormSubmission) {
mIsFormSubmission = aIsFormSubmission;
}
bool nsDocShellLoadState::NeedsCompletelyLoadedDocument() const {
return mNeedsCompletelyLoadedDocument;
}
void nsDocShellLoadState::SetNeedsCompletelyLoadedDocument(
bool aNeedsCompletelyLoadedDocument) {
mNeedsCompletelyLoadedDocument = aNeedsCompletelyLoadedDocument;
}
Maybe<mozilla::dom::NavigationHistoryBehavior>
nsDocShellLoadState::HistoryBehavior() const {
return mHistoryBehavior;
}
void nsDocShellLoadState::SetHistoryBehavior(
mozilla::dom::NavigationHistoryBehavior aHistoryBehavior) {
mHistoryBehavior = Some(aHistoryBehavior);
}
void nsDocShellLoadState::ResetHistoryBehavior() {
mHistoryBehavior = Nothing();
}
uint32_t nsDocShellLoadState::LoadType() const { return mLoadType; }
void nsDocShellLoadState::SetLoadType(uint32_t aLoadType) {
mLoadType = aLoadType;
}
mozilla::dom::UserNavigationInvolvement
nsDocShellLoadState::UserNavigationInvolvement() const {
return mUserNavigationInvolvement;
}
void nsDocShellLoadState::SetUserNavigationInvolvement(
mozilla::dom::UserNavigationInvolvement aUserNavigationInvolvement) {
mUserNavigationInvolvement = aUserNavigationInvolvement;
}
nsISHEntry* nsDocShellLoadState::SHEntry() const { return mSHEntry; }
void nsDocShellLoadState::SetSHEntry(nsISHEntry* aSHEntry) {
mSHEntry = aSHEntry;
nsCOMPtr<SessionHistoryEntry> she = do_QueryInterface(aSHEntry);
if (she) {
mLoadingSessionHistoryInfo = MakeUnique<LoadingSessionHistoryInfo>(she);
} else {
mLoadingSessionHistoryInfo = nullptr;
}
}
void nsDocShellLoadState::SetLoadingSessionHistoryInfo(
const mozilla::dom::LoadingSessionHistoryInfo& aLoadingInfo) {
SetLoadingSessionHistoryInfo(
MakeUnique<mozilla::dom::LoadingSessionHistoryInfo>(aLoadingInfo));
}
void nsDocShellLoadState::SetLoadingSessionHistoryInfo(
mozilla::UniquePtr<mozilla::dom::LoadingSessionHistoryInfo> aLoadingInfo) {
mLoadingSessionHistoryInfo = std::move(aLoadingInfo);
}
const mozilla::dom::LoadingSessionHistoryInfo*
nsDocShellLoadState::GetLoadingSessionHistoryInfo() const {
return mLoadingSessionHistoryInfo.get();
}
void nsDocShellLoadState::SetLoadIsFromSessionHistory(
int32_t aOffset, bool aLoadingCurrentEntry) {
if (mLoadingSessionHistoryInfo) {
mLoadingSessionHistoryInfo->mLoadIsFromSessionHistory = true;
mLoadingSessionHistoryInfo->mOffset = aOffset;
mLoadingSessionHistoryInfo->mLoadingCurrentEntry = aLoadingCurrentEntry;
}
}
void nsDocShellLoadState::ClearLoadIsFromSessionHistory() {
if (mLoadingSessionHistoryInfo) {
mLoadingSessionHistoryInfo->mLoadIsFromSessionHistory = false;
}
mSHEntry = nullptr;
}
bool nsDocShellLoadState::LoadIsFromSessionHistory() const {
return mLoadingSessionHistoryInfo
? mLoadingSessionHistoryInfo->mLoadIsFromSessionHistory
: !!mSHEntry;
}
void nsDocShellLoadState::MaybeStripTrackerQueryStrings(
BrowsingContext* aContext) {
MOZ_ASSERT(aContext);
// Return early if the triggering principal doesn't exist. This could happen
// when loading a URL by using a browsing context in the Browser Toolbox.
if (!TriggeringPrincipal()) {
return;
}
// We don't need to strip for sub frames because the query string has been
// stripped in the top-level content. Also, we don't apply stripping if it
// is triggered by addons.
//
// Note that we don't need to do the stripping if the channel has been
// initialized. This means that this has been loaded speculatively in the
// parent process before and the stripping was happening by then.
if (GetChannelInitialized() || !aContext->IsTopContent() ||
BasePrincipal::Cast(TriggeringPrincipal())->AddonPolicy()) {
return;
}
// We don't strip the URI if it's the same-site navigation. Note that we will
// consider the system principal triggered load as third-party in case the
// user copies and pastes a URL which has tracking query parameters or an
// loading from external applications, such as clicking a link in an email
// client.
bool isThirdPartyURI = false;
if (!TriggeringPrincipal()->IsSystemPrincipal() &&
(NS_FAILED(
TriggeringPrincipal()->IsThirdPartyURI(URI(), &isThirdPartyURI)) ||
!isThirdPartyURI)) {
return;
}
glean::contentblocking::query_stripping_count
.EnumGet(glean::contentblocking::QueryStrippingCountLabel::eNavigation)
.Add();
nsCOMPtr<nsIURI> strippedURI;
nsresult rv;
nsCOMPtr<nsIURLQueryStringStripper> queryStripper =
components::URLQueryStringStripper::Service(&rv);
NS_ENSURE_SUCCESS_VOID(rv);
uint32_t numStripped;
queryStripper->Strip(URI(), aContext->UsePrivateBrowsing(),
getter_AddRefs(strippedURI), &numStripped);
if (numStripped) {
if (!mUnstrippedURI) {
mUnstrippedURI = URI();
}
SetURI(strippedURI);
glean::contentblocking::query_stripping_count
.EnumGet(glean::contentblocking::QueryStrippingCountLabel::
eStripfornavigation)
.Add();
glean::contentblocking::query_stripping_param_count.AccumulateSingleSample(
numStripped);
}
#ifdef DEBUG
// Make sure that unstripped URI is the same as URI() but only the query
// string could be different.
if (mUnstrippedURI) {
nsCOMPtr<nsIURI> uri;
(void)queryStripper->Strip(mUnstrippedURI, aContext->UsePrivateBrowsing(),
getter_AddRefs(uri), &numStripped);
bool equals = false;
(void)URI()->Equals(uri, &equals);
MOZ_ASSERT(equals);
}
#endif
}
const nsString& nsDocShellLoadState::Target() const { return mTarget; }
void nsDocShellLoadState::SetTarget(const nsAString& aTarget) {
mTarget = aTarget;
}
nsIInputStream* nsDocShellLoadState::PostDataStream() const {
return mPostDataStream;
}
void nsDocShellLoadState::SetPostDataStream(nsIInputStream* aStream) {
mPostDataStream = aStream;
}
nsIInputStream* nsDocShellLoadState::HeadersStream() const {
return mHeadersStream;
}
void nsDocShellLoadState::SetHeadersStream(nsIInputStream* aHeadersStream) {
mHeadersStream = aHeadersStream;
}
const nsString& nsDocShellLoadState::SrcdocData() const { return mSrcdocData; }
void nsDocShellLoadState::SetSrcdocData(const nsAString& aSrcdocData) {
mSrcdocData = aSrcdocData;
}
void nsDocShellLoadState::SetSourceBrowsingContext(
BrowsingContext* aSourceBrowsingContext) {
mSourceBrowsingContext = aSourceBrowsingContext;
}
void nsDocShellLoadState::SetTargetBrowsingContext(
BrowsingContext* aTargetBrowsingContext) {
mTargetBrowsingContext = aTargetBrowsingContext;
}
nsIURI* nsDocShellLoadState::BaseURI() const { return mBaseURI; }
void nsDocShellLoadState::SetBaseURI(nsIURI* aBaseURI) { mBaseURI = aBaseURI; }
void nsDocShellLoadState::GetMaybeResultPrincipalURI(
mozilla::Maybe<nsCOMPtr<nsIURI>>& aRPURI) const {
bool isSome = ResultPrincipalURIIsSome();
aRPURI.reset();
if (!isSome) {
return;
}
nsCOMPtr<nsIURI> uri = ResultPrincipalURI();
aRPURI.emplace(std::move(uri));
}
void nsDocShellLoadState::SetMaybeResultPrincipalURI(
mozilla::Maybe<nsCOMPtr<nsIURI>> const& aRPURI) {
SetResultPrincipalURI(aRPURI.refOr(nullptr));
SetResultPrincipalURIIsSome(aRPURI.isSome());
}
uint32_t nsDocShellLoadState::LoadFlags() const { return mLoadFlags; }
void nsDocShellLoadState::SetLoadFlags(uint32_t aLoadFlags) {
mLoadFlags = aLoadFlags;
}
void nsDocShellLoadState::SetLoadFlag(uint32_t aFlag) { mLoadFlags |= aFlag; }
void nsDocShellLoadState::UnsetLoadFlag(uint32_t aFlag) {
mLoadFlags &= ~aFlag;
}
bool nsDocShellLoadState::HasLoadFlags(uint32_t aFlags) {
return (mLoadFlags & aFlags) == aFlags;
}
uint32_t nsDocShellLoadState::InternalLoadFlags() const {
return mInternalLoadFlags;
}
void nsDocShellLoadState::SetInternalLoadFlags(uint32_t aLoadFlags) {
mInternalLoadFlags = aLoadFlags;
}
void nsDocShellLoadState::SetInternalLoadFlag(uint32_t aFlag) {
mInternalLoadFlags |= aFlag;
}
void nsDocShellLoadState::UnsetInternalLoadFlag(uint32_t aFlag) {
mInternalLoadFlags &= ~aFlag;
}
bool nsDocShellLoadState::HasInternalLoadFlags(uint32_t aFlags) {
return (mInternalLoadFlags & aFlags) == aFlags;
}
bool nsDocShellLoadState::FirstParty() const { return mFirstParty; }
void nsDocShellLoadState::SetFirstParty(bool aFirstParty) {
mFirstParty = aFirstParty;
}
bool nsDocShellLoadState::HasValidUserGestureActivation() const {
return mHasValidUserGestureActivation;
}
void nsDocShellLoadState::SetHasValidUserGestureActivation(
bool aHasValidUserGestureActivation) {
mHasValidUserGestureActivation = aHasValidUserGestureActivation;
}
void nsDocShellLoadState::SetTextDirectiveUserActivation(
bool aTextDirectiveUserActivation) {
mTextDirectiveUserActivation = aTextDirectiveUserActivation;
}
bool nsDocShellLoadState::GetTextDirectiveUserActivation() {
return mTextDirectiveUserActivation;
}
const nsCString& nsDocShellLoadState::TypeHint() const { return mTypeHint; }
void nsDocShellLoadState::SetTypeHint(const nsCString& aTypeHint) {
mTypeHint = aTypeHint;
}
const nsString& nsDocShellLoadState::FileName() const { return mFileName; }
void nsDocShellLoadState::SetFileName(const nsAString& aFileName) {
MOZ_DIAGNOSTIC_ASSERT(aFileName.FindChar(char16_t(0)) == kNotFound,
"The filename should never contain null characters");
mFileName = aFileName;
}
void nsDocShellLoadState::SetRemoteTypeOverride(
const nsCString& aRemoteTypeOverride) {
MOZ_DIAGNOSTIC_ASSERT(
NS_IsAboutBlank(mURI),
"Should only have aRemoteTypeOverride for about:blank URIs");
mRemoteTypeOverride = mozilla::Some(aRemoteTypeOverride);
}
const nsCString& nsDocShellLoadState::GetEffectiveTriggeringRemoteType() const {
// Consider non-errorpage loads from session history as being triggred by the
// parent process, as we'll validate them against the history entry.
//
// NOTE: Keep this check in-sync with the session-history validation check in
// `DocumentLoadListener::Open`!
if (LoadIsFromSessionHistory() && LoadType() != LOAD_ERROR_PAGE) {
return NOT_REMOTE_TYPE;
}
return mTriggeringRemoteType;
}
void nsDocShellLoadState::SetTriggeringRemoteType(
const nsACString& aTriggeringRemoteType) {
MOZ_DIAGNOSTIC_ASSERT(XRE_IsParentProcess(), "only settable in parent");
mTriggeringRemoteType = aTriggeringRemoteType;
}
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
void nsDocShellLoadState::AssertProcessCouldTriggerLoadIfSystem() {
// Early check to see if we're trying to start a file URI load with a system
// principal within a web content process.
// If this assertion fails, the load will fail later during
// nsContentSecurityManager checks, however this assertion should happen
// closer to whichever caller is triggering the system-principal load.
if (mozilla::SessionHistoryInParent() &&
TriggeringPrincipal()->IsSystemPrincipal() &&
mozilla::dom::IsWebRemoteType(GetEffectiveTriggeringRemoteType())) {
bool localFile = false;
if (NS_SUCCEEDED(NS_URIChainHasFlags(
URI(), nsIProtocolHandler::URI_IS_LOCAL_FILE, &localFile)) &&
localFile) {
NS_WARNING(nsPrintfCString("Unexpected system load of file URI (%s) from "
"web content process",
URI()->GetSpecOrDefault().get())
.get());
MOZ_CRASH("Unexpected system load of file URI from web content process");
}
}
}
#endif
nsresult nsDocShellLoadState::SetupInheritingPrincipal(
BrowsingContext::Type aType,
const mozilla::OriginAttributes& aOriginAttributes) {
// We need a principalToInherit.
//
// If principalIsExplicit is not set there are 4 possibilities:
// (1) If the system principal or an expanded principal was passed
// in and we're a typeContent docshell, inherit the principal
// from the current document instead.
// (2) In all other cases when the principal passed in is not null,
// use that principal.
// (3) If the caller has allowed inheriting from the current document,
// or if we're being called from system code (eg chrome JS or pure
// C++) then inheritPrincipal should be true and InternalLoad will get
// a principal from the current document. If none of these things are
// true, then
// (4) we don't pass a principal into the channel, and a principal will be
// created later from the channel's internal data.
//
// If principalIsExplicit *is* set, there are 4 possibilities
// (1) If the system principal or an expanded principal was passed in
// and we're a typeContent docshell, return an error.
// (2) In all other cases when the principal passed in is not null,
// use that principal.
// (3) If the caller has allowed inheriting from the current document,
// then inheritPrincipal should be true and InternalLoad will get
// a principal from the current document. If none of these things are
// true, then
// (4) we dont' pass a principal into the channel, and a principal will be
// created later from the channel's internal data.
mPrincipalToInherit = mTriggeringPrincipal;
if (mPrincipalToInherit && aType != BrowsingContext::Type::Chrome) {
if (mPrincipalToInherit->IsSystemPrincipal()) {
if (mPrincipalIsExplicit) {
return NS_ERROR_DOM_SECURITY_ERR;
}
mPrincipalToInherit = nullptr;
mInheritPrincipal = true;
} else if (nsContentUtils::IsExpandedPrincipal(mPrincipalToInherit)) {
if (mPrincipalIsExplicit) {
return NS_ERROR_DOM_SECURITY_ERR;
}
// Don't inherit from the current page. Just do the safe thing
// and pretend that we were loaded by a nullprincipal.
//
// We didn't inherit OriginAttributes here as ExpandedPrincipal doesn't
// have origin attributes.
mPrincipalToInherit = NullPrincipal::Create(aOriginAttributes);
mInheritPrincipal = false;
}
}
if (!mPrincipalToInherit && !mInheritPrincipal && !mPrincipalIsExplicit) {
// See if there's system or chrome JS code running
mInheritPrincipal = nsContentUtils::LegacyIsCallerChromeOrNativeCode();
}
if (mLoadFlags & nsIWebNavigation::LOAD_FLAGS_DISALLOW_INHERIT_PRINCIPAL) {
mInheritPrincipal = false;
// Create a new null principal URI based on our precursor principal.
nsCOMPtr<nsIURI> nullPrincipalURI =
NullPrincipal::CreateURI(mPrincipalToInherit);
// If mFirstParty is true and the pref 'privacy.firstparty.isolate' is
// enabled, we will set firstPartyDomain on the origin attributes.
OriginAttributes attrs(aOriginAttributes);
if (mFirstParty) {
attrs.SetFirstPartyDomain(true, nullPrincipalURI);
}
mPrincipalToInherit = NullPrincipal::Create(attrs, nullPrincipalURI);
}
return NS_OK;
}
nsresult nsDocShellLoadState::SetupTriggeringPrincipal(
const mozilla::OriginAttributes& aOriginAttributes) {
// If the triggeringPrincipal is not set, we first try to create a principal
// from the referrer, since the referrer URI reflects the web origin that
// triggered the load. If there is no referrer URI, we fall back to using the
// SystemPrincipal. It's safe to assume that no provided triggeringPrincipal
// and no referrer simulate a load that was triggered by the system. It's
// important to note that this block of code needs to appear *after* the block
// where we munge the principalToInherit, because otherwise we would never
// enter code blocks checking if the principalToInherit is null and we will
// end up with a wrong inheritPrincipal flag.
if (!mTriggeringPrincipal) {
if (mReferrerInfo) {
nsCOMPtr<nsIURI> referrer = mReferrerInfo->GetOriginalReferrer();
mTriggeringPrincipal =
BasePrincipal::CreateContentPrincipal(referrer, aOriginAttributes);
if (!mTriggeringPrincipal) {
return NS_ERROR_FAILURE;
}
} else {
mTriggeringPrincipal = nsContentUtils::GetSystemPrincipal();
}
}
return NS_OK;
}
void nsDocShellLoadState::CalculateLoadURIFlags() {
if (mInheritPrincipal) {
MOZ_ASSERT(
!mPrincipalToInherit || !mPrincipalToInherit->IsSystemPrincipal(),
"Should not inherit SystemPrincipal");
mInternalLoadFlags |= nsDocShell::INTERNAL_LOAD_FLAGS_INHERIT_PRINCIPAL;
}
if (mReferrerInfo && !mReferrerInfo->GetSendReferrer()) {
mInternalLoadFlags |= nsDocShell::INTERNAL_LOAD_FLAGS_DONT_SEND_REFERRER;
}
if (mLoadFlags & nsIWebNavigation::LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP) {
mInternalLoadFlags |=
nsDocShell::INTERNAL_LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP;
}
if (mLoadFlags & nsIWebNavigation::LOAD_FLAGS_FIRST_LOAD) {
mInternalLoadFlags |= nsDocShell::INTERNAL_LOAD_FLAGS_FIRST_LOAD;
}
if (mLoadFlags & nsIWebNavigation::LOAD_FLAGS_BYPASS_CLASSIFIER) {
mInternalLoadFlags |= nsDocShell::INTERNAL_LOAD_FLAGS_BYPASS_CLASSIFIER;
}
if (mLoadFlags & nsIWebNavigation::LOAD_FLAGS_FORCE_ALLOW_COOKIES) {
mInternalLoadFlags |= nsDocShell::INTERNAL_LOAD_FLAGS_FORCE_ALLOW_COOKIES;
}
if (mLoadFlags & nsIWebNavigation::LOAD_FLAGS_BYPASS_LOAD_URI_DELEGATE) {
mInternalLoadFlags |=
nsDocShell::INTERNAL_LOAD_FLAGS_BYPASS_LOAD_URI_DELEGATE;
}
if (!mSrcdocData.IsVoid()) {
mInternalLoadFlags |= nsDocShell::INTERNAL_LOAD_FLAGS_IS_SRCDOC;
}
if (mForceAllowDataURI) {
mInternalLoadFlags |= nsDocShell::INTERNAL_LOAD_FLAGS_FORCE_ALLOW_DATA_URI;
}
if (mOriginalFrameSrc) {
mInternalLoadFlags |= nsDocShell::INTERNAL_LOAD_FLAGS_ORIGINAL_FRAME_SRC;
}
}
nsLoadFlags nsDocShellLoadState::CalculateChannelLoadFlags(
BrowsingContext* aBrowsingContext, bool aUriModified,
Maybe<bool> aIsEmbeddingBlockedError) {
MOZ_ASSERT(aBrowsingContext);
nsLoadFlags loadFlags = aBrowsingContext->GetDefaultLoadFlags();
if (FirstParty()) {
// tag first party URL loads
loadFlags |= nsIChannel::LOAD_INITIAL_DOCUMENT_URI;
}
const uint32_t loadType = LoadType();
// These values aren't available for loads initiated in the Parent process.
MOZ_ASSERT_IF(loadType == LOAD_ERROR_PAGE, aIsEmbeddingBlockedError.isSome());
if (loadType == LOAD_ERROR_PAGE) {
// Error pages are LOAD_BACKGROUND, unless it's an
// XFO / frame-ancestors error for which we want an error page to load
// but additionally want the onload() event to fire.
if (!*aIsEmbeddingBlockedError) {
loadFlags |= nsIChannel::LOAD_BACKGROUND;
}
}
// Mark the channel as being a document URI and allow content sniffing...
loadFlags |=
nsIChannel::LOAD_DOCUMENT_URI | nsIChannel::LOAD_CALL_CONTENT_SNIFFERS;
if (nsDocShell::SandboxFlagsImplyCookies(
aBrowsingContext->GetSandboxFlags())) {
loadFlags |= nsIRequest::LOAD_DOCUMENT_NEEDS_COOKIE;
}
// Load attributes depend on load type...
switch (loadType) {
case LOAD_HISTORY: {
// Only send VALIDATE_NEVER if mLSHE's URI was never changed via
// push/replaceState (bug 669671).
if (!aUriModified) {
loadFlags |= nsIRequest::VALIDATE_NEVER;
}
break;
}
case LOAD_RELOAD_CHARSET_CHANGE_BYPASS_PROXY_AND_CACHE:
case LOAD_RELOAD_CHARSET_CHANGE_BYPASS_CACHE:
loadFlags |=
nsIRequest::LOAD_BYPASS_CACHE | nsIRequest::LOAD_FRESH_CONNECTION;
[[fallthrough]];
case LOAD_REFRESH:
loadFlags |= nsIRequest::VALIDATE_ALWAYS;
break;
case LOAD_NORMAL_BYPASS_CACHE:
case LOAD_NORMAL_BYPASS_PROXY:
case LOAD_NORMAL_BYPASS_PROXY_AND_CACHE:
case LOAD_RELOAD_BYPASS_CACHE:
case LOAD_RELOAD_BYPASS_PROXY:
case LOAD_RELOAD_BYPASS_PROXY_AND_CACHE:
case LOAD_REPLACE_BYPASS_CACHE:
loadFlags |=
nsIRequest::LOAD_BYPASS_CACHE | nsIRequest::LOAD_FRESH_CONNECTION;
break;
case LOAD_RELOAD_NORMAL:
if (!StaticPrefs::
browser_soft_reload_only_force_validate_top_level_document()) {
loadFlags |= nsIRequest::VALIDATE_ALWAYS;
break;
}
[[fallthrough]];
case LOAD_NORMAL:
case LOAD_LINK:
// Set cache checking flags
switch (StaticPrefs::browser_cache_check_doc_frequency()) {
case 0:
loadFlags |= nsIRequest::VALIDATE_ONCE_PER_SESSION;
break;
case 1:
loadFlags |= nsIRequest::VALIDATE_ALWAYS;
break;
case 2:
loadFlags |= nsIRequest::VALIDATE_NEVER;
break;
}
break;
}
if (HasInternalLoadFlags(nsDocShell::INTERNAL_LOAD_FLAGS_BYPASS_CLASSIFIER)) {
loadFlags |= nsIChannel::LOAD_BYPASS_URL_CLASSIFIER;
}
// If the user pressed shift-reload, then do not allow ServiceWorker
// interception to occur. See step 12.1 of the SW HandleFetch algorithm.
if (IsForceReloadType(loadType)) {
loadFlags |= nsIChannel::LOAD_BYPASS_SERVICE_WORKER;
}
return loadFlags;
}
const char* nsDocShellLoadState::ValidateWithOriginalState(
nsDocShellLoadState* aOriginalState) {
MOZ_ASSERT(mLoadIdentifier == aOriginalState->mLoadIdentifier);
// Check that `aOriginalState` is sufficiently similar to this state that
// they're performing the same load.
auto uriEq = [](nsIURI* a, nsIURI* b) -> bool {
bool eq = false;
return a == b || (a && b && NS_SUCCEEDED(a->Equals(b, &eq)) && eq);
};
if (!uriEq(mURI, aOriginalState->mURI)) {
return "URI";
}
if (!uriEq(mUnstrippedURI, aOriginalState->mUnstrippedURI)) {
return "UnstrippedURI";
}
if (!uriEq(mOriginalURI, aOriginalState->mOriginalURI)) {
return "OriginalURI";
}
if (!uriEq(mBaseURI, aOriginalState->mBaseURI)) {
return "BaseURI";
}
if (!mTriggeringPrincipal->Equals(aOriginalState->mTriggeringPrincipal)) {
return "TriggeringPrincipal";
}
if (mTriggeringSandboxFlags != aOriginalState->mTriggeringSandboxFlags) {
return "TriggeringSandboxFlags";
}
if (mTriggeringRemoteType != aOriginalState->mTriggeringRemoteType) {
return "TriggeringRemoteType";
}
if (mOriginalURIString != aOriginalState->mOriginalURIString) {
return "OriginalURIString";
}
if (mRemoteTypeOverride != aOriginalState->mRemoteTypeOverride) {
return "RemoteTypeOverride";
}
if (mSourceBrowsingContext.ContextId() !=
aOriginalState->mSourceBrowsingContext.ContextId()) {
return "SourceBrowsingContext";
}
// FIXME: Consider calculating less information in the target process so that
// we can validate more properties more easily.
// FIXME: Identify what other flags will not change when sent through a
// content process.
return nullptr;
}
DocShellLoadStateInit nsDocShellLoadState::Serialize(
mozilla::ipc::IProtocol* aActor) {
MOZ_ASSERT(aActor);
DocShellLoadStateInit loadState;
loadState.ResultPrincipalURI() = mResultPrincipalURI;
loadState.ResultPrincipalURIIsSome() = mResultPrincipalURIIsSome;
loadState.KeepResultPrincipalURIIfSet() = mKeepResultPrincipalURIIfSet;
loadState.LoadReplace() = mLoadReplace;
loadState.InheritPrincipal() = mInheritPrincipal;
loadState.PrincipalIsExplicit() = mPrincipalIsExplicit;
loadState.NotifiedBeforeUnloadListeners() = mNotifiedBeforeUnloadListeners;
loadState.ForceAllowDataURI() = mForceAllowDataURI;
loadState.IsExemptFromHTTPSFirstMode() = mIsExemptFromHTTPSFirstMode;
loadState.OriginalFrameSrc() = mOriginalFrameSrc;
loadState.ShouldCheckForRecursion() = mShouldCheckForRecursion;
loadState.IsFormSubmission() = mIsFormSubmission;
loadState.NeedsCompletelyLoadedDocument() = mNeedsCompletelyLoadedDocument;
loadState.HistoryBehavior() = mHistoryBehavior;
loadState.LoadType() = mLoadType;
loadState.userNavigationInvolvement() = mUserNavigationInvolvement;
loadState.Target() = mTarget;
loadState.TargetBrowsingContext() = mTargetBrowsingContext;
loadState.LoadFlags() = mLoadFlags;
loadState.InternalLoadFlags() = mInternalLoadFlags;
loadState.FirstParty() = mFirstParty;
loadState.HasValidUserGestureActivation() = mHasValidUserGestureActivation;
loadState.TextDirectiveUserActivation() = mTextDirectiveUserActivation;
loadState.AllowFocusMove() = mAllowFocusMove;
loadState.TypeHint() = mTypeHint;
loadState.FileName() = mFileName;
loadState.IsFromProcessingFrameAttributes() =
mIsFromProcessingFrameAttributes;
loadState.URI() = mURI;
loadState.OriginalURI() = mOriginalURI;
loadState.SourceBrowsingContext() = mSourceBrowsingContext;
loadState.BaseURI() = mBaseURI;
loadState.TriggeringPrincipal() = mTriggeringPrincipal;
loadState.PrincipalToInherit() = mPrincipalToInherit;
loadState.PartitionedPrincipalToInherit() = mPartitionedPrincipalToInherit;
loadState.TriggeringSandboxFlags() = mTriggeringSandboxFlags;
loadState.TriggeringWindowId() = mTriggeringWindowId;
loadState.TriggeringStorageAccess() = mTriggeringStorageAccess;
loadState.TriggeringClassificationFlags() = mTriggeringClassificationFlags;
loadState.TriggeringRemoteType() = mTriggeringRemoteType;
loadState.SchemelessInput() = mSchemelessInput;
loadState.HttpsUpgradeTelemetry() = mHttpsUpgradeTelemetry;
loadState.PolicyContainer() = mPolicyContainer;
loadState.OriginalURIString() = mOriginalURIString;
loadState.CancelContentJSEpoch() = mCancelContentJSEpoch;
loadState.ReferrerInfo() = mReferrerInfo;
loadState.PostDataStream() = mPostDataStream;
loadState.HeadersStream() = mHeadersStream;
loadState.SrcdocData() = mSrcdocData;
loadState.ResultPrincipalURI() = mResultPrincipalURI;
loadState.LoadIdentifier() = mLoadIdentifier;
loadState.ChannelInitialized() = mChannelInitialized;
loadState.IsMetaRefresh() = mIsMetaRefresh;
loadState.forceMediaDocument() = mForceMediaDocument;
if (mLoadingSessionHistoryInfo) {
loadState.loadingSessionHistoryInfo().emplace(*mLoadingSessionHistoryInfo);
}
loadState.UnstrippedURI() = mUnstrippedURI;
loadState.RemoteTypeOverride() = mRemoteTypeOverride;
loadState.IsCaptivePortalTab() = mIsCaptivePortalTab;
if (mNavigationAPIState) {
loadState.NavigationAPIState().emplace();
DebugOnly<bool> success = mNavigationAPIState->BuildClonedMessageData(
*loadState.NavigationAPIState());
MOZ_ASSERT(success);
}
if (XRE_IsParentProcess()) {
mozilla::ipc::IToplevelProtocol* top = aActor->ToplevelProtocol();
MOZ_RELEASE_ASSERT(top &&
top->GetProtocolId() ==
mozilla::ipc::ProtocolId::PContentMsgStart &&
top->GetSide() == mozilla::ipc::ParentSide,
"nsDocShellLoadState must be sent over PContent");
ContentParent* cp = static_cast<ContentParent*>(top);
cp->StorePendingLoadState(this);
}
return loadState;
}
nsIURI* nsDocShellLoadState::GetUnstrippedURI() const { return mUnstrippedURI; }
void nsDocShellLoadState::SetUnstrippedURI(nsIURI* aUnstrippedURI) {
mUnstrippedURI = aUnstrippedURI;
}
void nsDocShellLoadState::SetSourceElement(mozilla::dom::Element* aElement) {
mSourceElement = do_GetWeakReference(aElement);
}
already_AddRefed<Element> nsDocShellLoadState::GetSourceElement() const {
nsCOMPtr<Element> element = do_QueryReferent(mSourceElement);
return element.forget();
}
nsIStructuredCloneContainer* nsDocShellLoadState::GetNavigationAPIState()
const {
return mNavigationAPIState;
}
void nsDocShellLoadState::SetNavigationAPIState(
nsIStructuredCloneContainer* aNavigationAPIState) {
mNavigationAPIState =
static_cast<nsStructuredCloneContainer*>(aNavigationAPIState);
}
NavigationAPIMethodTracker* nsDocShellLoadState::GetNavigationAPIMethodTracker()
const {
return mNavigationAPIMethodTracker;
}
void nsDocShellLoadState::SetNavigationAPIMethodTracker(
NavigationAPIMethodTracker* aTracker) {
mNavigationAPIMethodTracker = aTracker;
}
NavigationType nsDocShellLoadState::GetNavigationType() const {
return NavigationUtils::NavigationTypeFromLoadType(LoadType())
.valueOr(NavigationType::Push);
}
mozilla::dom::FormData* nsDocShellLoadState::GetFormDataEntryList() {
return mFormDataEntryList;
}
void nsDocShellLoadState::SetFormDataEntryList(
mozilla::dom::FormData* aFormDataEntryList) {
mFormDataEntryList = aFormDataEntryList;
}
uint32_t nsDocShellLoadState::GetAppLinkLaunchType() const {
return mAppLinkLaunchType;
}
void nsDocShellLoadState::SetAppLinkLaunchType(uint32_t aAppLinkLaunchType) {
mAppLinkLaunchType = aAppLinkLaunchType;
}
bool nsDocShellLoadState::GetIsCaptivePortalTab() const {
return mIsCaptivePortalTab;
}
void nsDocShellLoadState::SetIsCaptivePortalTab(bool aIsCaptivePortalTab) {
mIsCaptivePortalTab = aIsCaptivePortalTab;
}
|