Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(139)

Side by Side Diff: third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp

Issue 1985703003: Add isUnique check to isSameSchemeHostPort. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: separate out == check, and add some tests Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2007 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 { 524 {
525 if (port < 0 || port > MaxAllowedPort) 525 if (port < 0 || port > MaxAllowedPort)
526 return createUnique(); 526 return createUnique();
527 String decodedHost = decodeURLEscapeSequences(host); 527 String decodedHost = decodeURLEscapeSequences(host);
528 String portPart = port ? ":" + String::number(port) : String(); 528 String portPart = port ? ":" + String::number(port) : String();
529 return create(KURL(KURL(), protocol + "://" + host + portPart + "/")); 529 return create(KURL(KURL(), protocol + "://" + host + portPart + "/"));
530 } 530 }
531 531
532 bool SecurityOrigin::isSameSchemeHostPort(const SecurityOrigin* other) const 532 bool SecurityOrigin::isSameSchemeHostPort(const SecurityOrigin* other) const
533 { 533 {
534 if (this == other)
535 return true;
536
537 if (isUnique() || other->isUnique())
538 return false;
539
534 if (m_host != other->m_host) 540 if (m_host != other->m_host)
535 return false; 541 return false;
536 542
537 if (m_protocol != other->m_protocol) 543 if (m_protocol != other->m_protocol)
538 return false; 544 return false;
539 545
540 if (m_port != other->m_port) 546 if (m_port != other->m_port)
541 return false; 547 return false;
542 548
543 if (isLocal() && !passesFileCheck(other)) 549 if (isLocal() && !passesFileCheck(other))
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 m_blockLocalAccessFromLocalOrigin = privilegeData->m_blockLocalAccessFromLoc alOrigin; 581 m_blockLocalAccessFromLocalOrigin = privilegeData->m_blockLocalAccessFromLoc alOrigin;
576 } 582 }
577 583
578 void SecurityOrigin::setUniqueOriginIsPotentiallyTrustworthy(bool isUniqueOrigin PotentiallyTrustworthy) 584 void SecurityOrigin::setUniqueOriginIsPotentiallyTrustworthy(bool isUniqueOrigin PotentiallyTrustworthy)
579 { 585 {
580 ASSERT(!isUniqueOriginPotentiallyTrustworthy || isUnique()); 586 ASSERT(!isUniqueOriginPotentiallyTrustworthy || isUnique());
581 m_isUniqueOriginPotentiallyTrustworthy = isUniqueOriginPotentiallyTrustworth y; 587 m_isUniqueOriginPotentiallyTrustworthy = isUniqueOriginPotentiallyTrustworth y;
582 } 588 }
583 589
584 } // namespace blink 590 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698