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

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

Issue 1266963002: Correctly construct ("file", "", 0) SecurityOrigins. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@plugin
Patch Set: Created 5 years, 4 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 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 PassRefPtr<SecurityOrigin> SecurityOrigin::createFromString(const String& origin String) 503 PassRefPtr<SecurityOrigin> SecurityOrigin::createFromString(const String& origin String)
504 { 504 {
505 return SecurityOrigin::create(KURL(KURL(), originString)); 505 return SecurityOrigin::create(KURL(KURL(), originString));
506 } 506 }
507 507
508 PassRefPtr<SecurityOrigin> SecurityOrigin::create(const String& protocol, const String& host, int port) 508 PassRefPtr<SecurityOrigin> SecurityOrigin::create(const String& protocol, const String& host, int port)
509 { 509 {
510 if (port < 0 || port > MaxAllowedPort) 510 if (port < 0 || port > MaxAllowedPort)
511 return createUnique(); 511 return createUnique();
512 String decodedHost = decodeURLEscapeSequences(host); 512 String decodedHost = decodeURLEscapeSequences(host);
513 return create(KURL(KURL(), protocol + "://" + host + ":" + String::number(po rt) + "/")); 513 String portPart = port ? ":" + String::number(port) : String();
514 return create(KURL(KURL(), protocol + "://" + host + portPart + "/"));
514 } 515 }
515 516
516 bool SecurityOrigin::isSameSchemeHostPort(const SecurityOrigin* other) const 517 bool SecurityOrigin::isSameSchemeHostPort(const SecurityOrigin* other) const
517 { 518 {
518 if (m_host != other->m_host) 519 if (m_host != other->m_host)
519 return false; 520 return false;
520 521
521 if (m_protocol != other->m_protocol) 522 if (m_protocol != other->m_protocol)
522 return false; 523 return false;
523 524
(...skipping 19 matching lines...) Expand all
543 } 544 }
544 545
545 void SecurityOrigin::transferPrivilegesFrom(const SecurityOrigin& origin) 546 void SecurityOrigin::transferPrivilegesFrom(const SecurityOrigin& origin)
546 { 547 {
547 m_universalAccess = origin.m_universalAccess; 548 m_universalAccess = origin.m_universalAccess;
548 m_canLoadLocalResources = origin.m_canLoadLocalResources; 549 m_canLoadLocalResources = origin.m_canLoadLocalResources;
549 m_blockLocalAccessFromLocalOrigin = origin.m_blockLocalAccessFromLocalOrigin ; 550 m_blockLocalAccessFromLocalOrigin = origin.m_blockLocalAccessFromLocalOrigin ;
550 } 551 }
551 552
552 } // namespace blink 553 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/platform/weborigin/SecurityOriginTest.cpp » ('j') | Source/platform/weborigin/SecurityOriginTest.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698