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

Side by Side Diff: webkit/glue/webframe_impl.cc

Issue 155626: Enable isolated worlds for content scripts.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 2 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
3 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. 3 * Copyright (C) 2006 Apple Computer, 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 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
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 1586 matching lines...) Expand 10 before | Expand all | Expand 10 after
1597 const WebScriptSource* sources_in, int num_sources) { 1597 const WebScriptSource* sources_in, int num_sources) {
1598 Vector<WebCore::ScriptSourceCode> sources; 1598 Vector<WebCore::ScriptSourceCode> sources;
1599 1599
1600 for (int i = 0; i < num_sources; ++i) { 1600 for (int i = 0; i < num_sources; ++i) {
1601 sources.append(WebCore::ScriptSourceCode( 1601 sources.append(WebCore::ScriptSourceCode(
1602 webkit_glue::WebStringToString(sources_in[i].code), 1602 webkit_glue::WebStringToString(sources_in[i].code),
1603 webkit_glue::WebURLToKURL(sources_in[i].url), 1603 webkit_glue::WebURLToKURL(sources_in[i].url),
1604 sources_in[i].startLine)); 1604 sources_in[i].startLine));
1605 } 1605 }
1606 1606
1607 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kIsolatedWorld)) 1607 frame_->script()->evaluateInNewContext(sources);
1608 frame_->script()->evaluateInNewWorld(sources); 1608 }
1609 else 1609
1610 frame_->script()->evaluateInNewContext(sources); 1610 void WebFrameImpl::ExecuteScriptInNewWorld(
1611 const WebScriptSource* sources_in, int num_sources) {
1612 Vector<WebCore::ScriptSourceCode> sources;
1613
1614 for (int i = 0; i < num_sources; ++i) {
1615 sources.append(WebCore::ScriptSourceCode(
1616 webkit_glue::WebStringToString(sources_in[i].code),
1617 webkit_glue::WebURLToKURL(sources_in[i].url),
1618 sources_in[i].startLine));
1619 }
1620
1621 frame_->script()->evaluateInNewWorld(sources);
1611 } 1622 }
1612 1623
1613 std::wstring WebFrameImpl::GetName() { 1624 std::wstring WebFrameImpl::GetName() {
1614 return webkit_glue::StringToStdWString(frame_->tree()->name()); 1625 return webkit_glue::StringToStdWString(frame_->tree()->name());
1615 } 1626 }
1616 1627
1617 WebTextInput* WebFrameImpl::GetTextInput() { 1628 WebTextInput* WebFrameImpl::GetTextInput() {
1618 if (!webtextinput_impl_.get()) { 1629 if (!webtextinput_impl_.get()) {
1619 webtextinput_impl_.reset(new WebTextInputImpl(this)); 1630 webtextinput_impl_.reset(new WebTextInputImpl(this));
1620 } 1631 }
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
1818 1829
1819 SecurityOrigin* security_origin = frame_->document()->securityOrigin(); 1830 SecurityOrigin* security_origin = frame_->document()->securityOrigin();
1820 1831
1821 if (!frame_->loader()->isScheduledLocationChangePending()) { 1832 if (!frame_->loader()->isScheduledLocationChangePending()) {
1822 frame_->loader()->stopAllLoaders(); 1833 frame_->loader()->stopAllLoaders();
1823 frame_->loader()->begin(frame_->loader()->url(), true, security_origin); 1834 frame_->loader()->begin(frame_->loader()->url(), true, security_origin);
1824 frame_->loader()->write(script_result); 1835 frame_->loader()->write(script_result);
1825 frame_->loader()->end(); 1836 frame_->loader()->end();
1826 } 1837 }
1827 } 1838 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698