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

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

Issue 1495013002: Check for equality of the URL's origin in replaceState/pushState (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Allow --disable-web-security again, add more tests Created 5 years 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) 2004, 2007, 2008, 2011, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2007, 2008, 2011, 2012 Apple Inc. All rights reserved.
3 * Copyright (C) 2012 Research In Motion Limited. All rights reserved. 3 * Copyright (C) 2012 Research In Motion Limited. All rights reserved.
4 * Copyright (C) 2008, 2009, 2011 Google Inc. All rights reserved. 4 * Copyright (C) 2008, 2009, 2011 Google Inc. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 const String& aString = a.m_string; 714 const String& aString = a.m_string;
715 const String& bString = b.m_string; 715 const String& bString = b.m_string;
716 // FIXME: Abstraction this into a function in WTFString.h. 716 // FIXME: Abstraction this into a function in WTFString.h.
717 for (int i = 0; i < aLength; ++i) { 717 for (int i = 0; i < aLength; ++i) {
718 if (aString[i] != bString[i]) 718 if (aString[i] != bString[i])
719 return false; 719 return false;
720 } 720 }
721 return true; 721 return true;
722 } 722 }
723 723
724 bool equalIgnoringPathQueryAndFragment(const KURL& a, const KURL& b)
725 {
726 int aLength = a.pathStart();
727 int bLength = b.pathStart();
728
729 if (aLength != bLength)
730 return false;
731
732 const String& aString = a.m_string;
733 const String& bString = b.m_string;
734 // FIXME: Abstraction this into a function in WTFString.h.
brettw 2015/12/08 05:41:32 I would remove this FIXME, I don't think this shou
robwu 2015/12/08 08:45:17 Then it also applies to the function above. In eit
735 for (int i = 0; i < aLength; ++i) {
736 if (aString[i] != bString[i])
737 return false;
738 }
739 return true;
740 }
741
724 unsigned KURL::hostStart() const 742 unsigned KURL::hostStart() const
725 { 743 {
726 return m_parsed.CountCharactersBefore(url::Parsed::HOST, false); 744 return m_parsed.CountCharactersBefore(url::Parsed::HOST, false);
727 } 745 }
728 746
729 unsigned KURL::hostEnd() const 747 unsigned KURL::hostEnd() const
730 { 748 {
731 return m_parsed.CountCharactersBefore(url::Parsed::PORT, true); 749 return m_parsed.CountCharactersBefore(url::Parsed::PORT, true);
732 } 750 }
733 751
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
903 m_string = AtomicString::fromUTF8(output.data(), output.length()); 921 m_string = AtomicString::fromUTF8(output.data(), output.length());
904 } 922 }
905 923
906 bool KURL::isSafeToSendToAnotherThread() const 924 bool KURL::isSafeToSendToAnotherThread() const
907 { 925 {
908 return m_string.isSafeToSendToAnotherThread() 926 return m_string.isSafeToSendToAnotherThread()
909 && (!m_innerURL || m_innerURL->isSafeToSendToAnotherThread()); 927 && (!m_innerURL || m_innerURL->isSafeToSendToAnotherThread());
910 } 928 }
911 929
912 } // namespace blink 930 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698