OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved. |
3 * Copyright (C) 2009 Apple Inc. All rights reserved. | 3 * Copyright (C) 2009 Apple Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * 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 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 if (!protocolIsJavaScript(url)) | 509 if (!protocolIsJavaScript(url)) |
510 return false; | 510 return false; |
511 | 511 |
512 if (!m_frame->page() | 512 if (!m_frame->page() |
513 || !m_frame->document()->contentSecurityPolicy()->allowJavaScriptURLs(m_
frame->document()->url(), eventHandlerPosition().m_line)) | 513 || !m_frame->document()->contentSecurityPolicy()->allowJavaScriptURLs(m_
frame->document()->url(), eventHandlerPosition().m_line)) |
514 return true; | 514 return true; |
515 | 515 |
516 // We need to hold onto the LocalFrame here because executing script can | 516 // We need to hold onto the LocalFrame here because executing script can |
517 // destroy the frame. | 517 // destroy the frame. |
518 RefPtr<LocalFrame> protector(m_frame); | 518 RefPtr<LocalFrame> protector(m_frame); |
519 RefPtr<Document> ownerDocument(m_frame->document()); | 519 RefPtrWillBeRawPtr<Document> ownerDocument(m_frame->document()); |
520 | 520 |
521 const int javascriptSchemeLength = sizeof("javascript:") - 1; | 521 const int javascriptSchemeLength = sizeof("javascript:") - 1; |
522 | 522 |
523 bool locationChangeBefore = m_frame->navigationScheduler().locationChangePen
ding(); | 523 bool locationChangeBefore = m_frame->navigationScheduler().locationChangePen
ding(); |
524 | 524 |
525 String decodedURL = decodeURLEscapeSequences(url.string()); | 525 String decodedURL = decodeURLEscapeSequences(url.string()); |
526 ScriptValue result = evaluateScriptInMainWorld(ScriptSourceCode(decodedURL.s
ubstring(javascriptSchemeLength)), NotSharableCrossOrigin, DoNotExecuteScriptWhe
nScriptsDisabled); | 526 ScriptValue result = evaluateScriptInMainWorld(ScriptSourceCode(decodedURL.s
ubstring(javascriptSchemeLength)), NotSharableCrossOrigin, DoNotExecuteScriptWhe
nScriptsDisabled); |
527 | 527 |
528 // If executing script caused this frame to be removed from the page, we | 528 // If executing script caused this frame to be removed from the page, we |
529 // don't want to try to replace its document! | 529 // don't want to try to replace its document! |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
616 resultArray->Set(i, evaluationResult); | 616 resultArray->Set(i, evaluationResult); |
617 } | 617 } |
618 | 618 |
619 if (results) { | 619 if (results) { |
620 for (size_t i = 0; i < resultArray->Length(); ++i) | 620 for (size_t i = 0; i < resultArray->Length(); ++i) |
621 results->append(ScriptValue(ScriptState::from(context), resultArray-
>Get(i))); | 621 results->append(ScriptValue(ScriptState::from(context), resultArray-
>Get(i))); |
622 } | 622 } |
623 } | 623 } |
624 | 624 |
625 } // namespace WebCore | 625 } // namespace WebCore |
OLD | NEW |