diff -Nru chromium-browser-45.0.2454.85/ash/ash.gyp chromium-browser-45.0.2454.101/ash/ash.gyp --- chromium-browser-45.0.2454.85/ash/ash.gyp 2015-09-01 20:10:41.000000000 +0000 +++ chromium-browser-45.0.2454.101/ash/ash.gyp 2015-09-25 09:06:18.000000000 +0000 @@ -827,6 +827,7 @@ 'metrics/user_metrics_recorder_unittest.cc', 'popup_message_unittest.cc', 'root_window_controller_unittest.cc', + 'rotator/screen_rotation_animation_unittest.cc', 'screen_util_unittest.cc', 'shelf/scoped_observer_with_duplicated_sources_unittest.cc', 'shelf/shelf_button_pressed_metric_tracker_unittest.cc', diff -Nru chromium-browser-45.0.2454.85/ash/rotator/screen_rotation_animation.cc chromium-browser-45.0.2454.101/ash/rotator/screen_rotation_animation.cc --- chromium-browser-45.0.2454.85/ash/rotator/screen_rotation_animation.cc 2015-08-22 19:01:50.000000000 +0000 +++ chromium-browser-45.0.2454.101/ash/rotator/screen_rotation_animation.cc 2015-09-25 09:06:18.000000000 +0000 @@ -68,6 +68,9 @@ } void ScreenRotationAnimation::OnAbort(ui::LayerAnimationDelegate* delegate) { + TargetValue target_value; + OnGetTarget(&target_value); + delegate->SetTransformFromAnimation(target_value.transform); } } // namespace ash diff -Nru chromium-browser-45.0.2454.85/ash/rotator/screen_rotation_animation_unittest.cc chromium-browser-45.0.2454.101/ash/rotator/screen_rotation_animation_unittest.cc --- chromium-browser-45.0.2454.85/ash/rotator/screen_rotation_animation_unittest.cc 1970-01-01 00:00:00.000000000 +0000 +++ chromium-browser-45.0.2454.101/ash/rotator/screen_rotation_animation_unittest.cc 2015-09-25 09:06:18.000000000 +0000 @@ -0,0 +1,73 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ash/rotator/screen_rotation_animation.h" +#include "ash/test/ash_test_base.h" +#include "base/macros.h" +#include "base/memory/scoped_ptr.h" +#include "base/time/time.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "ui/aura/window.h" +#include "ui/compositor/layer.h" +#include "ui/compositor/layer_animation_sequence.h" +#include "ui/compositor/layer_animator.h" +#include "ui/compositor/scoped_animation_duration_scale_mode.h" +#include "ui/gfx/animation/tween.h" +#include "ui/gfx/transform.h" + +namespace ash { +namespace test { + +class ScreenRotationAnimationTest : public AshTestBase { + public: + ScreenRotationAnimationTest() {} + ~ScreenRotationAnimationTest() override {} + + // AshTestBase: + void SetUp() override; + + private: + scoped_ptr non_zero_duration_mode_; + + DISALLOW_COPY_AND_ASSIGN(ScreenRotationAnimationTest); +}; + +void ScreenRotationAnimationTest::SetUp() { + AshTestBase::SetUp(); + non_zero_duration_mode_.reset(new ui::ScopedAnimationDurationScaleMode( + ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION)); +} + +TEST_F(ScreenRotationAnimationTest, LayerTransformGetsSetToTargetWhenAborted) { + scoped_ptr window(CreateTestWindowInShellWithId(9)); + ui::Layer* layer = window->layer(); + + scoped_ptr screen_rotation( + new ScreenRotationAnimation( + layer, 45 /* start_degrees */, 0 /* end_degrees */, + 0.5f /* initial_opacity */, 1.0f /* target_opacity */, + gfx::Point3F(1.0f, 1.0f, 1.0f) /* initial_scale */, + gfx::Point3F(1.0f, 1.0f, 1.0f) /* target_scale */, + gfx::Point(10, 10) /* pivot */, + base::TimeDelta::FromSeconds(10) /* duration */, gfx::Tween::LINEAR)); + + ui::LayerAnimator* animator = layer->GetAnimator(); + animator->set_preemption_strategy( + ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS); + scoped_ptr animation_sequence( + new ui::LayerAnimationSequence(screen_rotation.release())); + animator->StartAnimation(animation_sequence.release()); + + const gfx::Transform identity_transform; + + ASSERT_EQ(identity_transform, layer->GetTargetTransform()); + ASSERT_NE(identity_transform, layer->transform()); + + layer->GetAnimator()->AbortAllAnimations(); + + EXPECT_EQ(identity_transform, layer->transform()); +} + +} // namespace test +} // namespace ash diff -Nru chromium-browser-45.0.2454.85/base/win/scoped_handle.cc chromium-browser-45.0.2454.101/base/win/scoped_handle.cc --- chromium-browser-45.0.2454.85/base/win/scoped_handle.cc 2015-08-22 19:01:51.000000000 +0000 +++ chromium-browser-45.0.2454.101/base/win/scoped_handle.cc 2015-09-23 19:11:00.000000000 +0000 @@ -152,12 +152,6 @@ if (!enabled_) return; - // Idea here is to make our handles non-closable until we close it ourselves. - // Handles provided could be totally fabricated especially through our - // unittest, we are ignoring that for now by not checking return value. - ::SetHandleInformation(handle, HANDLE_FLAG_PROTECT_FROM_CLOSE, - HANDLE_FLAG_PROTECT_FROM_CLOSE); - // Grab the thread id before the lock. DWORD thread_id = GetCurrentThreadId(); @@ -178,15 +172,6 @@ if (!enabled_) return; - // We expect handle to be protected till this point. - DWORD flags = 0; - if (::GetHandleInformation(handle, &flags)) { - CHECK_NE(0U, (flags & HANDLE_FLAG_PROTECT_FROM_CLOSE)); - - // Unprotect handle so that it could be closed. - ::SetHandleInformation(handle, HANDLE_FLAG_PROTECT_FROM_CLOSE, 0); - } - AutoNativeLock lock(*lock_); HandleMap::iterator i = map_.find(handle); if (i == map_.end()) diff -Nru chromium-browser-45.0.2454.85/build/util/LASTCHANGE chromium-browser-45.0.2454.101/build/util/LASTCHANGE --- chromium-browser-45.0.2454.85/build/util/LASTCHANGE 2015-09-01 20:10:56.000000000 +0000 +++ chromium-browser-45.0.2454.101/build/util/LASTCHANGE 2015-09-25 09:06:38.000000000 +0000 @@ -1 +1 @@ -LASTCHANGE=4c2743615eaa2806ad014c59bf6acbb652cf3aa8 +LASTCHANGE=07ad3ac7db843f4bd4229ae55fbb312320165a83 diff -Nru chromium-browser-45.0.2454.85/build/util/LASTCHANGE.blink chromium-browser-45.0.2454.101/build/util/LASTCHANGE.blink --- chromium-browser-45.0.2454.85/build/util/LASTCHANGE.blink 2015-09-01 20:10:56.000000000 +0000 +++ chromium-browser-45.0.2454.101/build/util/LASTCHANGE.blink 2015-09-25 09:06:38.000000000 +0000 @@ -1 +1 @@ -LASTCHANGE=201276 +LASTCHANGE=07ad3ac7db843f4bd4229ae55fbb312320165a83 diff -Nru chromium-browser-45.0.2454.85/build/util/lastchange.py chromium-browser-45.0.2454.101/build/util/lastchange.py --- chromium-browser-45.0.2454.85/build/util/lastchange.py 2015-08-22 19:01:51.000000000 +0000 +++ chromium-browser-45.0.2454.101/build/util/lastchange.py 2015-09-24 20:22:43.000000000 +0000 @@ -90,7 +90,7 @@ return None -def FetchGitRevision(directory): +def FetchGitRevision(directory, hash_only): """ Fetch the Git hash for a given directory. @@ -116,7 +116,7 @@ if line.startswith('Cr-Commit-Position:'): pos = line.rsplit()[-1].strip() break - if not pos: + if hash_only or not pos: return VersionInfo('git', hsh) return VersionInfo('git', '%s-%s' % (hsh, pos)) @@ -166,7 +166,7 @@ def FetchVersionInfo(default_lastchange, directory=None, directory_regex_prior_to_src_url='chrome|blink|svn', - go_deeper=False): + go_deeper=False, hash_only=False): """ Returns the last change (in the form of a branch, revision tuple), from some appropriate revision control system. @@ -176,7 +176,7 @@ version_info = (FetchSVNRevision(directory, svn_url_regex) or FetchGitSVNRevision(directory, svn_url_regex, go_deeper) or - FetchGitRevision(directory)) + FetchGitRevision(directory, hash_only)) if not version_info: if default_lastchange and os.path.exists(default_lastchange): revision = open(default_lastchange, 'r').read().strip() @@ -263,6 +263,9 @@ parser.add_option("--git-svn-go-deeper", action='store_true', help="In a Git-SVN repo, dig down to the last committed " + "SVN change (historic behaviour).") + parser.add_option("--git-hash-only", action="store_true", + help="In a Git repo with commit positions, only report " + + "the hash.") opts, args = parser.parse_args(argv[1:]) out_file = opts.output @@ -283,7 +286,8 @@ version_info = FetchVersionInfo(opts.default_lastchange, directory=src_dir, - go_deeper=opts.git_svn_go_deeper) + go_deeper=opts.git_svn_go_deeper, + hash_only=opts.git_hash_only) if version_info.revision == None: version_info.revision = '0' diff -Nru chromium-browser-45.0.2454.85/build/whitespace_file.txt chromium-browser-45.0.2454.101/build/whitespace_file.txt --- chromium-browser-45.0.2454.85/build/whitespace_file.txt 2015-09-01 20:10:41.000000000 +0000 +++ chromium-browser-45.0.2454.101/build/whitespace_file.txt 2015-09-25 09:06:19.000000000 +0000 @@ -154,3 +154,5 @@ ^_^ In the masters we don't. + +chrome-tpm diff -Nru chromium-browser-45.0.2454.85/cc/layers/picture_layer_impl.cc chromium-browser-45.0.2454.101/cc/layers/picture_layer_impl.cc --- chromium-browser-45.0.2454.85/cc/layers/picture_layer_impl.cc 2015-09-01 20:10:41.000000000 +0000 +++ chromium-browser-45.0.2454.101/cc/layers/picture_layer_impl.cc 2015-09-25 09:06:19.000000000 +0000 @@ -183,7 +183,9 @@ gfx::Rect opaque_rect = contents_opaque() ? geometry_rect : gfx::Rect(); gfx::Rect visible_geometry_rect = scaled_occlusion.GetUnoccludedContentRect(geometry_rect); - if (visible_geometry_rect.IsEmpty()) + // TODO(enne): HasRecordings is a workaround for crash in crbug.com/526402. + // Need proper fix for when recording does not cover visible rect. + if (visible_geometry_rect.IsEmpty() || !raster_source_->HasRecordings()) return; gfx::Rect quad_content_rect = shared_quad_state->visible_quad_layer_rect; diff -Nru chromium-browser-45.0.2454.85/chrome/android/java/res/layout/infobar_spinner_item.xml chromium-browser-45.0.2454.101/chrome/android/java/res/layout/infobar_spinner_item.xml --- chromium-browser-45.0.2454.85/chrome/android/java/res/layout/infobar_spinner_item.xml 2015-09-01 20:10:41.000000000 +0000 +++ chromium-browser-45.0.2454.101/chrome/android/java/res/layout/infobar_spinner_item.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,18 +0,0 @@ - - - - diff -Nru chromium-browser-45.0.2454.85/chrome/android/java/res/values/dimens.xml chromium-browser-45.0.2454.101/chrome/android/java/res/values/dimens.xml --- chromium-browser-45.0.2454.85/chrome/android/java/res/values/dimens.xml 2015-09-01 20:10:41.000000000 +0000 +++ chromium-browser-45.0.2454.101/chrome/android/java/res/values/dimens.xml 2015-09-25 09:06:19.000000000 +0000 @@ -68,8 +68,6 @@ 220dp 16dp - - 40dp 36dp diff -Nru chromium-browser-45.0.2454.85/chrome/android/java/src/org/chromium/chrome/browser/download/ChromeDownloadDelegate.java chromium-browser-45.0.2454.101/chrome/android/java/src/org/chromium/chrome/browser/download/ChromeDownloadDelegate.java --- chromium-browser-45.0.2454.85/chrome/android/java/src/org/chromium/chrome/browser/download/ChromeDownloadDelegate.java 2015-09-01 20:10:41.000000000 +0000 +++ chromium-browser-45.0.2454.101/chrome/android/java/src/org/chromium/chrome/browser/download/ChromeDownloadDelegate.java 2015-09-25 09:06:19.000000000 +0000 @@ -308,14 +308,15 @@ * * @param overwrite Whether or not we will overwrite the file. * @param downloadInfo The download info. + * @return true iff this request resulted in the tab creating the download to close. */ @CalledByNative - private void enqueueDownloadManagerRequestFromNative( + private boolean enqueueDownloadManagerRequestFromNative( boolean overwrite, DownloadInfo downloadInfo) { // Android DownloadManager does not have an overwriting option. // We remove the file here instead. if (overwrite) deleteFileForOverwrite(downloadInfo); - enqueueDownloadManagerRequestInternal(downloadInfo); + return enqueueDownloadManagerRequestInternal(downloadInfo); } private void deleteFileForOverwrite(DownloadInfo info) { @@ -327,10 +328,10 @@ } } - private void enqueueDownloadManagerRequestInternal(final DownloadInfo info) { + private boolean enqueueDownloadManagerRequestInternal(final DownloadInfo info) { DownloadManagerService.getDownloadManagerService( mContext.getApplicationContext()).enqueueDownloadManagerRequest(info, true); - closeBlankTab(); + return closeBlankTab(); } /** @@ -474,15 +475,17 @@ /** * Close a blank tab just opened for the download purpose. + * @return true iff the tab was closed. */ - private void closeBlankTab() { + private boolean closeBlankTab() { WebContents contents = mTab.getWebContents(); boolean isInitialNavigation = contents == null || contents.getNavigationController().isInitialNavigation(); if (isInitialNavigation) { // Tab is created just for download, close it. - mTabModelSelector.closeTab(mTab); + return mTabModelSelector.closeTab(mTab); } + return false; } /** diff -Nru chromium-browser-45.0.2454.85/chrome/android/java/src/org/chromium/chrome/browser/infobar/TranslateLanguagePanel.java chromium-browser-45.0.2454.101/chrome/android/java/src/org/chromium/chrome/browser/infobar/TranslateLanguagePanel.java --- chromium-browser-45.0.2454.85/chrome/android/java/src/org/chromium/chrome/browser/infobar/TranslateLanguagePanel.java 2015-09-01 20:10:41.000000000 +0000 +++ chromium-browser-45.0.2454.101/chrome/android/java/src/org/chromium/chrome/browser/infobar/TranslateLanguagePanel.java 2015-09-25 09:06:19.000000000 +0000 @@ -221,16 +221,12 @@ @Override public View getDropDownView(int position, View convertView, ViewGroup parent) { - TextView result; - if (!(convertView instanceof TextView)) { - result = (TextView) LayoutInflater.from(getContext()).inflate( - R.layout.infobar_spinner_item, null); - } else { - result = (TextView) convertView; + View result = super.getDropDownView(position, convertView, parent); + result.setBackgroundColor( + getContext().getResources().getColor(R.color.infobar_background)); + if (result instanceof TextView) { + ((TextView) result).setText(getItem(position).toString()); } - - String language = getItem(position).toString(); - result.setText(language); return result; } diff -Nru chromium-browser-45.0.2454.85/chrome/android/java/src/org/chromium/chrome/browser/init/ChromeBrowserInitializer.java chromium-browser-45.0.2454.101/chrome/android/java/src/org/chromium/chrome/browser/init/ChromeBrowserInitializer.java --- chromium-browser-45.0.2454.85/chrome/android/java/src/org/chromium/chrome/browser/init/ChromeBrowserInitializer.java 2015-09-01 20:10:41.000000000 +0000 +++ chromium-browser-45.0.2454.101/chrome/android/java/src/org/chromium/chrome/browser/init/ChromeBrowserInitializer.java 2015-09-25 09:06:19.000000000 +0000 @@ -21,6 +21,7 @@ import org.chromium.base.library_loader.ProcessInitException; import org.chromium.chrome.browser.ChromeApplication; import org.chromium.chrome.browser.ChromeSwitches; +import org.chromium.chrome.browser.ChromeVersionInfo; import org.chromium.chrome.browser.FileProviderHelper; import org.chromium.chrome.browser.device.DeviceClassManager; import org.chromium.content.app.ContentApplication; @@ -271,7 +272,7 @@ private static void configureStrictMode() { CommandLine commandLine = CommandLine.getInstance(); if ("eng".equals(Build.TYPE) - || "userdebug".equals(Build.TYPE) + || ("userdebug".equals(Build.TYPE) && !ChromeVersionInfo.isStableBuild()) || commandLine.hasSwitch(ChromeSwitches.STRICT_MODE)) { StrictMode.enableDefaults(); StrictMode.ThreadPolicy.Builder policy = diff -Nru chromium-browser-45.0.2454.85/chrome/android/java/src/org/chromium/chrome/browser/media/ui/NotificationMediaPlaybackControls.java chromium-browser-45.0.2454.101/chrome/android/java/src/org/chromium/chrome/browser/media/ui/NotificationMediaPlaybackControls.java --- chromium-browser-45.0.2454.85/chrome/android/java/src/org/chromium/chrome/browser/media/ui/NotificationMediaPlaybackControls.java 2015-09-01 20:10:41.000000000 +0000 +++ chromium-browser-45.0.2454.101/chrome/android/java/src/org/chromium/chrome/browser/media/ui/NotificationMediaPlaybackControls.java 2015-09-25 09:06:19.000000000 +0000 @@ -67,6 +67,9 @@ @Override public void onDestroy() { super.onDestroy(); + + if (sInstance == null) return; + onServiceDestroyed(); } diff -Nru chromium-browser-45.0.2454.85/chrome/android/java/src/org/chromium/chrome/browser/signin/OAuth2TokenService.java chromium-browser-45.0.2454.101/chrome/android/java/src/org/chromium/chrome/browser/signin/OAuth2TokenService.java --- chromium-browser-45.0.2454.85/chrome/android/java/src/org/chromium/chrome/browser/signin/OAuth2TokenService.java 2015-09-01 20:10:41.000000000 +0000 +++ chromium-browser-45.0.2454.101/chrome/android/java/src/org/chromium/chrome/browser/signin/OAuth2TokenService.java 2015-09-25 09:06:19.000000000 +0000 @@ -134,7 +134,7 @@ ThreadUtils.postOnUiThread(new Runnable() { @Override public void run() { - nativeOAuth2TokenFetched(null, nativeCallback); + nativeOAuth2TokenFetched(null, false, nativeCallback); } }); return; @@ -145,8 +145,8 @@ accountManagerHelper.getAuthTokenFromForeground( null, account, oauth2Scope, new AccountManagerHelper.GetAuthTokenCallback() { @Override - public void tokenAvailable(String token) { - nativeOAuth2TokenFetched(token, nativeCallback); + public void tokenAvailable(String token, boolean isTransientError) { + nativeOAuth2TokenFetched(token, isTransientError, nativeCallback); } }); } @@ -190,7 +190,7 @@ context, activity, account, scope, new AccountManagerHelper.GetAuthTokenCallback() { @Override - public void tokenAvailable(String token) { + public void tokenAvailable(String token, boolean isTransientError) { result.set(token); semaphore.release(); } @@ -309,7 +309,7 @@ private static native Object nativeGetForProfile(Profile profile); private static native void nativeOAuth2TokenFetched( - String authToken, long nativeCallback); + String authToken, boolean isTransientError, long nativeCallback); private native void nativeValidateAccounts(long nativeOAuth2TokenServiceDelegateAndroid, String currentlySignedInAccount, boolean forceNotifications); private native void nativeFireRefreshTokenAvailableFromJava( diff -Nru chromium-browser-45.0.2454.85/chrome/app/close_handle_hook_win.cc chromium-browser-45.0.2454.101/chrome/app/close_handle_hook_win.cc --- chromium-browser-45.0.2454.85/chrome/app/close_handle_hook_win.cc 2015-09-01 20:10:41.000000000 +0000 +++ chromium-browser-45.0.2454.101/chrome/app/close_handle_hook_win.cc 2015-09-25 09:06:19.000000000 +0000 @@ -185,8 +185,7 @@ #elif defined(NDEBUG) chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); if (channel == chrome::VersionInfo::CHANNEL_CANARY || - channel == chrome::VersionInfo::CHANNEL_DEV || - channel == chrome::VersionInfo::CHANNEL_UNKNOWN) { + channel == chrome::VersionInfo::CHANNEL_DEV) { return true; } @@ -222,6 +221,8 @@ // threads attempting to call CloseHandle. hooks->AddEATPatch(); PatchLoadedModules(hooks); + } else { + base::win::DisableHandleVerifier(); } } Binary files /tmp/OjxaYvXOvO/chromium-browser-45.0.2454.85/chrome/app/theme/default_100_percent/cros/logo_google_color_90.png and /tmp/0kKZKPMPM5/chromium-browser-45.0.2454.101/chrome/app/theme/default_100_percent/cros/logo_google_color_90.png differ Binary files /tmp/OjxaYvXOvO/chromium-browser-45.0.2454.85/chrome/app/theme/default_200_percent/cros/logo_google_color_90.png and /tmp/0kKZKPMPM5/chromium-browser-45.0.2454.101/chrome/app/theme/default_200_percent/cros/logo_google_color_90.png differ diff -Nru chromium-browser-45.0.2454.85/chrome/browser/android/download/android_download_manager_overwrite_infobar_delegate.cc chromium-browser-45.0.2454.101/chrome/browser/android/download/android_download_manager_overwrite_infobar_delegate.cc --- chromium-browser-45.0.2454.85/chrome/browser/android/download/android_download_manager_overwrite_infobar_delegate.cc 2015-08-22 19:01:51.000000000 +0000 +++ chromium-browser-45.0.2454.101/chrome/browser/android/download/android_download_manager_overwrite_infobar_delegate.cc 2015-09-16 21:46:55.000000000 +0000 @@ -53,14 +53,16 @@ download_info_.Reset(env, download_info); } -void AndroidDownloadManagerOverwriteInfoBarDelegate::OverwriteExistingFile() { - ChromeDownloadDelegate::EnqueueDownloadManagerRequest( +bool AndroidDownloadManagerOverwriteInfoBarDelegate::OverwriteExistingFile() { + bool tab_closed = ChromeDownloadDelegate::EnqueueDownloadManagerRequest( chrome_download_delegate_.obj(), true, download_info_.obj()); + return !tab_closed; } -void AndroidDownloadManagerOverwriteInfoBarDelegate::CreateNewFile() { - ChromeDownloadDelegate::EnqueueDownloadManagerRequest( +bool AndroidDownloadManagerOverwriteInfoBarDelegate::CreateNewFile() { + bool tab_closed = ChromeDownloadDelegate::EnqueueDownloadManagerRequest( chrome_download_delegate_.obj(), false, download_info_.obj()); + return !tab_closed; } std::string AndroidDownloadManagerOverwriteInfoBarDelegate::GetFileName() diff -Nru chromium-browser-45.0.2454.85/chrome/browser/android/download/android_download_manager_overwrite_infobar_delegate.h chromium-browser-45.0.2454.101/chrome/browser/android/download/android_download_manager_overwrite_infobar_delegate.h --- chromium-browser-45.0.2454.85/chrome/browser/android/download/android_download_manager_overwrite_infobar_delegate.h 2015-08-22 19:01:51.000000000 +0000 +++ chromium-browser-45.0.2454.101/chrome/browser/android/download/android_download_manager_overwrite_infobar_delegate.h 2015-09-16 21:46:55.000000000 +0000 @@ -39,8 +39,8 @@ jobject download_info); // DownloadOverwriteInfoBarDelegate: - void OverwriteExistingFile() override; - void CreateNewFile() override; + bool OverwriteExistingFile() override; + bool CreateNewFile() override; std::string GetFileName() const override; std::string GetDirName() const override; std::string GetDirFullPath() const override; diff -Nru chromium-browser-45.0.2454.85/chrome/browser/android/download/chrome_download_delegate.cc chromium-browser-45.0.2454.101/chrome/browser/android/download/chrome_download_delegate.cc --- chromium-browser-45.0.2454.85/chrome/browser/android/download/chrome_download_delegate.cc 2015-09-01 20:10:41.000000000 +0000 +++ chromium-browser-45.0.2454.101/chrome/browser/android/download/chrome_download_delegate.cc 2015-09-25 09:06:19.000000000 +0000 @@ -48,13 +48,13 @@ } // static -void ChromeDownloadDelegate::EnqueueDownloadManagerRequest( +bool ChromeDownloadDelegate::EnqueueDownloadManagerRequest( jobject chrome_download_delegate, bool overwrite, jobject download_info) { JNIEnv* env = base::android::AttachCurrentThread(); - Java_ChromeDownloadDelegate_enqueueDownloadManagerRequestFromNative( + return Java_ChromeDownloadDelegate_enqueueDownloadManagerRequestFromNative( env, chrome_download_delegate, overwrite, download_info); } diff -Nru chromium-browser-45.0.2454.85/chrome/browser/android/download/chrome_download_delegate.h chromium-browser-45.0.2454.101/chrome/browser/android/download/chrome_download_delegate.h --- chromium-browser-45.0.2454.85/chrome/browser/android/download/chrome_download_delegate.h 2015-08-22 19:01:51.000000000 +0000 +++ chromium-browser-45.0.2454.101/chrome/browser/android/download/chrome_download_delegate.h 2015-09-16 21:46:55.000000000 +0000 @@ -11,7 +11,9 @@ class ChromeDownloadDelegate { public: - static void EnqueueDownloadManagerRequest(jobject chrome_download_delegate, + // Returns true iff this request resulted in the tab creating the download + // to close. + static bool EnqueueDownloadManagerRequest(jobject chrome_download_delegate, bool overwrite, jobject download_info); }; diff -Nru chromium-browser-45.0.2454.85/chrome/browser/android/download/chrome_download_manager_overwrite_infobar_delegate.cc chromium-browser-45.0.2454.101/chrome/browser/android/download/chrome_download_manager_overwrite_infobar_delegate.cc --- chromium-browser-45.0.2454.85/chrome/browser/android/download/chrome_download_manager_overwrite_infobar_delegate.cc 2015-08-22 19:01:51.000000000 +0000 +++ chromium-browser-45.0.2454.101/chrome/browser/android/download/chrome_download_manager_overwrite_infobar_delegate.cc 2015-09-16 21:46:55.000000000 +0000 @@ -41,16 +41,18 @@ file_selected_callback_(file_selected_callback) { } -void ChromeDownloadManagerOverwriteInfoBarDelegate::OverwriteExistingFile() { +bool ChromeDownloadManagerOverwriteInfoBarDelegate::OverwriteExistingFile() { file_selected_callback_.Run(suggested_download_path_); + return true; } -void ChromeDownloadManagerOverwriteInfoBarDelegate::CreateNewFile() { +bool ChromeDownloadManagerOverwriteInfoBarDelegate::CreateNewFile() { content::BrowserThread::PostTask( content::BrowserThread::FILE, FROM_HERE, base::Bind( &ChromeDownloadManagerOverwriteInfoBarDelegate::CreateNewFileInternal, suggested_download_path_, file_selected_callback_)); + return true; } std::string ChromeDownloadManagerOverwriteInfoBarDelegate::GetFileName() const { diff -Nru chromium-browser-45.0.2454.85/chrome/browser/android/download/chrome_download_manager_overwrite_infobar_delegate.h chromium-browser-45.0.2454.101/chrome/browser/android/download/chrome_download_manager_overwrite_infobar_delegate.h --- chromium-browser-45.0.2454.85/chrome/browser/android/download/chrome_download_manager_overwrite_infobar_delegate.h 2015-08-22 19:01:51.000000000 +0000 +++ chromium-browser-45.0.2454.101/chrome/browser/android/download/chrome_download_manager_overwrite_infobar_delegate.h 2015-09-16 21:46:55.000000000 +0000 @@ -37,8 +37,8 @@ const DownloadTargetDeterminerDelegate::FileSelectedCallback& callback); // DownloadOverwriteInfoBarDelegate: - void OverwriteExistingFile() override; - void CreateNewFile() override; + bool OverwriteExistingFile() override; + bool CreateNewFile() override; std::string GetFileName() const override; std::string GetDirName() const override; std::string GetDirFullPath() const override; diff -Nru chromium-browser-45.0.2454.85/chrome/browser/android/download/download_overwrite_infobar_delegate.h chromium-browser-45.0.2454.101/chrome/browser/android/download/download_overwrite_infobar_delegate.h --- chromium-browser-45.0.2454.85/chrome/browser/android/download/download_overwrite_infobar_delegate.h 2015-08-22 19:01:51.000000000 +0000 +++ chromium-browser-45.0.2454.101/chrome/browser/android/download/download_overwrite_infobar_delegate.h 2015-09-16 21:46:55.000000000 +0000 @@ -31,10 +31,14 @@ class DownloadOverwriteInfoBarDelegate : public infobars::InfoBarDelegate { public: // This is called when the user chooses to overwrite the existing file. - virtual void OverwriteExistingFile() = 0; + // If handling the operation results in dismissing the infobar, returns false + // (i.e. the caller must not dismiss the infobar). + virtual bool OverwriteExistingFile() = 0; // This is called when the user chooses to create a new file. - virtual void CreateNewFile() = 0; + // If handling the operation results in dismissing the infobar, returns false + // (i.e. the caller must not dismiss the infobar). + virtual bool CreateNewFile() = 0; // Gets the file name to be downloaded. virtual std::string GetFileName() const = 0; diff -Nru chromium-browser-45.0.2454.85/chrome/browser/banners/app_banner_manager_desktop.cc chromium-browser-45.0.2454.101/chrome/browser/banners/app_banner_manager_desktop.cc --- chromium-browser-45.0.2454.85/chrome/browser/banners/app_banner_manager_desktop.cc 2015-09-01 20:10:41.000000000 +0000 +++ chromium-browser-45.0.2454.101/chrome/browser/banners/app_banner_manager_desktop.cc 2015-09-25 09:06:19.000000000 +0000 @@ -20,13 +20,8 @@ namespace banners { bool AppBannerManagerDesktop::IsEnabled() { -#if defined(OS_CHROMEOS) - return !base::CommandLine::ForCurrentProcess()->HasSwitch( - switches::kDisableAddToShelf); -#else return base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kEnableAddToShelf); -#endif } AppBannerDataFetcher* AppBannerManagerDesktop::CreateAppBannerDataFetcher( diff -Nru chromium-browser-45.0.2454.85/chrome/browser/chromeos/login/ui/webui_login_view.cc chromium-browser-45.0.2454.101/chrome/browser/chromeos/login/ui/webui_login_view.cc --- chromium-browser-45.0.2454.85/chrome/browser/chromeos/login/ui/webui_login_view.cc 2015-09-01 20:10:41.000000000 +0000 +++ chromium-browser-45.0.2454.101/chrome/browser/chromeos/login/ui/webui_login_view.cc 2015-09-25 09:06:19.000000000 +0000 @@ -153,14 +153,6 @@ ui::EF_SHIFT_DOWN)] = kAccelNameToggleWebviewSignin; } - // Use KEY_RELEASED because Gaia consumes KEY_PRESSED for up/down key. - ui::Accelerator key_up(ui::VKEY_UP, ui::EF_NONE); - key_up.set_type(ui::ET_KEY_RELEASED); - ui::Accelerator key_down(ui::VKEY_DOWN, ui::EF_NONE); - key_down.set_type(ui::ET_KEY_RELEASED); - accel_map_[key_up] = kAccelFocusPrev; - accel_map_[key_down] = kAccelFocusNext; - accel_map_[ui::Accelerator( ui::VKEY_D, ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN | ui::EF_SHIFT_DOWN)] = kAccelNameDeviceRequisition; diff -Nru chromium-browser-45.0.2454.85/chrome/browser/devtools/device/adb/adb_client_socket_browsertest.cc chromium-browser-45.0.2454.101/chrome/browser/devtools/device/adb/adb_client_socket_browsertest.cc --- chromium-browser-45.0.2454.85/chrome/browser/devtools/device/adb/adb_client_socket_browsertest.cc 2015-09-01 20:10:41.000000000 +0000 +++ chromium-browser-45.0.2454.101/chrome/browser/devtools/device/adb/adb_client_socket_browsertest.cc 2015-09-04 20:10:39.000000000 +0000 @@ -134,8 +134,22 @@ DevToolsAndroidBridge::RemoteDevices devices_; }; -IN_PROC_BROWSER_TEST_F(AdbClientSocketTest, TestAdbClientSocket) { - StartMockAdbServer(); +IN_PROC_BROWSER_TEST_F(AdbClientSocketTest, TestFlushWithoutSize) { + StartMockAdbServer(FlushWithoutSize); + StartTest(); + CheckDevices(); + StopMockAdbServer(); +} + +IN_PROC_BROWSER_TEST_F(AdbClientSocketTest, TestFlushWithSize) { + StartMockAdbServer(FlushWithSize); + StartTest(); + CheckDevices(); + StopMockAdbServer(); +} + +IN_PROC_BROWSER_TEST_F(AdbClientSocketTest, TestFlushWithData) { + StartMockAdbServer(FlushWithData); StartTest(); CheckDevices(); StopMockAdbServer(); diff -Nru chromium-browser-45.0.2454.85/chrome/browser/devtools/device/adb/adb_client_socket.cc chromium-browser-45.0.2454.101/chrome/browser/devtools/device/adb/adb_client_socket.cc --- chromium-browser-45.0.2454.85/chrome/browser/devtools/device/adb/adb_client_socket.cc 2015-09-01 20:10:41.000000000 +0000 +++ chromium-browser-45.0.2454.101/chrome/browser/devtools/device/adb/adb_client_socket.cc 2015-09-04 20:10:39.000000000 +0000 @@ -243,22 +243,12 @@ return; } + // Trim OKAY. data = data.substr(4); - - if (!is_void) { - int payload_length = 0; - int bytes_left = -1; - if (data.length() >= 4 && - base::HexStringToInt(data.substr(0, 4), &payload_length)) { - data = data.substr(4); - bytes_left = payload_length - result + 8; - } else { - bytes_left = -1; - } - OnResponseData(callback, data, response_buffer, bytes_left, 0); - } else { + if (!is_void) + OnResponseData(callback, data, response_buffer, -1, 0); + else callback.Run(net::OK, data); - } } void AdbClientSocket::OnResponseData( @@ -272,9 +262,21 @@ return; } - bytes_left -= result; - std::string new_response = - response + std::string(response_buffer->data(), result); + std::string new_response = response + + std::string(response_buffer->data(), result); + + if (bytes_left == -1) { + // First read the response header. + int payload_length = 0; + if (new_response.length() >= 4 && + base::HexStringToInt(new_response.substr(0, 4), &payload_length)) { + new_response = new_response.substr(4); + bytes_left = payload_length - new_response.size(); + } + } else { + bytes_left -= result; + } + if (bytes_left == 0) { callback.Run(net::OK, new_response); return; diff -Nru chromium-browser-45.0.2454.85/chrome/browser/devtools/device/adb/mock_adb_server.cc chromium-browser-45.0.2454.101/chrome/browser/devtools/device/adb/mock_adb_server.cc --- chromium-browser-45.0.2454.85/chrome/browser/devtools/device/adb/mock_adb_server.cc 2015-09-01 20:10:41.000000000 +0000 +++ chromium-browser-45.0.2454.101/chrome/browser/devtools/device/adb/mock_adb_server.cc 2015-09-04 20:10:39.000000000 +0000 @@ -381,14 +381,17 @@ public base::NonThreadSafe, public MockAndroidConnection::Delegate { public: - static Parser* Create(const SimpleHttpServer::SendCallback& callback) { - return new AdbParser(callback); + static Parser* Create(FlushMode flush_mode, + const SimpleHttpServer::SendCallback& callback) { + return new AdbParser(flush_mode, callback); } ~AdbParser() override {} private: - explicit AdbParser(const SimpleHttpServer::SendCallback& callback) - : callback_(callback) { + explicit AdbParser(FlushMode flush_mode, + const SimpleHttpServer::SendCallback& callback) + : flush_mode_(flush_mode), + callback_(callback) { } int Consume(const char* data, int size) override { @@ -440,20 +443,29 @@ void Send(const std::string& status, const std::string& response) { CHECK(CalledOnValidThread()); CHECK_EQ(4U, status.size()); - - std::stringstream response_stream; - response_stream << status; + std::string buffer = status; + if (flush_mode_ == FlushWithoutSize) { + callback_.Run(buffer); + buffer = std::string(); + } int size = response.size(); if (size > 0) { static const char kHexChars[] = "0123456789ABCDEF"; for (int i = 3; i >= 0; i--) - response_stream << kHexChars[ (size >> 4*i) & 0x0f ]; - response_stream << response; + buffer += kHexChars[ (size >> 4*i) & 0x0f ]; + if (flush_mode_ == FlushWithSize) { + callback_.Run(buffer); + buffer = std::string(); + } + buffer += response; + callback_.Run(buffer); + } else if (flush_mode_ != FlushWithoutSize) { + callback_.Run(buffer); } - callback_.Run(response_stream.str()); } + FlushMode flush_mode_; SimpleHttpServer::SendCallback callback_; std::string serial_; scoped_ptr mock_connection_; @@ -461,14 +473,14 @@ static SimpleHttpServer* mock_adb_server_ = NULL; -void StartMockAdbServerOnIOThread() { +void StartMockAdbServerOnIOThread(FlushMode flush_mode) { CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); CHECK(mock_adb_server_ == NULL); net::IPAddressNumber address; net::ParseIPLiteralToNumber("127.0.0.1", &address); net::IPEndPoint endpoint(address, kAdbPort); - mock_adb_server_ = - new SimpleHttpServer(base::Bind(&AdbParser::Create), endpoint); + mock_adb_server_ = new SimpleHttpServer( + base::Bind(&AdbParser::Create, flush_mode), endpoint); } void StopMockAdbServerOnIOThread() { @@ -587,11 +599,11 @@ delegate_->SendRaw(response_data); } -void StartMockAdbServer() { +void StartMockAdbServer(FlushMode flush_mode) { BrowserThread::PostTaskAndReply( BrowserThread::IO, FROM_HERE, - base::Bind(&StartMockAdbServerOnIOThread), + base::Bind(&StartMockAdbServerOnIOThread, flush_mode), base::MessageLoop::QuitClosure()); content::RunMessageLoop(); } diff -Nru chromium-browser-45.0.2454.85/chrome/browser/devtools/device/adb/mock_adb_server.h chromium-browser-45.0.2454.101/chrome/browser/devtools/device/adb/mock_adb_server.h --- chromium-browser-45.0.2454.85/chrome/browser/devtools/device/adb/mock_adb_server.h 2015-09-01 20:10:41.000000000 +0000 +++ chromium-browser-45.0.2454.101/chrome/browser/devtools/device/adb/mock_adb_server.h 2015-09-04 20:10:39.000000000 +0000 @@ -12,7 +12,13 @@ // Single instance mock ADB server for use in browser tests. Runs on IO thread. // These methods can be called from any thread. -void StartMockAdbServer(); +enum FlushMode { + FlushWithoutSize, + FlushWithSize, + FlushWithData +}; + +void StartMockAdbServer(FlushMode flush_mode); void StopMockAdbServer(); // Part of mock server independent of transport. diff -Nru chromium-browser-45.0.2454.85/chrome/browser/extensions/api/messaging/extension_message_port.cc chromium-browser-45.0.2454.101/chrome/browser/extensions/api/messaging/extension_message_port.cc --- chromium-browser-45.0.2454.85/chrome/browser/extensions/api/messaging/extension_message_port.cc 2015-09-01 20:10:41.000000000 +0000 +++ chromium-browser-45.0.2454.101/chrome/browser/extensions/api/messaging/extension_message_port.cc 2015-09-25 09:06:20.000000000 +0000 @@ -27,6 +27,7 @@ const std::string& channel_name, scoped_ptr source_tab, int source_frame_id, + int target_tab_id, int target_frame_id, int guest_process_id, int guest_render_frame_routing_id, @@ -43,6 +44,7 @@ info.target_id = target_extension_id; info.source_id = source_extension_id; info.source_url = source_url; + info.target_tab_id = target_tab_id; info.target_frame_id = target_frame_id; info.guest_process_id = guest_process_id; info.guest_render_frame_routing_id = guest_render_frame_routing_id; diff -Nru chromium-browser-45.0.2454.85/chrome/browser/extensions/api/messaging/extension_message_port.h chromium-browser-45.0.2454.101/chrome/browser/extensions/api/messaging/extension_message_port.h --- chromium-browser-45.0.2454.85/chrome/browser/extensions/api/messaging/extension_message_port.h 2015-09-01 20:10:41.000000000 +0000 +++ chromium-browser-45.0.2454.101/chrome/browser/extensions/api/messaging/extension_message_port.h 2015-09-25 09:06:20.000000000 +0000 @@ -25,6 +25,7 @@ const std::string& channel_name, scoped_ptr source_tab, int source_frame_id, + int target_tab_id, int target_frame_id, int guest_process_id, int guest_render_frame_routing_id, diff -Nru chromium-browser-45.0.2454.85/chrome/browser/extensions/api/messaging/message_service.cc chromium-browser-45.0.2454.101/chrome/browser/extensions/api/messaging/message_service.cc --- chromium-browser-45.0.2454.85/chrome/browser/extensions/api/messaging/message_service.cc 2015-09-01 20:10:41.000000000 +0000 +++ chromium-browser-45.0.2454.101/chrome/browser/extensions/api/messaging/message_service.cc 2015-09-25 09:06:20.000000000 +0000 @@ -125,6 +125,7 @@ int source_process_id; scoped_ptr source_tab; int source_frame_id; + int target_tab_id; int target_frame_id; scoped_ptr receiver; int receiver_port_id; @@ -140,6 +141,7 @@ OpenChannelParams(int source_process_id, scoped_ptr source_tab, int source_frame_id, + int target_tab_id, int target_frame_id, MessagePort* receiver, int receiver_port_id, @@ -151,6 +153,7 @@ bool include_guest_process_info) : source_process_id(source_process_id), source_frame_id(source_frame_id), + target_tab_id(target_tab_id), target_frame_id(target_frame_id), receiver(receiver), receiver_port_id(receiver_port_id), @@ -348,8 +351,8 @@ } scoped_ptr params(new OpenChannelParams( - source_process_id, source_tab.Pass(), source_frame_id, - -1, // no target_frame_id for a channel to an extension/background page. + source_process_id, source_tab.Pass(), source_frame_id, -1, + -1, // no target_tab_id/target_frame_id for connections to extensions nullptr, receiver_port_id, source_extension_id, target_extension_id, source_url, channel_name, include_tls_channel_id, include_guest_process_info)); @@ -532,11 +535,11 @@ scoped_ptr(), // Source tab doesn't make sense // for opening to tabs. -1, // If there is no tab, then there is no frame either. - frame_id, - receiver.release(), receiver_port_id, extension_id, extension_id, + tab_id, frame_id, receiver.release(), receiver_port_id, extension_id, + extension_id, GURL(), // Source URL doesn't make sense for opening to tabs. channel_name, - false, // Connections to tabs don't get TLS channel IDs. + false, // Connections to tabs don't get TLS channel IDs. false)); // Connections to tabs aren't webview guests. OpenChannelImpl(params.Pass()); } @@ -585,17 +588,12 @@ // Send the connect event to the receiver. Give it the opener's port ID (the // opener has the opposite port ID). - channel->receiver->DispatchOnConnect(params->receiver_port_id, - params->channel_name, - params->source_tab.Pass(), - params->source_frame_id, - params->target_frame_id, - guest_process_id, - guest_render_frame_routing_id, - params->source_extension_id, - params->target_extension_id, - params->source_url, - params->tls_channel_id); + channel->receiver->DispatchOnConnect( + params->receiver_port_id, params->channel_name, params->source_tab.Pass(), + params->source_frame_id, params->target_tab_id, params->target_frame_id, + guest_process_id, guest_render_frame_routing_id, + params->source_extension_id, params->target_extension_id, + params->source_url, params->tls_channel_id); // Keep both ends of the channel alive until the channel is closed. channel->opener->IncrementLazyKeepaliveCount(); diff -Nru chromium-browser-45.0.2454.85/chrome/browser/extensions/api/messaging/message_service.h chromium-browser-45.0.2454.101/chrome/browser/extensions/api/messaging/message_service.h --- chromium-browser-45.0.2454.85/chrome/browser/extensions/api/messaging/message_service.h 2015-09-01 20:10:41.000000000 +0000 +++ chromium-browser-45.0.2454.101/chrome/browser/extensions/api/messaging/message_service.h 2015-09-25 09:06:20.000000000 +0000 @@ -73,6 +73,7 @@ const std::string& channel_name, scoped_ptr source_tab, int source_frame_id, + int target_tab_id, int target_frame_id, int guest_process_id, int guest_render_frame_routing_id, diff -Nru chromium-browser-45.0.2454.85/chrome/browser/extensions/api/web_request/web_request_apitest.cc chromium-browser-45.0.2454.101/chrome/browser/extensions/api/web_request/web_request_apitest.cc --- chromium-browser-45.0.2454.85/chrome/browser/extensions/api/web_request/web_request_apitest.cc 2015-09-01 20:10:41.000000000 +0000 +++ chromium-browser-45.0.2454.101/chrome/browser/extensions/api/web_request/web_request_apitest.cc 2015-09-25 09:06:20.000000000 +0000 @@ -19,6 +19,7 @@ #include "content/public/test/browser_test_utils.h" #include "extensions/browser/api/web_request/web_request_api.h" #include "extensions/browser/extension_system.h" +#include "extensions/common/extension_builder.h" #include "extensions/common/features/feature.h" #include "extensions/test/extension_test_message_listener.h" #include "extensions/test/result_catcher.h" @@ -389,3 +390,33 @@ listener_result.message()); } } + +IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, HostedAppRequest) { + ASSERT_TRUE(StartEmbeddedTestServer()); + GURL hosted_app_url( + embedded_test_server()->GetURL( + "/extensions/api_test/webrequest_hosted_app/index.html")); + scoped_refptr hosted_app = + extensions::ExtensionBuilder() + .SetManifest(extensions::DictionaryBuilder() + .Set("name", "Some hosted app") + .Set("version", "1") + .Set("manifest_version", 2) + .Set("app", extensions::DictionaryBuilder() + .Set("launch", extensions::DictionaryBuilder() + .Set("web_url", hosted_app_url.spec())))) + .Build(); + extensions::ExtensionSystem::Get(browser()->profile())->extension_service() + ->AddExtension(hosted_app.get()); + + ExtensionTestMessageListener listener1("main_frame", false); + ExtensionTestMessageListener listener2("xmlhttprequest", false); + + ASSERT_TRUE(LoadExtension( + test_data_dir_.AppendASCII("webrequest_hosted_app"))); + + ui_test_utils::NavigateToURL(browser(), hosted_app_url); + + EXPECT_TRUE(listener1.WaitUntilSatisfied()); + EXPECT_TRUE(listener2.WaitUntilSatisfied()); +} diff -Nru chromium-browser-45.0.2454.85/chrome/browser/extensions/extension_tabs_apitest.cc chromium-browser-45.0.2454.101/chrome/browser/extensions/extension_tabs_apitest.cc --- chromium-browser-45.0.2454.85/chrome/browser/extensions/extension_tabs_apitest.cc 2015-09-01 20:10:41.000000000 +0000 +++ chromium-browser-45.0.2454.101/chrome/browser/extensions/extension_tabs_apitest.cc 2015-09-25 09:06:20.000000000 +0000 @@ -159,8 +159,7 @@ ASSERT_TRUE(RunExtensionTest("tabs/get_current")) << message_; } -// Flaky on the trybots. See http://crbug.com/96725. -IN_PROC_BROWSER_TEST_F(ExtensionApiTest, DISABLED_TabConnect) { +IN_PROC_BROWSER_TEST_F(ExtensionApiTest, TabConnect) { ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(RunExtensionTest("tabs/connect")) << message_; } diff -Nru chromium-browser-45.0.2454.85/chrome/browser/first_run/first_run.cc chromium-browser-45.0.2454.101/chrome/browser/first_run/first_run.cc --- chromium-browser-45.0.2454.85/chrome/browser/first_run/first_run.cc 2015-08-22 19:01:52.000000000 +0000 +++ chromium-browser-45.0.2454.101/chrome/browser/first_run/first_run.cc 2015-09-10 19:01:27.000000000 +0000 @@ -48,6 +48,7 @@ #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" +#include "chrome/grit/locale_settings.h" #include "chrome/installer/util/master_preferences.h" #include "chrome/installer/util/master_preferences_constants.h" #include "chrome/installer/util/util_constants.h" @@ -55,6 +56,7 @@ #include "components/search_engines/template_url_service.h" #include "components/signin/core/browser/signin_manager.h" #include "components/signin/core/browser/signin_tracker.h" +#include "content/public/browser/navigation_entry.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" #include "content/public/browser/notification_service.h" @@ -63,6 +65,7 @@ #include "content/public/browser/web_contents.h" #include "extensions/browser/extension_system.h" #include "google_apis/gaia/gaia_auth_util.h" +#include "ui/base/l10n/l10n_util.h" #include "url/gurl.h" using base::UserMetricsAction; @@ -300,6 +303,18 @@ std::transform(src.begin(), src.end(), ret->begin(), &UrlFromString); } +bool IsOnWelcomePage(content::WebContents* contents) { + // We have to check both the GetURL() similar to the other checks below, but + // also the original request url because the welcome page we use is a + // redirect. + GURL welcome_page(l10n_util::GetStringUTF8(IDS_WELCOME_PAGE_URL)); + return contents->GetURL() == welcome_page || + (contents->GetController().GetVisibleEntry() && + contents->GetController() + .GetVisibleEntry() + ->GetOriginalRequestURL() == welcome_page); +} + // Show the first run search engine bubble at the first appropriate opportunity. // This bubble may be delayed by other UI, like global errors and sync promos. class FirstRunBubbleLauncher : public content::NotificationObserver { @@ -366,12 +381,12 @@ // Suppress the first run bubble if a Gaia sign in page or the sync setup // page is showing. - if (contents && - (contents->GetURL().GetOrigin().spec() == - chrome::kChromeUIChromeSigninURL || - gaia::IsGaiaSignonRealm(contents->GetURL().GetOrigin()) || - contents->GetURL() == - chrome::GetSettingsUrl(chrome::kSyncSetupSubPage))) { + if (contents && (contents->GetURL().GetOrigin().spec() == + chrome::kChromeUIChromeSigninURL || + gaia::IsGaiaSignonRealm(contents->GetURL().GetOrigin()) || + contents->GetURL() == + chrome::GetSettingsUrl(chrome::kSyncSetupSubPage) || + IsOnWelcomePage(contents))) { return; } diff -Nru chromium-browser-45.0.2454.85/chrome/browser/pdf/pdf_extension_test.cc chromium-browser-45.0.2454.101/chrome/browser/pdf/pdf_extension_test.cc --- chromium-browser-45.0.2454.85/chrome/browser/pdf/pdf_extension_test.cc 2015-09-01 20:10:42.000000000 +0000 +++ chromium-browser-45.0.2454.101/chrome/browser/pdf/pdf_extension_test.cc 2015-09-25 09:06:20.000000000 +0000 @@ -26,6 +26,15 @@ const int kNumberLoadTestParts = 10; +bool GetGuestCallback(content::WebContents** guest_out, + content::WebContents* guest) { + EXPECT_FALSE(*guest_out); + *guest_out = guest; + // Return false so that we iterate through all the guests and verify there is + // only one. + return false; +} + class PDFExtensionTest : public ExtensionApiTest, public testing::WithParamInterface { public: @@ -156,6 +165,48 @@ // someone deleting the directory and silently making the test pass. ASSERT_GE(count, 1u); } + + void TestGetSelectedTextReply(GURL url, bool expect_success) { + ASSERT_TRUE(LoadPdf(url)); + + content::WebContents* web_contents = + browser()->tab_strip_model()->GetActiveWebContents(); + + // Reach into the guest and hook into it such that it posts back a 'flush' + // message after every getSelectedTextReply message sent. + content::BrowserPluginGuestManager* guest_manager = + web_contents->GetBrowserContext()->GetGuestManager(); + content::WebContents* guest_contents = nullptr; + ASSERT_NO_FATAL_FAILURE(guest_manager->ForEachGuest( + web_contents, base::Bind(&GetGuestCallback, &guest_contents))); + ASSERT_TRUE(guest_contents); + ASSERT_TRUE(content::ExecuteScript( + guest_contents, + "var oldSendScriptingMessage = " + " PDFViewer.prototype.sendScriptingMessage_;" + "PDFViewer.prototype.sendScriptingMessage_ = function(message) {" + " oldSendScriptingMessage.bind(this)(message);" + " if (message.type == 'getSelectedTextReply')" + " this.parentWindow_.postMessage('flush', '*');" + "}")); + + // Add an event listener for flush messages and request the selected text. + // If we get a flush message without receiving getSelectedText we know that + // the message didn't come through. + bool success = false; + ASSERT_TRUE(content::ExecuteScriptAndExtractBool( + web_contents, + "window.addEventListener('message', function(event) {" + " if (event.data == 'flush')" + " window.domAutomationController.send(false);" + " if (event.data.type == 'getSelectedTextReply')" + " window.domAutomationController.send(true);" + "});" + "document.getElementsByTagName('embed')[0].postMessage(" + " {type: 'getSelectedText'});", + &success)); + ASSERT_EQ(expect_success, success); + } }; IN_PROC_BROWSER_TEST_P(PDFExtensionTest, Load) { @@ -200,6 +251,49 @@ RunTestsInFile("zoom_manager_test.js", "test.pdf"); } +// Ensure that the internal PDF plugin application/x-google-chrome-pdf won't be +// loaded if it's not loaded in the chrome extension page. +IN_PROC_BROWSER_TEST_F(PDFExtensionTest, EnsureInternalPluginDisabled) { + std::string url = embedded_test_server()->GetURL("/pdf/test.pdf").spec(); + std::string data_url = + "data:text/html," + "" + "" + ""; + ui_test_utils::NavigateToURL(browser(), GURL(data_url)); + content::WebContents* web_contents = + browser()->tab_strip_model()->GetActiveWebContents(); + bool plugin_loaded = false; + ASSERT_TRUE(content::ExecuteScriptAndExtractBool( + web_contents, + "var plugin_loaded = " + " document.getElementsByTagName('embed')[0].postMessage !== undefined;" + "window.domAutomationController.send(plugin_loaded);", + &plugin_loaded)); + ASSERT_FALSE(plugin_loaded); +} + +// Ensure cross-origin replies won't work for getSelectedText. +IN_PROC_BROWSER_TEST_F(PDFExtensionTest, EnsureCrossOriginRepliesBlocked) { + std::string url = embedded_test_server()->GetURL("/pdf/test.pdf").spec(); + std::string data_url = + "data:text/html," + "" + "" + ""; + TestGetSelectedTextReply(GURL(data_url), false); +} + +// Ensure same-origin replies do work for getSelectedText. +IN_PROC_BROWSER_TEST_F(PDFExtensionTest, EnsureSameOriginRepliesAllowed) { + TestGetSelectedTextReply(embedded_test_server()->GetURL("/pdf/test.pdf"), + true); +} + class MaterialPDFExtensionTest : public PDFExtensionTest { void SetUpCommandLine(base::CommandLine* command_line) override { command_line->AppendSwitch(switches::kEnablePdfMaterialUI); diff -Nru chromium-browser-45.0.2454.85/chrome/browser/resources/pdf/pdf.js chromium-browser-45.0.2454.101/chrome/browser/resources/pdf/pdf.js --- chromium-browser-45.0.2454.85/chrome/browser/resources/pdf/pdf.js 2015-09-01 20:10:42.000000000 +0000 +++ chromium-browser-45.0.2454.101/chrome/browser/resources/pdf/pdf.js 2015-09-25 09:06:20.000000000 +0000 @@ -84,6 +84,7 @@ this.browserApi_ = browserApi; this.loadState_ = LoadState.LOADING; this.parentWindow_ = null; + this.parentOrigin_ = null; this.delayedScriptingMessages_ = []; @@ -674,6 +675,7 @@ handleScriptingMessage: function(message) { if (this.parentWindow_ != message.source) { this.parentWindow_ = message.source; + this.parentOrigin_ = message.origin; // Ensure that we notify the embedder if the document is loaded. if (this.loadState_ != LoadState.LOADING) this.sendDocumentLoadedMessage_(); @@ -760,11 +762,22 @@ * @param {Object} message the message to send. */ sendScriptingMessage_: function(message) { - if (this.parentWindow_) - this.parentWindow_.postMessage(message, '*'); + if (this.parentWindow_ && this.parentOrigin_) { + var targetOrigin; + // Only send data back to the embedder if it is from the same origin, + // unless we're sending it to ourselves (which could happen in the case + // of tests). We also allow documentLoaded messages through as this won't + // leak important information. + if (this.parentOrigin_ == window.location.origin) + targetOrigin = this.parentOrigin_; + else if (message.type == 'documentLoaded') + targetOrigin = '*'; + else + targetOrigin = this.browserApi_.getStreamInfo().originalUrl; + this.parentWindow_.postMessage(message, targetOrigin); + } }, - /** * @type {Viewport} the viewport of the PDF viewer. */ diff -Nru chromium-browser-45.0.2454.85/chrome/browser/signin/oauth2_token_service_delegate_android.cc chromium-browser-45.0.2454.101/chrome/browser/signin/oauth2_token_service_delegate_android.cc --- chromium-browser-45.0.2454.85/chrome/browser/signin/oauth2_token_service_delegate_android.cc 2015-09-01 20:10:42.000000000 +0000 +++ chromium-browser-45.0.2454.101/chrome/browser/signin/oauth2_token_service_delegate_android.cc 2015-09-25 09:06:20.000000000 +0000 @@ -199,6 +199,9 @@ void OAuth2TokenServiceDelegateAndroid::UpdateAuthError( const std::string& account_id, const GoogleServiceAuthError& error) { + DVLOG(1) << "OAuth2TokenServiceDelegateAndroid::UpdateAuthError" + << " account=" << account_id + << " error=" << error.ToString(); if (error.state() == GoogleServiceAuthError::NONE) { errors_.erase(account_id); } else { @@ -264,6 +267,10 @@ signed_in_account = ConvertJavaStringToUTF8(env, j_current_acc); if (!signed_in_account.empty()) signed_in_account = gaia::CanonicalizeEmail(signed_in_account); + + // Clear any auth errors so that client can retry to get access tokens. + errors_.clear(); + ValidateAccounts(signed_in_account, j_force_notifications != JNI_FALSE); } @@ -456,17 +463,19 @@ void OAuth2TokenFetched(JNIEnv* env, jclass clazz, jstring authToken, + jboolean isTransientError, jlong nativeCallback) { std::string token; if (authToken) token = ConvertJavaStringToUTF8(env, authToken); scoped_ptr heap_callback( reinterpret_cast(nativeCallback)); - // Android does not provide enough information to know if the credentials are - // wrong, so assume any error is transient by using CONNECTION_FAILED. - GoogleServiceAuthError err(authToken - ? GoogleServiceAuthError::NONE - : GoogleServiceAuthError::CONNECTION_FAILED); + GoogleServiceAuthError + err(authToken + ? GoogleServiceAuthError::NONE + : isTransientError + ? GoogleServiceAuthError::CONNECTION_FAILED + : GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS); heap_callback->Run(err, token, base::Time()); } diff -Nru chromium-browser-45.0.2454.85/chrome/browser/ui/android/infobars/download_overwrite_infobar.cc chromium-browser-45.0.2454.101/chrome/browser/ui/android/infobars/download_overwrite_infobar.cc --- chromium-browser-45.0.2454.85/chrome/browser/ui/android/infobars/download_overwrite_infobar.cc 2015-08-22 19:01:52.000000000 +0000 +++ chromium-browser-45.0.2454.101/chrome/browser/ui/android/infobars/download_overwrite_infobar.cc 2015-09-16 21:46:56.000000000 +0000 @@ -50,14 +50,15 @@ return; // We're closing; don't call anything, it might access the owner. DownloadOverwriteInfoBarDelegate* delegate = GetDelegate(); - if (action == InfoBarAndroid::ACTION_OVERWRITE) - delegate->OverwriteExistingFile(); - else if (action == InfoBarAndroid::ACTION_CREATE_NEW_FILE) - delegate->CreateNewFile(); - else - DCHECK(false); - - RemoveSelf(); + if (action == InfoBarAndroid::ACTION_OVERWRITE) { + if (delegate->OverwriteExistingFile()) + RemoveSelf(); + } else if (action == InfoBarAndroid::ACTION_CREATE_NEW_FILE) { + if (delegate->CreateNewFile()) + RemoveSelf(); + } else { + CHECK(false); + } } DownloadOverwriteInfoBarDelegate* DownloadOverwriteInfoBar::GetDelegate() { diff -Nru chromium-browser-45.0.2454.85/chrome/browser/ui/cocoa/browser_window_cocoa.mm chromium-browser-45.0.2454.101/chrome/browser/ui/cocoa/browser_window_cocoa.mm --- chromium-browser-45.0.2454.85/chrome/browser/ui/cocoa/browser_window_cocoa.mm 2015-09-01 20:10:42.000000000 +0000 +++ chromium-browser-45.0.2454.101/chrome/browser/ui/cocoa/browser_window_cocoa.mm 2015-09-25 09:06:20.000000000 +0000 @@ -168,11 +168,11 @@ } { - TRACE_EVENT0("ui", "BrowserWindowCocoa::Show Activate"); + TRACE_EVENT0("ui", "BrowserWindowCocoa::Show makeKeyAndOrderFront"); // This call takes up a substantial part of startup time, and an even more // substantial part of startup time when any CALayers are part of the // window's NSView heirarchy. - Activate(); + [window() makeKeyAndOrderFront:controller_]; } // When creating windows from nibs it is necessary to |makeKeyAndOrderFront:| diff -Nru chromium-browser-45.0.2454.85/chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.mm chromium-browser-45.0.2454.101/chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.mm --- chromium-browser-45.0.2454.85/chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.mm 2015-09-01 20:10:42.000000000 +0000 +++ chromium-browser-45.0.2454.101/chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.mm 2015-09-25 09:06:20.000000000 +0000 @@ -82,8 +82,7 @@ void SetControlSize(NSControl* control, NSControlSize controlSize) { CGFloat fontSize = [NSFont systemFontSizeForControlSize:controlSize]; NSCell* cell = [control cell]; - NSFont* font = [NSFont fontWithName:[[cell font] fontName] size:fontSize]; - [cell setFont:font]; + [cell setFont:[NSFont systemFontOfSize:fontSize]]; [cell setControlSize:controlSize]; } diff -Nru chromium-browser-45.0.2454.85/chrome/browser/ui/cocoa/draggable_button.mm chromium-browser-45.0.2454.101/chrome/browser/ui/cocoa/draggable_button.mm --- chromium-browser-45.0.2454.85/chrome/browser/ui/cocoa/draggable_button.mm 2015-09-01 20:10:42.000000000 +0000 +++ chromium-browser-45.0.2454.101/chrome/browser/ui/cocoa/draggable_button.mm 2015-09-16 21:46:56.000000000 +0000 @@ -43,7 +43,9 @@ if ([draggableButtonImpl_ mouseDownImpl:theEvent] == kDraggableButtonMixinCallSuper) { - [super mouseDown:theEvent]; + // Hack to suppress a crash. See http://crbug.com/509833 for details. + if ([self window] && ![self isHiddenOrHasHiddenAncestor]) + [super mouseDown:theEvent]; } } diff -Nru chromium-browser-45.0.2454.85/chrome/browser/ui/cocoa/status_bubble_mac.mm chromium-browser-45.0.2454.101/chrome/browser/ui/cocoa/status_bubble_mac.mm --- chromium-browser-45.0.2454.85/chrome/browser/ui/cocoa/status_bubble_mac.mm 2015-09-01 20:10:42.000000000 +0000 +++ chromium-browser-45.0.2454.101/chrome/browser/ui/cocoa/status_bubble_mac.mm 2015-09-25 09:06:20.000000000 +0000 @@ -25,6 +25,7 @@ #include "ui/base/cocoa/window_size_constants.h" #include "ui/gfx/font_list.h" #include "ui/gfx/geometry/point.h" +#include "ui/gfx/platform_font.h" #include "ui/gfx/text_elider.h" #include "ui/gfx/text_utils.h" @@ -232,7 +233,7 @@ text_width = static_cast(scaled_width.width); NSFont* font = [[window_ contentView] font]; gfx::FontList font_list_chr( - gfx::Font(base::SysNSStringToUTF8([font fontName]), [font pointSize])); + gfx::Font(gfx::PlatformFont::CreateFromNativeFont(font))); base::string16 original_url_text = net::FormatUrl(url, languages); base::string16 status = @@ -704,7 +705,7 @@ // Generate the URL string that fits in the expanded bubble. NSFont* font = [[window_ contentView] font]; gfx::FontList font_list_chr( - gfx::Font(base::SysNSStringToUTF8([font fontName]), [font pointSize])); + gfx::Font(gfx::PlatformFont::CreateFromNativeFont(font))); base::string16 expanded_url = ElideUrl( url_, font_list_chr, max_bubble_width, languages_); diff -Nru chromium-browser-45.0.2454.85/chrome/browser/ui/cocoa/tabs/tab_view.mm chromium-browser-45.0.2454.101/chrome/browser/ui/cocoa/tabs/tab_view.mm --- chromium-browser-45.0.2454.85/chrome/browser/ui/cocoa/tabs/tab_view.mm 2015-09-01 20:10:42.000000000 +0000 +++ chromium-browser-45.0.2454.101/chrome/browser/ui/cocoa/tabs/tab_view.mm 2015-09-25 09:06:20.000000000 +0000 @@ -97,9 +97,7 @@ [[GTMFadeTruncatingTextFieldCell alloc] initTextCell:@"Label"]); [labelCell setControlSize:NSSmallControlSize]; CGFloat fontSize = [NSFont systemFontSizeForControlSize:NSSmallControlSize]; - NSFont* font = [NSFont fontWithName:[[labelCell font] fontName] - size:fontSize]; - [labelCell setFont:font]; + [labelCell setFont:[NSFont systemFontOfSize:fontSize]]; [titleView_ setCell:labelCell]; titleViewCell_ = labelCell; diff -Nru chromium-browser-45.0.2454.85/chrome/browser/ui/webui/inspect_ui_browsertest.cc chromium-browser-45.0.2454.101/chrome/browser/ui/webui/inspect_ui_browsertest.cc --- chromium-browser-45.0.2454.85/chrome/browser/ui/webui/inspect_ui_browsertest.cc 2015-09-01 20:10:42.000000000 +0000 +++ chromium-browser-45.0.2454.101/chrome/browser/ui/webui/inspect_ui_browsertest.cc 2015-09-04 20:10:39.000000000 +0000 @@ -76,7 +76,7 @@ providers.push_back(new AdbDeviceProvider()); android_bridge->set_device_providers_for_test(providers); - StartMockAdbServer(); + StartMockAdbServer(FlushWithSize); ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIInspectURL)); diff -Nru chromium-browser-45.0.2454.85/chrome/chrome_installer.gypi chromium-browser-45.0.2454.101/chrome/chrome_installer.gypi --- chromium-browser-45.0.2454.85/chrome/chrome_installer.gypi 2015-09-01 20:10:42.000000000 +0000 +++ chromium-browser-45.0.2454.101/chrome/chrome_installer.gypi 2015-09-25 09:06:20.000000000 +0000 @@ -211,6 +211,7 @@ 'target_name': 'setup', 'type': 'executable', 'dependencies': [ + 'chrome_version_header', 'installer_util', 'installer_util_strings', '../base/base.gyp:base', diff -Nru chromium-browser-45.0.2454.85/chrome/common/localized_error.cc chromium-browser-45.0.2454.101/chrome/common/localized_error.cc --- chromium-browser-45.0.2454.85/chrome/common/localized_error.cc 2015-09-01 20:10:42.000000000 +0000 +++ chromium-browser-45.0.2454.101/chrome/common/localized_error.cc 2015-09-25 09:06:20.000000000 +0000 @@ -44,8 +44,7 @@ static const char kRedirectLoopLearnMoreUrl[] = "https://support.google.com/chrome/answer/95626"; static const char kWeakDHKeyLearnMoreUrl[] = - "https://www.chromium.org/administrators/" - "err_ssl_weak_server_ephemeral_dh_key"; + "https://support.google.com/chrome?p=dh_error"; static const char kCachedCopyButtonFieldTrial[] = "EnableGoogleCachedCopyTextExperiment"; static const char kCachedCopyButtonExpTypeControl[] = "control"; diff -Nru chromium-browser-45.0.2454.85/chrome/installer/setup/setup_main.cc chromium-browser-45.0.2454.101/chrome/installer/setup/setup_main.cc --- chromium-browser-45.0.2454.85/chrome/installer/setup/setup_main.cc 2015-09-01 20:10:42.000000000 +0000 +++ chromium-browser-45.0.2454.101/chrome/installer/setup/setup_main.cc 2015-09-25 09:06:20.000000000 +0000 @@ -66,6 +66,7 @@ #include "chrome/installer/util/self_cleaning_temp_dir.h" #include "chrome/installer/util/shell_util.h" #include "chrome/installer/util/user_experiment.h" +#include "version.h" // NOLINT #if defined(GOOGLE_CHROME_BUILD) #include "chrome/installer/util/updating_app_registration_data.h" @@ -1204,21 +1205,18 @@ // Returns the Custom information for the client identified by the exe path // passed in. This information is used for crash reporting. google_breakpad::CustomClientInfo* GetCustomInfo(const wchar_t* exe_path) { - base::string16 product; base::string16 version; scoped_ptr version_info( FileVersionInfo::CreateFileVersionInfo(base::FilePath(exe_path))); - if (version_info.get()) { + if (version_info.get()) version = version_info->product_version(); - product = version_info->product_short_name(); - } if (version.empty()) version = L"0.1.0.0"; - if (product.empty()) - product = L"Chrome Installer"; - + // Report crashes under the same product name as the browser. This string + // MUST match server-side configuration. + base::string16 product(base::ASCIIToUTF16(PRODUCT_SHORTNAME_STRING)); static google_breakpad::CustomInfoEntry ver_entry(L"ver", version.c_str()); static google_breakpad::CustomInfoEntry prod_entry(L"prod", product.c_str()); static google_breakpad::CustomInfoEntry plat_entry(L"plat", L"Win32"); @@ -1261,6 +1259,15 @@ base::string16 pipe_name = kGoogleUpdatePipeName; pipe_name += user_sid; +#ifdef _WIN64 + // The protocol for connecting to the out-of-process Breakpad crash + // reporter is different for x86-32 and x86-64: the message sizes + // are different because the message struct contains a pointer. As + // a result, there are two different named pipes to connect to. The + // 64-bit one is distinguished with an "-x64" suffix. + pipe_name += L"-x64"; +#endif + return scoped_ptr( new google_breakpad::ExceptionHandler( temp_directory.value(), NULL, NULL, NULL, diff -Nru chromium-browser-45.0.2454.85/chrome/renderer/chrome_content_renderer_client.cc chromium-browser-45.0.2454.101/chrome/renderer/chrome_content_renderer_client.cc --- chromium-browser-45.0.2454.85/chrome/renderer/chrome_content_renderer_client.cc 2015-09-01 20:10:42.000000000 +0000 +++ chromium-browser-45.0.2454.101/chrome/renderer/chrome_content_renderer_client.cc 2015-09-25 09:06:20.000000000 +0000 @@ -497,6 +497,13 @@ WebSecurityPolicy::registerURLSchemeAsBypassingContentSecurityPolicy( extension_resource_scheme); + // Extension resources, when loaded as the top-level document, should bypass + // Blink's strict first-party origin checks. + WebSecurityPolicy::registerURLSchemeAsFirstPartyWhenTopLevel( + extension_scheme); + WebSecurityPolicy::registerURLSchemeAsFirstPartyWhenTopLevel( + extension_resource_scheme); + #if defined(ENABLE_PRINT_PREVIEW) pdf_print_client_.reset(new ChromePDFPrintClient()); pdf::PepperPDFHost::SetPrintClient(pdf_print_client_.get()); diff -Nru chromium-browser-45.0.2454.85/chrome/renderer/resources/plugins/plugin_placeholders.css chromium-browser-45.0.2454.101/chrome/renderer/resources/plugins/plugin_placeholders.css --- chromium-browser-45.0.2454.85/chrome/renderer/resources/plugins/plugin_placeholders.css 2015-09-01 20:10:42.000000000 +0000 +++ chromium-browser-45.0.2454.101/chrome/renderer/resources/plugins/plugin_placeholders.css 2015-09-02 22:27:03.000000000 +0000 @@ -31,26 +31,16 @@ } #outer { + align-items: center; border: 1px black solid; box-sizing: border-box; + display: flex; height: 100%; + justify-content: center; position: absolute; width: 100%; } -#inner { - height: 100%; - - margin-top: -70px; - - - margin-top: -14px; - - position: relative; - top: 50%; - width: 100%; -} - #close { background-image: -webkit-image-set( url(../../../../ui/resources/default_100_percent/close_2.png) 1x, diff -Nru chromium-browser-45.0.2454.85/chrome/renderer/resources/plugins/plugin_poster.html chromium-browser-45.0.2454.101/chrome/renderer/resources/plugins/plugin_poster.html --- chromium-browser-45.0.2454.85/chrome/renderer/resources/plugins/plugin_poster.html 2015-09-01 20:10:42.000000000 +0000 +++ chromium-browser-45.0.2454.101/chrome/renderer/resources/plugins/plugin_poster.html 2015-09-02 22:27:03.000000000 +0000 @@ -21,7 +21,6 @@ #outer { border: none; cursor: pointer; - position: relative; } #shielding { @@ -34,11 +33,12 @@ z-index: 2; } -#plugin_icon { +#plugin-icon { + display: block; opacity: 0.8; } -#plugin_icon:hover { +#plugin-icon:hover { opacity: 0.95; } @@ -49,14 +49,14 @@ z-index: 1; } -#inner_container { - height: 100%; - position: relative; - width: 100%; -} - -#inner { - margin-top: -25px; +#inner-container { + align-items: center; + display: flex; + justify-content: center; + left: 0px; + position: absolute; + top: 0px; + z-index: 2; } @@ -65,12 +65,13 @@
-
-
-
- -
+
+
+
+
@@ -84,7 +85,7 @@ }; window.setPosterMargin = function(marginLeft, marginTop) { - var container = document.getElementById('inner_container'); + var container = document.getElementById('inner-container'); container.style.marginLeft = marginLeft; container.style.marginTop = marginTop; }; diff -Nru chromium-browser-45.0.2454.85/chrome/VERSION chromium-browser-45.0.2454.101/chrome/VERSION --- chromium-browser-45.0.2454.85/chrome/VERSION 2015-09-01 20:10:41.000000000 +0000 +++ chromium-browser-45.0.2454.101/chrome/VERSION 2015-09-25 09:06:19.000000000 +0000 @@ -1,4 +1,4 @@ MAJOR=45 MINOR=0 BUILD=2454 -PATCH=85 +PATCH=101 diff -Nru chromium-browser-45.0.2454.85/components/app_modal/javascript_dialog_manager.cc chromium-browser-45.0.2454.101/components/app_modal/javascript_dialog_manager.cc --- chromium-browser-45.0.2454.85/components/app_modal/javascript_dialog_manager.cc 2015-09-01 20:10:42.000000000 +0000 +++ chromium-browser-45.0.2454.101/components/app_modal/javascript_dialog_manager.cc 2015-09-25 09:06:20.000000000 +0000 @@ -220,13 +220,17 @@ content::WebContents* web_contents) { AppModalDialogQueue* queue = AppModalDialogQueue::GetInstance(); AppModalDialog* active_dialog = queue->active_dialog(); - if (active_dialog && active_dialog->web_contents() == web_contents) - active_dialog->Invalidate(); for (AppModalDialogQueue::iterator i = queue->begin(); i != queue->end(); ++i) { + // Invalidating the active dialog might trigger showing a not-yet + // invalidated dialog, so invalidate the active dialog last. + if ((*i) == active_dialog) + continue; if ((*i)->web_contents() == web_contents) (*i)->Invalidate(); } + if (active_dialog && active_dialog->web_contents() == web_contents) + active_dialog->Invalidate(); } void JavaScriptDialogManager::OnDialogClosed( diff -Nru chromium-browser-45.0.2454.85/components/invalidation/impl/android/java/src/org/chromium/components/invalidation/InvalidationClientService.java chromium-browser-45.0.2454.101/components/invalidation/impl/android/java/src/org/chromium/components/invalidation/InvalidationClientService.java --- chromium-browser-45.0.2454.85/components/invalidation/impl/android/java/src/org/chromium/components/invalidation/InvalidationClientService.java 2015-09-01 20:10:42.000000000 +0000 +++ chromium-browser-45.0.2454.101/components/invalidation/impl/android/java/src/org/chromium/components/invalidation/InvalidationClientService.java 2015-09-25 09:06:20.000000000 +0000 @@ -211,7 +211,7 @@ account, invalidAuthToken, getOAuth2ScopeWithType(), new AccountManagerHelper.GetAuthTokenCallback() { @Override - public void tokenAvailable(String token) { + public void tokenAvailable(String token, boolean isTransientError) { if (token != null) { setAuthToken(InvalidationClientService.this.getApplicationContext(), pendingIntent, token, getOAuth2ScopeWithType()); diff -Nru chromium-browser-45.0.2454.85/components/signin/core/browser/gaia_cookie_manager_service.cc chromium-browser-45.0.2454.101/components/signin/core/browser/gaia_cookie_manager_service.cc --- chromium-browser-45.0.2454.85/components/signin/core/browser/gaia_cookie_manager_service.cc 2015-09-01 20:10:42.000000000 +0000 +++ chromium-browser-45.0.2454.101/components/signin/core/browser/gaia_cookie_manager_service.cc 2015-09-25 09:06:21.000000000 +0000 @@ -427,40 +427,22 @@ fetcher_timer_.Stop(); } -// It is unknown if the cookie was changed because of processing initiated by -// this class or other (such as the user clearing all cookies or a cookie being -// evicted). void GaiaCookieManagerService::OnCookieChanged( const net::CanonicalCookie& cookie, bool removed) { DCHECK_EQ("APISID", cookie.Name()); DCHECK_EQ(GaiaUrls::GetInstance()->google_url().host(), cookie.Domain()); + // Ignore changes to the cookie while requests are pending. These changes + // are caused by the service itself as it adds accounts. A side effects is + // that any changes to the gaia cookie outside of this class, while requests + // are pending, will be lost. However, trying to process these changes could + // cause an endless loop (see crbug.com/516070). if (requests_.empty()) { requests_.push_back(GaiaCookieRequest::CreateListAccountsRequest()); fetcher_retries_ = 0; signin_client_->DelayNetworkCall( base::Bind(&GaiaCookieManagerService::StartFetchingListAccounts, base::Unretained(this))); - } else { - // Remove all pending ListAccount calls; for efficiency, only call - // after all pending requests are processed. - // Track requests to keep; all other unstarted requests will be removed. - std::vector requests_to_keep; - - // Check all pending, non-executing requests. - for (auto it = requests_.begin() + 1; it != requests_.end(); ++it) { - // Keep all requests except for LIST_ACCOUNTS. - if (it->request_type() != GaiaCookieRequestType::LIST_ACCOUNTS) - requests_to_keep.push_back(*it); - } - - // Remove all but the executing request. Re-add all requests being kept. - if (requests_.size() > 1) { - requests_.erase(requests_.begin() + 1, requests_.end()); - requests_.insert( - requests_.end(), requests_to_keep.begin(), requests_to_keep.end()); - } - requests_.push_back(GaiaCookieRequest::CreateListAccountsRequest()); } } diff -Nru chromium-browser-45.0.2454.85/content/browser/service_worker/service_worker_context_core.cc chromium-browser-45.0.2454.101/content/browser/service_worker/service_worker_context_core.cc --- chromium-browser-45.0.2454.85/content/browser/service_worker/service_worker_context_core.cc 2015-09-01 20:10:42.000000000 +0000 +++ chromium-browser-45.0.2454.101/content/browser/service_worker/service_worker_context_core.cc 2015-09-25 09:06:21.000000000 +0000 @@ -494,6 +494,9 @@ scoped_ptr transferee) { ProviderMap* map = GetProviderMapForProcess(new_process_id); ServiceWorkerProviderHost* temp = map->Lookup(new_provider_id); + if (!temp) + return; + DCHECK(temp->document_url().is_empty()); transferee->CompleteCrossSiteTransfer(new_process_id, temp->frame_id(), diff -Nru chromium-browser-45.0.2454.85/content/browser/site_per_process_browsertest.cc chromium-browser-45.0.2454.101/content/browser/site_per_process_browsertest.cc --- chromium-browser-45.0.2454.85/content/browser/site_per_process_browsertest.cc 2015-09-01 20:10:42.000000000 +0000 +++ chromium-browser-45.0.2454.101/content/browser/site_per_process_browsertest.cc 2015-09-25 09:06:21.000000000 +0000 @@ -1524,7 +1524,7 @@ // Create the cross-site URL to navigate to. GURL cross_site_url = - embedded_test_server()->GetURL("foo.com", "/frame_tree/1-1.html"); + embedded_test_server()->GetURL("foo.com", "/frame_tree/title2.html"); // Load cross-site page into the second iframe without waiting for the // navigation to complete. Once LoadURLWithParams returns, we would expect @@ -1584,7 +1584,7 @@ } // Load another cross-site page into the same iframe. - cross_site_url = embedded_test_server()->GetURL("bar.com", "/title2.html"); + cross_site_url = embedded_test_server()->GetURL("bar.com", "/title3.html"); { // Perform the same checks as the first cross-site navigation, since // there have been issues in subsequent cross-site navigations. Also ensure diff -Nru chromium-browser-45.0.2454.85/content/child/service_worker/web_service_worker_impl.cc chromium-browser-45.0.2454.101/content/child/service_worker/web_service_worker_impl.cc --- chromium-browser-45.0.2454.85/content/child/service_worker/web_service_worker_impl.cc 2015-09-01 20:10:42.000000000 +0000 +++ chromium-browser-45.0.2454.101/content/child/service_worker/web_service_worker_impl.cc 2015-09-25 09:06:21.000000000 +0000 @@ -44,7 +44,11 @@ void WebServiceWorkerImpl::OnStateChanged( blink::WebServiceWorkerState new_state) { state_ = new_state; - proxy_->dispatchStateChangeEvent(); + + // TODO(nhiroki): This is a quick fix for http://crbug.com/507110 + DCHECK(proxy_); + if (proxy_) + proxy_->dispatchStateChangeEvent(); } void WebServiceWorkerImpl::setProxy(blink::WebServiceWorkerProxy* proxy) { diff -Nru chromium-browser-45.0.2454.85/content/common/gpu/media/h264_decoder.cc chromium-browser-45.0.2454.101/content/common/gpu/media/h264_decoder.cc --- chromium-browser-45.0.2454.85/content/common/gpu/media/h264_decoder.cc 2015-08-22 19:01:55.000000000 +0000 +++ chromium-browser-45.0.2454.101/content/common/gpu/media/h264_decoder.cc 2015-09-23 19:11:03.000000000 +0000 @@ -362,9 +362,6 @@ dpb_.GetLongTermRefPicsAppending(&ref_pic_list_p0_); std::sort(ref_pic_list_p0_.begin() + num_short_refs, ref_pic_list_p0_.end(), LongTermPicNumAscCompare()); - - // Cut off if we have more than requested in slice header. - ref_pic_list_p0_.resize(slice_hdr->num_ref_idx_l0_active_minus1 + 1); } struct POCAscCompare { @@ -436,12 +433,6 @@ std::equal(ref_pic_list_b0_.begin(), ref_pic_list_b0_.end(), ref_pic_list_b1_.begin())) std::swap(ref_pic_list_b1_[0], ref_pic_list_b1_[1]); - - // Per 8.2.4.2 it's possible for num_ref_idx_lX_active_minus1 to indicate - // there should be more ref pics on list than we constructed. - // Those superfluous ones should be treated as non-reference. - ref_pic_list_b0_.resize(slice_hdr->num_ref_idx_l0_active_minus1 + 1); - ref_pic_list_b1_.resize(slice_hdr->num_ref_idx_l1_active_minus1 + 1); } // See 8.2.4 @@ -489,25 +480,36 @@ bool H264Decoder::ModifyReferencePicList(media::H264SliceHeader* slice_hdr, int list, H264Picture::Vector* ref_pic_listx) { + bool ref_pic_list_modification_flag_lX; int num_ref_idx_lX_active_minus1; media::H264ModificationOfPicNum* list_mod; // This can process either ref_pic_list0 or ref_pic_list1, depending on // the list argument. Set up pointers to proper list to be processed here. if (list == 0) { - if (!slice_hdr->ref_pic_list_modification_flag_l0) - return true; - + ref_pic_list_modification_flag_lX = + slice_hdr->ref_pic_list_modification_flag_l0; + num_ref_idx_lX_active_minus1 = + slice_hdr->num_ref_idx_l0_active_minus1; list_mod = slice_hdr->ref_list_l0_modifications; } else { - if (!slice_hdr->ref_pic_list_modification_flag_l1) - return true; - + ref_pic_list_modification_flag_lX = + slice_hdr->ref_pic_list_modification_flag_l1; + num_ref_idx_lX_active_minus1 = + slice_hdr->num_ref_idx_l1_active_minus1; list_mod = slice_hdr->ref_list_l1_modifications; } - num_ref_idx_lX_active_minus1 = ref_pic_listx->size() - 1; + // Resize the list to the size requested in the slice header. + // Note that per 8.2.4.2 it's possible for num_ref_idx_lX_active_minus1 to + // indicate there should be more ref pics on list than we constructed. + // Those superfluous ones should be treated as non-reference and will be + // initialized to nullptr, which must be handled by clients. DCHECK_GE(num_ref_idx_lX_active_minus1, 0); + ref_pic_listx->resize(num_ref_idx_lX_active_minus1 + 1); + + if (!ref_pic_list_modification_flag_lX) + return true; // Spec 8.2.4.3: // Reorder pictures on the list in a way specified in the stream. diff -Nru chromium-browser-45.0.2454.85/content/content.gyp chromium-browser-45.0.2454.101/content/content.gyp --- chromium-browser-45.0.2454.85/content/content.gyp 2015-09-01 20:10:42.000000000 +0000 +++ chromium-browser-45.0.2454.101/content/content.gyp 2015-09-25 09:06:21.000000000 +0000 @@ -430,6 +430,7 @@ 'dependencies': [ '../base/base.gyp:base', '../device/battery/battery.gyp:device_battery_java', + '../device/bluetooth/bluetooth.gyp:device_bluetooth_java', '../device/vibration/vibration.gyp:device_vibration_java', '../media/media.gyp:media_java', '../mojo/mojo_base.gyp:mojo_application_bindings', diff -Nru chromium-browser-45.0.2454.85/content/public/android/BUILD.gn chromium-browser-45.0.2454.101/content/public/android/BUILD.gn --- chromium-browser-45.0.2454.85/content/public/android/BUILD.gn 2015-09-01 20:10:42.000000000 +0000 +++ chromium-browser-45.0.2454.101/content/public/android/BUILD.gn 2015-09-25 09:06:21.000000000 +0000 @@ -34,6 +34,7 @@ "//base:base_java", "//device/battery/android:battery_monitor_android", "//device/battery:mojo_bindings_java", + "//device/bluetooth:java", "//media/base/android:media_java", "//media/midi:midi_java", "//mojo/android:system_java", diff -Nru chromium-browser-45.0.2454.85/debian/changelog chromium-browser-45.0.2454.101/debian/changelog --- chromium-browser-45.0.2454.85/debian/changelog 2015-09-17 20:29:29.000000000 +0000 +++ chromium-browser-45.0.2454.101/debian/changelog 2015-09-30 15:38:41.000000000 +0000 @@ -1,23 +1,14 @@ -chromium-browser (45.0.2454.85-0ubuntu0.15.04.1.1181) vivid-security; urgency=medium +chromium-browser (45.0.2454.101-0ubuntu0.15.04.1.1183) vivid-security; urgency=medium - * Upstream release 45.0.2454.85: - - CVE-2015-1291: Cross-origin bypass in DOM. - - CVE-2015-1292: Cross-origin bypass in ServiceWorker. - - CVE-2015-1293: Cross-origin bypass in DOM. - - CVE-2015-1294: Use-after-free in Skia. - - CVE-2015-1295: Use-after-free in Printing. - - CVE-2015-1296: Character spoofing in omnibox. - - CVE-2015-1297: Permission scoping error in WebRequest. - - CVE-2015-1298: URL validation error in extensions. - - CVE-2015-1299: Use-after-free in Blink. - - CVE-2015-1300: Information leak in Blink. - - CVE-2015-1301: Various fixes from internal audits, fuzzing and other - initiatives. - * debian/patches/search-credit.patch: Don't add GET param if search URL - doesn't already use them. (LP: #1490237) - * debian/source/lintian-overrides: Ignore new binaries in orig tar. - * debian/patches/gpu_default_disabled: No longer disable GPU rendering by - default. - * debian/patches/disable-sse2: SSE exclusion is smarter now. Re-include. + * Upstream release 45.0.2454.101: + - CVE-2015-1303: Cross-origin bypass in DOM. + - CVE-2015-1304: Cross-origin bypass in V8. + * debian/tests/testdata/xx-test-tool-is-functional-if-this-prints-functional.sikuli + Only use GUI test tool to test IF it works on its own. If it is broken, + don't use that to test chromium. + * debian/rules: Include our own "xdg-settings" file until a bug is fixed. + * debian/patches/xdg-settings-multiexec-desktopfiles.patch : Locally fix + aforementioned bug. More than one Exec line in a destop file (like ours) + triggers a bug in badly-written shell code in portland xdg-utils-common.in - -- Chad MILLER Mon, 14 Sep 2015 20:11:00 -0400 + -- Chad MILLER Tue, 29 Sep 2015 08:06:37 -0400 diff -Nru chromium-browser-45.0.2454.85/debian/patches/series chromium-browser-45.0.2454.101/debian/patches/series --- chromium-browser-45.0.2454.85/debian/patches/series 2015-09-17 20:29:29.000000000 +0000 +++ chromium-browser-45.0.2454.101/debian/patches/series 2015-09-30 15:38:41.000000000 +0000 @@ -24,3 +24,4 @@ #enable_vaapi_on_linux.diff fix_building_widevinecdm_with_chromium.patch widevine-other-locations +xdg-settings-multiexec-desktopfiles.patch diff -Nru chromium-browser-45.0.2454.85/debian/patches/xdg-settings-multiexec-desktopfiles.patch chromium-browser-45.0.2454.101/debian/patches/xdg-settings-multiexec-desktopfiles.patch --- chromium-browser-45.0.2454.85/debian/patches/xdg-settings-multiexec-desktopfiles.patch 1970-01-01 00:00:00.000000000 +0000 +++ chromium-browser-45.0.2454.101/debian/patches/xdg-settings-multiexec-desktopfiles.patch 2015-09-30 15:38:41.000000000 +0000 @@ -0,0 +1,701 @@ +Description: Make xdg utils work even when there are more than one Exec line in a desktop file. +Author: Chad Miller +Bug-Upstream: https://bugs.freedesktop.org/show_bug.cgi?id=92170 + +--- a/chrome/browser/shell_integration_linux.cc ++++ b/chrome/browser/shell_integration_linux.cc +@@ -352,6 +352,7 @@ bool GetChromeVersionOfScript(const std: + + // Value returned by xdg-settings if it can't understand our request. + const int EXIT_XDG_SETTINGS_SYNTAX_ERROR = 1; ++const int EXIT_XDG_SETTINGS_FILE_NOT_EXIST = 2; + + // We delegate the difficulty of setting the default browser and default url + // scheme handler in Linux desktop environments to an xdg utility, xdg-settings. +@@ -363,6 +364,11 @@ const int EXIT_XDG_SETTINGS_SYNTAX_ERROR + // system fails, as the system copy may be missing capabilities of the Chrome + // copy. + ++// As of 2015-10 and earlier, xdg settings fails for desktop files that have ++// more than one Exec line. We catch this kind of failure and try our own ++// version of the script. ++// https://bugs.freedesktop.org/show_bug.cgi?id=92170 ++ + // If |protocol| is empty this function sets Chrome as the default browser, + // otherwise it sets Chrome as the default handler application for |protocol|. + bool SetDefaultWebClient(const std::string& protocol) { +@@ -384,7 +390,7 @@ bool SetDefaultWebClient(const std::stri + + int exit_code; + bool ran_ok = LaunchXdgUtility(argv, &exit_code); +- if (ran_ok && exit_code == EXIT_XDG_SETTINGS_SYNTAX_ERROR) { ++ if (ran_ok && ((exit_code == EXIT_XDG_SETTINGS_SYNTAX_ERROR) || (exit_code == EXIT_XDG_SETTINGS_FILE_NOT_EXIST))) { + if (GetChromeVersionOfScript(kXdgSettings, &argv[0])) { + ran_ok = LaunchXdgUtility(argv, &exit_code); + } +@@ -421,7 +427,7 @@ ShellIntegration::DefaultWebClientState + int success_code; + bool ran_ok = base::GetAppOutputWithExitCode(base::CommandLine(argv), &reply, + &success_code); +- if (ran_ok && success_code == EXIT_XDG_SETTINGS_SYNTAX_ERROR) { ++ if (ran_ok && ((success_code == EXIT_XDG_SETTINGS_SYNTAX_ERROR) || (success_code == EXIT_XDG_SETTINGS_FILE_NOT_EXIST))) { + if (GetChromeVersionOfScript(kXdgSettings, &argv[0])) { + ran_ok = base::GetAppOutputWithExitCode(base::CommandLine(argv), &reply, + &success_code); +--- a/third_party/xdg-utils/scripts/xdg-desktop-icon ++++ b/third_party/xdg-utils/scripts/xdg-desktop-icon +@@ -231,11 +231,16 @@ first_word() + + #------------------------------------------------------------- + # map a binary to a .desktop file ++# Search every desktop file in standard locations, and if one contains any ++# Exec line whose target (after resolving symlinks) is the same as the given ++# parameter file (after resolving symlinks), then print the name of that ++# desktop file. This only emits the first desktop file found. Luckily, wildcard ++# expansion is ordered, so the lexically-first filename of a match is returned. + binary_to_desktop_file() + { + search="${XDG_DATA_HOME:-$HOME/.local/share}:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}" +- binary="`which "$1"`" +- binary="`readlink -f "$binary"`" ++ binary=$(which "$1") ++ binary=$(readlink -f "$binary") + base="`basename "$binary"`" + IFS=: + for dir in $search; do +@@ -248,13 +253,17 @@ binary_to_desktop_file() + grep -q "^Exec.*$base" "$file" || continue + # Make sure it's a visible desktop file (e.g. not "preferred-web-browser.desktop"). + grep -Eq "^(NoDisplay|Hidden)=true" "$file" && continue +- command="`grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | first_word`" +- command="`which "$command"`" +- if [ x"`readlink -f "$command"`" = x"$binary" ]; then +- # Fix any double slashes that got added path composition +- echo "$file" | sed -e 's,//*,/,g' +- return +- fi ++ ++ # "TryExec" isn't good enough. Only "Exec". Test every Exec in the file. Only use one. ++ grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | \ ++ while read command argumentlist; do ++ command_full_path=$(which "$command") ++ if [ $(readlink -f "$command_full_path") = "$binary" ]; then ++ # Fix any double slashes that got added path composition ++ echo "$file" | sed -e 's,//*,/,g' ++ return # That was out answer. Nothing else to do. ++ fi ++ done + done + done + } +@@ -265,7 +274,7 @@ binary_to_desktop_file() + desktop_file_to_binary() + { + search="${XDG_DATA_HOME:-$HOME/.local/share}:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}" +- desktop="`basename "$1"`" ++ desktop=$(basename "$1") + IFS=: + for dir in $search; do + unset IFS +@@ -273,10 +282,13 @@ desktop_file_to_binary() + file="$dir/applications/$desktop" + [ -r "$file" ] || continue + # Remove any arguments (%F, %f, %U, %u, etc.). +- command="`grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | first_word`" +- command="`which "$command"`" +- readlink -f "$command" +- return ++ grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | \ ++ while read command argumentlist; do ++ # Use while-read to process one line, not all lines. ++ command_full_path=$(which "$command") ++ readlink -f "$command_full_path" ++ return # Don't continue after the first. ++ done + done + } + +--- a/third_party/xdg-utils/scripts/xdg-desktop-menu ++++ b/third_party/xdg-utils/scripts/xdg-desktop-menu +@@ -427,11 +427,16 @@ first_word() + + #------------------------------------------------------------- + # map a binary to a .desktop file ++# Search every desktop file in standard locations, and if one contains any ++# Exec line whose target (after resolving symlinks) is the same as the given ++# parameter file (after resolving symlinks), then print the name of that ++# desktop file. This only emits the first desktop file found. Luckily, wildcard ++# expansion is ordered, so the lexically-first filename of a match is returned. + binary_to_desktop_file() + { + search="${XDG_DATA_HOME:-$HOME/.local/share}:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}" +- binary="`which "$1"`" +- binary="`readlink -f "$binary"`" ++ binary=$(which "$1") ++ binary=$(readlink -f "$binary") + base="`basename "$binary"`" + IFS=: + for dir in $search; do +@@ -444,13 +449,17 @@ binary_to_desktop_file() + grep -q "^Exec.*$base" "$file" || continue + # Make sure it's a visible desktop file (e.g. not "preferred-web-browser.desktop"). + grep -Eq "^(NoDisplay|Hidden)=true" "$file" && continue +- command="`grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | first_word`" +- command="`which "$command"`" +- if [ x"`readlink -f "$command"`" = x"$binary" ]; then +- # Fix any double slashes that got added path composition +- echo "$file" | sed -e 's,//*,/,g' +- return +- fi ++ ++ # "TryExec" isn't good enough. Only "Exec". Test every Exec in the file. Only use one. ++ grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | \ ++ while read command argumentlist; do ++ command_full_path=$(which "$command") ++ if [ $(readlink -f "$command_full_path") = "$binary" ]; then ++ # Fix any double slashes that got added path composition ++ echo "$file" | sed -e 's,//*,/,g' ++ return # That was out answer. Nothing else to do. ++ fi ++ done + done + done + } +@@ -461,7 +470,7 @@ binary_to_desktop_file() + desktop_file_to_binary() + { + search="${XDG_DATA_HOME:-$HOME/.local/share}:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}" +- desktop="`basename "$1"`" ++ desktop=$(basename "$1") + IFS=: + for dir in $search; do + unset IFS +@@ -469,10 +478,13 @@ desktop_file_to_binary() + file="$dir/applications/$desktop" + [ -r "$file" ] || continue + # Remove any arguments (%F, %f, %U, %u, etc.). +- command="`grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | first_word`" +- command="`which "$command"`" +- readlink -f "$command" +- return ++ grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | \ ++ while read command argumentlist; do ++ # Use while-read to process one line, not all lines. ++ command_full_path=$(which "$command") ++ readlink -f "$command_full_path" ++ return # Don't continue after the first. ++ done + done + } + +--- a/third_party/xdg-utils/scripts/xdg-email ++++ b/third_party/xdg-utils/scripts/xdg-email +@@ -183,11 +183,16 @@ first_word() + + #------------------------------------------------------------- + # map a binary to a .desktop file ++# Search every desktop file in standard locations, and if one contains any ++# Exec line whose target (after resolving symlinks) is the same as the given ++# parameter file (after resolving symlinks), then print the name of that ++# desktop file. This only emits the first desktop file found. Luckily, wildcard ++# expansion is ordered, so the lexically-first filename of a match is returned. + binary_to_desktop_file() + { + search="${XDG_DATA_HOME:-$HOME/.local/share}:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}" +- binary="`which "$1"`" +- binary="`readlink -f "$binary"`" ++ binary=$(which "$1") ++ binary=$(readlink -f "$binary") + base="`basename "$binary"`" + IFS=: + for dir in $search; do +@@ -200,13 +205,17 @@ binary_to_desktop_file() + grep -q "^Exec.*$base" "$file" || continue + # Make sure it's a visible desktop file (e.g. not "preferred-web-browser.desktop"). + grep -Eq "^(NoDisplay|Hidden)=true" "$file" && continue +- command="`grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | first_word`" +- command="`which "$command"`" +- if [ x"`readlink -f "$command"`" = x"$binary" ]; then +- # Fix any double slashes that got added path composition +- echo "$file" | sed -e 's,//*,/,g' +- return +- fi ++ ++ # "TryExec" isn't good enough. Only "Exec". Test every Exec in the file. Only use one. ++ grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | \ ++ while read command argumentlist; do ++ command_full_path=$(which "$command") ++ if [ $(readlink -f "$command_full_path") = "$binary" ]; then ++ # Fix any double slashes that got added path composition ++ echo "$file" | sed -e 's,//*,/,g' ++ return # That was out answer. Nothing else to do. ++ fi ++ done + done + done + } +@@ -217,7 +226,7 @@ binary_to_desktop_file() + desktop_file_to_binary() + { + search="${XDG_DATA_HOME:-$HOME/.local/share}:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}" +- desktop="`basename "$1"`" ++ desktop=$(basename "$1") + IFS=: + for dir in $search; do + unset IFS +@@ -225,10 +234,13 @@ desktop_file_to_binary() + file="$dir/applications/$desktop" + [ -r "$file" ] || continue + # Remove any arguments (%F, %f, %U, %u, etc.). +- command="`grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | first_word`" +- command="`which "$command"`" +- readlink -f "$command" +- return ++ grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | \ ++ while read command argumentlist; do ++ # Use while-read to process one line, not all lines. ++ command_full_path=$(which "$command") ++ readlink -f "$command_full_path" ++ return # Don't continue after the first. ++ done + done + } + +--- a/third_party/xdg-utils/scripts/xdg-icon-resource ++++ b/third_party/xdg-utils/scripts/xdg-icon-resource +@@ -223,11 +223,16 @@ first_word() + + #------------------------------------------------------------- + # map a binary to a .desktop file ++# Search every desktop file in standard locations, and if one contains any ++# Exec line whose target (after resolving symlinks) is the same as the given ++# parameter file (after resolving symlinks), then print the name of that ++# desktop file. This only emits the first desktop file found. Luckily, wildcard ++# expansion is ordered, so the lexically-first filename of a match is returned. + binary_to_desktop_file() + { + search="${XDG_DATA_HOME:-$HOME/.local/share}:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}" +- binary="`which "$1"`" +- binary="`readlink -f "$binary"`" ++ binary=$(which "$1") ++ binary=$(readlink -f "$binary") + base="`basename "$binary"`" + IFS=: + for dir in $search; do +@@ -240,13 +245,17 @@ binary_to_desktop_file() + grep -q "^Exec.*$base" "$file" || continue + # Make sure it's a visible desktop file (e.g. not "preferred-web-browser.desktop"). + grep -Eq "^(NoDisplay|Hidden)=true" "$file" && continue +- command="`grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | first_word`" +- command="`which "$command"`" +- if [ x"`readlink -f "$command"`" = x"$binary" ]; then +- # Fix any double slashes that got added path composition +- echo "$file" | sed -e 's,//*,/,g' +- return +- fi ++ ++ # "TryExec" isn't good enough. Only "Exec". Test every Exec in the file. Only use one. ++ grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | \ ++ while read command argumentlist; do ++ command_full_path=$(which "$command") ++ if [ $(readlink -f "$command_full_path") = "$binary" ]; then ++ # Fix any double slashes that got added path composition ++ echo "$file" | sed -e 's,//*,/,g' ++ return # That was out answer. Nothing else to do. ++ fi ++ done + done + done + } +@@ -257,7 +266,7 @@ binary_to_desktop_file() + desktop_file_to_binary() + { + search="${XDG_DATA_HOME:-$HOME/.local/share}:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}" +- desktop="`basename "$1"`" ++ desktop=$(basename "$1") + IFS=: + for dir in $search; do + unset IFS +@@ -265,10 +274,13 @@ desktop_file_to_binary() + file="$dir/applications/$desktop" + [ -r "$file" ] || continue + # Remove any arguments (%F, %f, %U, %u, etc.). +- command="`grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | first_word`" +- command="`which "$command"`" +- readlink -f "$command" +- return ++ grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | \ ++ while read command argumentlist; do ++ # Use while-read to process one line, not all lines. ++ command_full_path=$(which "$command") ++ readlink -f "$command_full_path" ++ return # Don't continue after the first. ++ done + done + } + +--- a/third_party/xdg-utils/scripts/xdg-mime ++++ b/third_party/xdg-utils/scripts/xdg-mime +@@ -253,11 +253,16 @@ first_word() + + #------------------------------------------------------------- + # map a binary to a .desktop file ++# Search every desktop file in standard locations, and if one contains any ++# Exec line whose target (after resolving symlinks) is the same as the given ++# parameter file (after resolving symlinks), then print the name of that ++# desktop file. This only emits the first desktop file found. Luckily, wildcard ++# expansion is ordered, so the lexically-first filename of a match is returned. + binary_to_desktop_file() + { + search="${XDG_DATA_HOME:-$HOME/.local/share}:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}" +- binary="`which "$1"`" +- binary="`readlink -f "$binary"`" ++ binary=$(which "$1") ++ binary=$(readlink -f "$binary") + base="`basename "$binary"`" + IFS=: + for dir in $search; do +@@ -270,13 +275,17 @@ binary_to_desktop_file() + grep -q "^Exec.*$base" "$file" || continue + # Make sure it's a visible desktop file (e.g. not "preferred-web-browser.desktop"). + grep -Eq "^(NoDisplay|Hidden)=true" "$file" && continue +- command="`grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | first_word`" +- command="`which "$command"`" +- if [ x"`readlink -f "$command"`" = x"$binary" ]; then +- # Fix any double slashes that got added path composition +- echo "$file" | sed -e 's,//*,/,g' +- return +- fi ++ ++ # "TryExec" isn't good enough. Only "Exec". Test every Exec in the file. Only use one. ++ grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | \ ++ while read command argumentlist; do ++ command_full_path=$(which "$command") ++ if [ $(readlink -f "$command_full_path") = "$binary" ]; then ++ # Fix any double slashes that got added path composition ++ echo "$file" | sed -e 's,//*,/,g' ++ return # That was out answer. Nothing else to do. ++ fi ++ done + done + done + } +@@ -287,7 +296,7 @@ binary_to_desktop_file() + desktop_file_to_binary() + { + search="${XDG_DATA_HOME:-$HOME/.local/share}:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}" +- desktop="`basename "$1"`" ++ desktop=$(basename "$1") + IFS=: + for dir in $search; do + unset IFS +@@ -295,10 +304,13 @@ desktop_file_to_binary() + file="$dir/applications/$desktop" + [ -r "$file" ] || continue + # Remove any arguments (%F, %f, %U, %u, etc.). +- command="`grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | first_word`" +- command="`which "$command"`" +- readlink -f "$command" +- return ++ grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | \ ++ while read command argumentlist; do ++ # Use while-read to process one line, not all lines. ++ command_full_path=$(which "$command") ++ readlink -f "$command_full_path" ++ return # Don't continue after the first. ++ done + done + } + +--- a/third_party/xdg-utils/scripts/xdg-open ++++ b/third_party/xdg-utils/scripts/xdg-open +@@ -130,11 +130,16 @@ first_word() + + #------------------------------------------------------------- + # map a binary to a .desktop file ++# Search every desktop file in standard locations, and if one contains any ++# Exec line whose target (after resolving symlinks) is the same as the given ++# parameter file (after resolving symlinks), then print the name of that ++# desktop file. This only emits the first desktop file found. Luckily, wildcard ++# expansion is ordered, so the lexically-first filename of a match is returned. + binary_to_desktop_file() + { + search="${XDG_DATA_HOME:-$HOME/.local/share}:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}" +- binary="`which "$1"`" +- binary="`readlink -f "$binary"`" ++ binary=$(which "$1") ++ binary=$(readlink -f "$binary") + base="`basename "$binary"`" + IFS=: + for dir in $search; do +@@ -147,13 +152,17 @@ binary_to_desktop_file() + grep -q "^Exec.*$base" "$file" || continue + # Make sure it's a visible desktop file (e.g. not "preferred-web-browser.desktop"). + grep -Eq "^(NoDisplay|Hidden)=true" "$file" && continue +- command="`grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | first_word`" +- command="`which "$command"`" +- if [ x"`readlink -f "$command"`" = x"$binary" ]; then +- # Fix any double slashes that got added path composition +- echo "$file" | sed -e 's,//*,/,g' +- return +- fi ++ ++ # "TryExec" isn't good enough. Only "Exec". Test every Exec in the file. Only use one. ++ grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | \ ++ while read command argumentlist; do ++ command_full_path=$(which "$command") ++ if [ $(readlink -f "$command_full_path") = "$binary" ]; then ++ # Fix any double slashes that got added path composition ++ echo "$file" | sed -e 's,//*,/,g' ++ return # That was out answer. Nothing else to do. ++ fi ++ done + done + done + } +@@ -164,7 +173,7 @@ binary_to_desktop_file() + desktop_file_to_binary() + { + search="${XDG_DATA_HOME:-$HOME/.local/share}:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}" +- desktop="`basename "$1"`" ++ desktop=$(basename "$1") + IFS=: + for dir in $search; do + unset IFS +@@ -172,10 +181,13 @@ desktop_file_to_binary() + file="$dir/applications/$desktop" + [ -r "$file" ] || continue + # Remove any arguments (%F, %f, %U, %u, etc.). +- command="`grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | first_word`" +- command="`which "$command"`" +- readlink -f "$command" +- return ++ grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | \ ++ while read command argumentlist; do ++ # Use while-read to process one line, not all lines. ++ command_full_path=$(which "$command") ++ readlink -f "$command_full_path" ++ return # Don't continue after the first. ++ done + done + } + +--- a/third_party/xdg-utils/scripts/xdg-screensaver ++++ b/third_party/xdg-utils/scripts/xdg-screensaver +@@ -158,11 +158,16 @@ first_word() + + #------------------------------------------------------------- + # map a binary to a .desktop file ++# Search every desktop file in standard locations, and if one contains any ++# Exec line whose target (after resolving symlinks) is the same as the given ++# parameter file (after resolving symlinks), then print the name of that ++# desktop file. This only emits the first desktop file found. Luckily, wildcard ++# expansion is ordered, so the lexically-first filename of a match is returned. + binary_to_desktop_file() + { + search="${XDG_DATA_HOME:-$HOME/.local/share}:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}" +- binary="`which "$1"`" +- binary="`readlink -f "$binary"`" ++ binary=$(which "$1") ++ binary=$(readlink -f "$binary") + base="`basename "$binary"`" + IFS=: + for dir in $search; do +@@ -175,13 +180,17 @@ binary_to_desktop_file() + grep -q "^Exec.*$base" "$file" || continue + # Make sure it's a visible desktop file (e.g. not "preferred-web-browser.desktop"). + grep -Eq "^(NoDisplay|Hidden)=true" "$file" && continue +- command="`grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | first_word`" +- command="`which "$command"`" +- if [ x"`readlink -f "$command"`" = x"$binary" ]; then +- # Fix any double slashes that got added path composition +- echo "$file" | sed -e 's,//*,/,g' +- return +- fi ++ ++ # "TryExec" isn't good enough. Only "Exec". Test every Exec in the file. Only use one. ++ grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | \ ++ while read command argumentlist; do ++ command_full_path=$(which "$command") ++ if [ $(readlink -f "$command_full_path") = "$binary" ]; then ++ # Fix any double slashes that got added path composition ++ echo "$file" | sed -e 's,//*,/,g' ++ return # That was out answer. Nothing else to do. ++ fi ++ done + done + done + } +@@ -192,7 +201,7 @@ binary_to_desktop_file() + desktop_file_to_binary() + { + search="${XDG_DATA_HOME:-$HOME/.local/share}:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}" +- desktop="`basename "$1"`" ++ desktop=$(basename "$1") + IFS=: + for dir in $search; do + unset IFS +@@ -200,10 +209,13 @@ desktop_file_to_binary() + file="$dir/applications/$desktop" + [ -r "$file" ] || continue + # Remove any arguments (%F, %f, %U, %u, etc.). +- command="`grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | first_word`" +- command="`which "$command"`" +- readlink -f "$command" +- return ++ grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | \ ++ while read command argumentlist; do ++ # Use while-read to process one line, not all lines. ++ command_full_path=$(which "$command") ++ readlink -f "$command_full_path" ++ return # Don't continue after the first. ++ done + done + } + +--- a/third_party/xdg-utils/scripts/xdg-settings ++++ b/third_party/xdg-utils/scripts/xdg-settings +@@ -153,11 +153,16 @@ first_word() + + #------------------------------------------------------------- + # map a binary to a .desktop file ++# Search every desktop file in standard locations, and if one contains any ++# Exec line whose target (after resolving symlinks) is the same as the given ++# parameter file (after resolving symlinks), then print the name of that ++# desktop file. This only emits the first desktop file found. Luckily, wildcard ++# expansion is ordered, so the lexically-first filename of a match is returned. + binary_to_desktop_file() + { + search="${XDG_DATA_HOME:-$HOME/.local/share}:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}" +- binary="`which "$1"`" +- binary="`readlink -f "$binary"`" ++ binary=$(which "$1") ++ binary=$(readlink -f "$binary") + base="`basename "$binary"`" + IFS=: + for dir in $search; do +@@ -170,13 +175,17 @@ binary_to_desktop_file() + grep -q "^Exec.*$base" "$file" || continue + # Make sure it's a visible desktop file (e.g. not "preferred-web-browser.desktop"). + grep -Eq "^(NoDisplay|Hidden)=true" "$file" && continue +- command="`grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | first_word`" +- command="`which "$command"`" +- if [ x"`readlink -f "$command"`" = x"$binary" ]; then +- # Fix any double slashes that got added path composition +- echo "$file" | sed -e 's,//*,/,g' +- return +- fi ++ ++ # "TryExec" isn't good enough. Only "Exec". Test every Exec in the file. Only use one. ++ grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | \ ++ while read command argumentlist; do ++ command_full_path=$(which "$command") ++ if [ $(readlink -f "$command_full_path") = "$binary" ]; then ++ # Fix any double slashes that got added path composition ++ echo "$file" | sed -e 's,//*,/,g' ++ return # That was out answer. Nothing else to do. ++ fi ++ done + done + done + } +@@ -187,7 +196,7 @@ binary_to_desktop_file() + desktop_file_to_binary() + { + search="${XDG_DATA_HOME:-$HOME/.local/share}:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}" +- desktop="`basename "$1"`" ++ desktop=$(basename "$1") + IFS=: + for dir in $search; do + unset IFS +@@ -195,10 +204,13 @@ desktop_file_to_binary() + file="$dir/applications/$desktop" + [ -r "$file" ] || continue + # Remove any arguments (%F, %f, %U, %u, etc.). +- command="`grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | first_word`" +- command="`which "$command"`" +- readlink -f "$command" +- return ++ grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | \ ++ while read command argumentlist; do ++ # Use while-read to process one line, not all lines. ++ command_full_path=$(which "$command") ++ readlink -f "$command_full_path" ++ return # Don't continue after the first. ++ done + done + } + +--- a/third_party/xdg-utils/scripts/xdg-utils-common.in ++++ b/third_party/xdg-utils/scripts/xdg-utils-common.in +@@ -20,11 +20,16 @@ first_word() + + #------------------------------------------------------------- + # map a binary to a .desktop file ++# Search every desktop file in standard locations, and if one contains any ++# Exec line whose target (after resolving symlinks) is the same as the given ++# parameter file (after resolving symlinks), then print the name of that ++# desktop file. This only emits the first desktop file found. Luckily, wildcard ++# expansion is ordered, so the lexically-first filename of a match is returned. + binary_to_desktop_file() + { + search="${XDG_DATA_HOME:-$HOME/.local/share}:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}" +- binary="`which "$1"`" +- binary="`readlink -f "$binary"`" ++ binary=$(which "$1") ++ binary=$(readlink -f "$binary") + base="`basename "$binary"`" + IFS=: + for dir in $search; do +@@ -37,13 +42,17 @@ binary_to_desktop_file() + grep -q "^Exec.*$base" "$file" || continue + # Make sure it's a visible desktop file (e.g. not "preferred-web-browser.desktop"). + grep -Eq "^(NoDisplay|Hidden)=true" "$file" && continue +- command="`grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | first_word`" +- command="`which "$command"`" +- if [ x"`readlink -f "$command"`" = x"$binary" ]; then +- # Fix any double slashes that got added path composition +- echo "$file" | sed -e 's,//*,/,g' +- return +- fi ++ ++ # "TryExec" isn't good enough. Only "Exec". Test every Exec in the file. Only use one. ++ grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | \ ++ while read command argumentlist; do ++ command_full_path=$(which "$command") ++ if [ $(readlink -f "$command_full_path") = "$binary" ]; then ++ # Fix any double slashes that got added path composition ++ echo "$file" | sed -e 's,//*,/,g' ++ return # That was out answer. Nothing else to do. ++ fi ++ done + done + done + } +@@ -54,7 +63,7 @@ binary_to_desktop_file() + desktop_file_to_binary() + { + search="${XDG_DATA_HOME:-$HOME/.local/share}:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}" +- desktop="`basename "$1"`" ++ desktop=$(basename "$1") + IFS=: + for dir in $search; do + unset IFS +@@ -62,10 +71,13 @@ desktop_file_to_binary() + file="$dir/applications/$desktop" + [ -r "$file" ] || continue + # Remove any arguments (%F, %f, %U, %u, etc.). +- command="`grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | first_word`" +- command="`which "$command"`" +- readlink -f "$command" +- return ++ grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | \ ++ while read command argumentlist; do ++ # Use while-read to process one line, not all lines. ++ command_full_path=$(which "$command") ++ readlink -f "$command_full_path" ++ return # Don't continue after the first. ++ done + done + } + diff -Nru chromium-browser-45.0.2454.85/debian/rules chromium-browser-45.0.2454.101/debian/rules --- chromium-browser-45.0.2454.85/debian/rules 2015-09-17 20:29:29.000000000 +0000 +++ chromium-browser-45.0.2454.101/debian/rules 2015-09-30 15:38:41.000000000 +0000 @@ -295,7 +295,7 @@ local-install-arch: S_CR_PATH := apps/chromium/current local-install-arch: SNAPPY_ROOT := debian/snappy/$(S_CR_PATH) local-install-arch: PKG_DIRS := $(addprefix debian/,$(shell dh_listpackages)) -local-install-arch: TRASH := .deps gen obj.host obj.target \*.lock obj build.\* .landmines mksnapshot.ia32 protoc pyproto re2c resources xdg-mime xdg-settings yasm \*.TOC \*.stamp product_logo_\*png gen\* lib/\* lib libvpx_obj_int_extract .ninja\* chrome-wrapper \*.breakpad.\* java_mojo dump_syms +local-install-arch: TRASH := .deps gen obj.host obj.target \*.lock obj build.\* .landmines mksnapshot.ia32 protoc pyproto re2c resources xdg-mime yasm \*.TOC \*.stamp product_logo_\*png gen\* lib/\* lib libvpx_obj_int_extract .ninja\* chrome-wrapper \*.breakpad.\* java_mojo dump_syms local-install-arch: @set -eux # Two stages: Install out of source tree. Copy to packaging. @@ -315,6 +315,8 @@ cp $(SRC_DIR)/out/$(BUILD_TYPE)-chromium/lib/*.so debian/tmp/$(LIB_DIR)/libs/ endif + (cd $(SRC_DIR)/out/$(BUILD_TYPE)-chromium; tar cf - xdg-settings;) | (cd debian/tmp/$(LIB_DIR); tar xvf -;) + ifneq ($(SNAPPY_PKGR_TO_USE),) mkdir -p $(SNAPPY_ROOT)/private/libs mkdir -p $(SNAPPY_ROOT)/meta @@ -523,7 +525,8 @@ #BUILT_UNUSED_MATCH += ^usr/lib/chromium-browser/plugins/libTestNetscapePlugIn.so$$ #BUILT_UNUSED_MATCH += ^usr/lib/chromium-browser/ImageDiff$$ ## xdg-utils install dep -BUILT_UNUSED_MATCH += ^usr/lib/chromium-browser/xdg-\(mime\|settings\)$$ +#BUILT_UNUSED_MATCH += ^usr/lib/chromium-browser/xdg-settings$$ +BUILT_UNUSED_MATCH += ^usr/lib/chromium-browser/xdg-mime$$ INDEP_MATCH = ^usr/lib/chromium-browser/.\*\(?\!\${testname}-log - if egrep -v "${OKAY_ERRORS}" ${testname}-log |egrep -i "(exception|error)"; then - failures="$(basename $testname) $failures" - echo "BAD" - cat -n ${testname}-log - emit-screenshot ${testname} - else - echo "okay" - fi -done + +if sikuli $SRCDIR/debian/tests/testdata/xx-test-tool-is-functional-if-this-prints-functional.sikuli |tee /dev/stderr |grep "is functional"; then + for sikulitest in $SRCDIR/debian/tests/testdata/?-*.sikuli; do + testname=${sikulitest#$SRCDIR/testdata/} + test -d $sikulitest + echo -n "Test $(basename ${testname}): " + + sikuli $sikulitest &>${testname}-log + if egrep -v "${OKAY_ERRORS}" ${testname}-log |egrep -i "(exception|error)"; then + failures="$(basename $testname) $failures" + echo "BAD" + cat -n ${testname}-log + emit-screenshot ${testname} + else + echo "okay" + fi + done +fi webclient_pid="" Binary files /tmp/OjxaYvXOvO/chromium-browser-45.0.2454.85/debian/tests/testdata/xx-test-tool-is-functional-if-this-prints-functional.sikuli/empty box.png and /tmp/0kKZKPMPM5/chromium-browser-45.0.2454.101/debian/tests/testdata/xx-test-tool-is-functional-if-this-prints-functional.sikuli/empty box.png differ diff -Nru chromium-browser-45.0.2454.85/debian/tests/testdata/xx-test-tool-is-functional-if-this-prints-functional.sikuli/xx-test-tool-is-functional-if-this-prints-functional.py chromium-browser-45.0.2454.101/debian/tests/testdata/xx-test-tool-is-functional-if-this-prints-functional.sikuli/xx-test-tool-is-functional-if-this-prints-functional.py --- chromium-browser-45.0.2454.85/debian/tests/testdata/xx-test-tool-is-functional-if-this-prints-functional.sikuli/xx-test-tool-is-functional-if-this-prints-functional.py 1970-01-01 00:00:00.000000000 +0000 +++ chromium-browser-45.0.2454.101/debian/tests/testdata/xx-test-tool-is-functional-if-this-prints-functional.sikuli/xx-test-tool-is-functional-if-this-prints-functional.py 2015-09-30 15:38:41.000000000 +0000 @@ -0,0 +1,5 @@ +import sys + +exists("empty box.png") + +print("is functional") diff -Nru chromium-browser-45.0.2454.85/DEPS chromium-browser-45.0.2454.101/DEPS --- chromium-browser-45.0.2454.85/DEPS 2015-09-01 20:10:41.000000000 +0000 +++ chromium-browser-45.0.2454.101/DEPS 2015-09-25 09:06:18.000000000 +0000 @@ -34,9 +34,7 @@ 'swarming_revision': 'b39a448d8522392389b28f6997126a6ab04bfe87', 'v8_revision': - '7f211533faba9dd85708b1394186c7fe99b88392', - 'webkit_revision': - 'abaaf1d0b6b6483140b5dca34e80fc259833ddf7' + '7f211533faba9dd85708b1394186c7fe99b88392' } allowed_hosts = [ @@ -65,8 +63,6 @@ (Var("chromium_git")) + '/external/googlemock.git@29763965ab52f24565299976b936d1265cb6a271', 'src/testing/gtest': (Var("chromium_git")) + '/external/googletest.git@23574bf2333f834ff665f894c97bef8a5b33a0a9', - 'src/third_party/WebKit': - (Var("chromium_git")) + '/chromium/blink.git@622d13cdd4149f8751397db4a6965613f0a678a2', 'src/third_party/angle': (Var("chromium_git")) + '/angle/angle.git@6f0fd8c5457f9dcffc9fa9fab3852417311be0a9', 'src/third_party/bidichecker': @@ -120,7 +116,7 @@ 'src/third_party/opus/src': (Var("chromium_git")) + '/chromium/deps/opus.git@cae696156f1e60006e39821e79a1811ae1933c69', 'src/third_party/pdfium': - 'https://pdfium.googlesource.com/pdfium.git@f81f724838983add18125f41292e98ef94e1bb39', + 'https://pdfium.googlesource.com/pdfium.git@860a3eb0f3c18853f95df5a70dc50a95a29aafb1', 'src/third_party/py_trace_event/src': (Var("chromium_git")) + '/external/py_trace_event.git@dd463ea9e2c430de2b9e53dea57a77b4c3ac9b30', 'src/third_party/pyftpdlib/src': @@ -164,7 +160,7 @@ 'src/tools/swarming_client': (Var("chromium_git")) + '/external/swarming.client.git@b39a448d8522392389b28f6997126a6ab04bfe87', 'src/v8': - (Var("chromium_git")) + '/v8/v8.git@64f28773a488e597ef2f70864cfd296e5a3ffa3e' + (Var("chromium_git")) + '/v8/v8.git@96dddb455daff3d8626bc4e5d7b2898fbab55991' } deps_os = { @@ -388,6 +384,7 @@ 'action': [ 'python', 'src/build/util/lastchange.py', + '--git-hash-only', '-s', 'src/third_party/WebKit', '-o', diff -Nru chromium-browser-45.0.2454.85/extensions/browser/api/web_request/web_request_api.cc chromium-browser-45.0.2454.101/extensions/browser/api/web_request/web_request_api.cc --- chromium-browser-45.0.2454.85/extensions/browser/api/web_request/web_request_api.cc 2015-09-01 20:10:43.000000000 +0000 +++ chromium-browser-45.0.2454.101/extensions/browser/api/web_request/web_request_api.cc 2015-09-25 09:06:21.000000000 +0000 @@ -163,7 +163,20 @@ if (!info) return false; - return extension_info_map->process_map().Contains(info->GetChildID()); + const std::set extension_ids = + extension_info_map->process_map().GetExtensionsInProcess( + info->GetChildID()); + if (extension_ids.empty()) + return false; + + // Treat hosted apps as normal web pages (crbug.com/526413). + for (const std::string& extension_id : extension_ids) { + const Extension* extension = + extension_info_map->extensions().GetByID(extension_id); + if (extension && !extension->is_hosted_app()) + return true; + } + return false; } void ExtractRequestRoutingInfo(net::URLRequest* request, diff -Nru chromium-browser-45.0.2454.85/extensions/common/extension_messages.h chromium-browser-45.0.2454.101/extensions/common/extension_messages.h --- chromium-browser-45.0.2454.85/extensions/common/extension_messages.h 2015-09-01 20:10:43.000000000 +0000 +++ chromium-browser-45.0.2454.101/extensions/common/extension_messages.h 2015-09-25 09:06:21.000000000 +0000 @@ -180,7 +180,12 @@ // The URL of the frame that initiated the request. IPC_STRUCT_MEMBER(GURL, source_url) - // The ID of the frame that is the target of the request. + // The ID of the tab that is the target of the request, or -1 if there is no + // target tab. + IPC_STRUCT_MEMBER(int, target_tab_id) + + // The ID of the frame that is the target of the request, or -1 if there is + // no target frame (implying the message is for all frames). IPC_STRUCT_MEMBER(int, target_frame_id) // The process ID of the webview that initiated the request. diff -Nru chromium-browser-45.0.2454.85/extensions/renderer/extension_injection_host.cc chromium-browser-45.0.2454.101/extensions/renderer/extension_injection_host.cc --- chromium-browser-45.0.2454.85/extensions/renderer/extension_injection_host.cc 2015-09-01 20:10:43.000000000 +0000 +++ chromium-browser-45.0.2454.101/extensions/renderer/extension_injection_host.cc 2015-09-25 09:06:21.000000000 +0000 @@ -57,8 +57,10 @@ blink::WebSecurityOrigin top_frame_security_origin = render_frame->GetWebFrame()->top()->securityOrigin(); + // Only whitelisted extensions may run scripts on another extension's page. if (top_frame_security_origin.protocol().utf8() == kExtensionScheme && - top_frame_security_origin.host().utf8() != extension_->id()) + top_frame_security_origin.host().utf8() != extension_->id() && + !PermissionsData::CanExecuteScriptEverywhere(extension_)) return PermissionsData::ACCESS_DENIED; // Declarative user scripts use "page access" (from "permissions" section in diff -Nru chromium-browser-45.0.2454.85/extensions/renderer/messaging_bindings.cc chromium-browser-45.0.2454.101/extensions/renderer/messaging_bindings.cc --- chromium-browser-45.0.2454.85/extensions/renderer/messaging_bindings.cc 2015-09-01 20:10:43.000000000 +0000 +++ chromium-browser-45.0.2454.101/extensions/renderer/messaging_bindings.cc 2015-09-25 09:06:21.000000000 +0000 @@ -25,6 +25,7 @@ #include "extensions/common/manifest_handlers/externally_connectable.h" #include "extensions/renderer/dispatcher.h" #include "extensions/renderer/event_bindings.h" +#include "extensions/renderer/extension_frame_helper.h" #include "extensions/renderer/object_backed_native_handler.h" #include "extensions/renderer/script_context.h" #include "extensions/renderer/script_context_set.h" @@ -356,6 +357,15 @@ if (info.target_frame_id > 0 && renderframe->GetRoutingID() != info.target_frame_id) return; + + // Bandaid fix for crbug.com/520303. + // TODO(rdevlin.cronin): Fix this properly by routing messages to the correct + // RenderFrame from the browser (same with |target_frame_id| in fact). + if (info.target_tab_id != -1 && + info.target_tab_id != ExtensionFrameHelper::Get(renderframe)->tab_id()) { + return; + } + v8::Isolate* isolate = script_context->isolate(); v8::HandleScope handle_scope(isolate); diff -Nru chromium-browser-45.0.2454.85/.gitignore chromium-browser-45.0.2454.101/.gitignore --- chromium-browser-45.0.2454.85/.gitignore 2015-09-01 20:10:41.000000000 +0000 +++ chromium-browser-45.0.2454.101/.gitignore 2015-09-25 09:06:18.000000000 +0000 @@ -396,7 +396,6 @@ /third_party/webdriver/python/selenium /third_party/webgl /third_party/webgl/src -/third_party/WebKit /third_party/webpagereplay/ /third_party/webrtc /third_party/webrtc/internal @@ -444,4 +443,4 @@ /win8/delegate_execute/delegate_execute_version_resources.xml /win8/metro_driver/metro_driver_version_resources.xml /x86-generic_out/ -/xcodebuild +/xcodebuild \ No newline at end of file diff -Nru chromium-browser-45.0.2454.85/google_apis/gaia/oauth2_token_service_delegate.cc chromium-browser-45.0.2454.101/google_apis/gaia/oauth2_token_service_delegate.cc --- chromium-browser-45.0.2454.85/google_apis/gaia/oauth2_token_service_delegate.cc 2015-08-22 19:01:55.000000000 +0000 +++ chromium-browser-45.0.2454.101/google_apis/gaia/oauth2_token_service_delegate.cc 2015-09-25 09:06:21.000000000 +0000 @@ -48,8 +48,7 @@ // static bool OAuth2TokenServiceDelegate::IsError(const GoogleServiceAuthError& error) { - // TODO(rogerta): should we distinguish between transient and persistent? - return error.state() != GoogleServiceAuthError::NONE; + return error.IsPersistentError(); } void OAuth2TokenServiceDelegate::StartBatchChanges() { diff -Nru chromium-browser-45.0.2454.85/pdf/out_of_process_instance.cc chromium-browser-45.0.2454.101/pdf/out_of_process_instance.cc --- chromium-browser-45.0.2454.85/pdf/out_of_process_instance.cc 2015-09-01 20:10:43.000000000 +0000 +++ chromium-browser-45.0.2454.101/pdf/out_of_process_instance.cc 2015-09-25 09:06:22.000000000 +0000 @@ -303,23 +303,24 @@ const char* argn[], const char* argv[]) { // Check if the PDF is being loaded in the PDF chrome extension. We only allow - // the plugin to be put into "full frame" mode when it is being loaded in the - // extension because this enables some features that we don't want pages - // abusing outside of the extension. + // the plugin to be loaded in the extension and print preview to avoid + // exposing sensitive APIs directly to external websites. pp::Var document_url_var = pp::URLUtil_Dev::Get()->GetDocumentURL(this); - std::string document_url = document_url_var.is_string() ? - document_url_var.AsString() : std::string(); + if (!document_url_var.is_string()) + return false; + std::string document_url = document_url_var.AsString(); std::string extension_url = std::string(kChromeExtension); - bool in_extension = - !document_url.compare(0, extension_url.size(), extension_url); + std::string print_preview_url = std::string(kChromePrint); + if (!base::StringPiece(document_url).starts_with(kChromeExtension) && + !base::StringPiece(document_url).starts_with(kChromePrint)) { + return false; + } - if (in_extension) { - // Check if the plugin is full frame. This is passed in from JS. - for (uint32_t i = 0; i < argc; ++i) { - if (strcmp(argn[i], "full-frame") == 0) { - full_ = true; - break; - } + // Check if the plugin is full frame. This is passed in from JS. + for (uint32_t i = 0; i < argc; ++i) { + if (strcmp(argn[i], "full-frame") == 0) { + full_ = true; + break; } } diff -Nru chromium-browser-45.0.2454.85/sync/android/java/src/org/chromium/sync/signin/AccountManagerHelper.java chromium-browser-45.0.2454.101/sync/android/java/src/org/chromium/sync/signin/AccountManagerHelper.java --- chromium-browser-45.0.2454.85/sync/android/java/src/org/chromium/sync/signin/AccountManagerHelper.java 2015-09-01 20:10:43.000000000 +0000 +++ chromium-browser-45.0.2454.101/sync/android/java/src/org/chromium/sync/signin/AccountManagerHelper.java 2015-09-25 09:06:22.000000000 +0000 @@ -89,8 +89,11 @@ * Invoked on the UI thread once a token has been provided by the AccountManager. * @param token Auth token, or null if no token is available (bad credentials, * permission denied, etc). + * @param isTransientError If the token is null, then this parameter indicates + * if the error is transient or persistent. If token is non-null, this + * parameter is not used. */ - void tokenAvailable(String token); + void tokenAvailable(String token, boolean isTransientError); } /** @@ -229,8 +232,8 @@ public String getAuthTokenFromBackground(Account account, String authTokenType) { AccountManagerFuture future = mAccountManager.getAuthToken( account, authTokenType, true, null, null); - AtomicBoolean errorEncountered = new AtomicBoolean(false); - return getAuthTokenInner(future, errorEncountered); + AtomicBoolean isTransientError = new AtomicBoolean(false); + return getAuthTokenInner(future, isTransientError); } /** @@ -243,9 +246,9 @@ public void getAuthTokenFromForeground(Activity activity, Account account, String authTokenType, GetAuthTokenCallback callback) { AtomicInteger numTries = new AtomicInteger(0); - AtomicBoolean errorEncountered = new AtomicBoolean(false); + AtomicBoolean isTransientError = new AtomicBoolean(false); getAuthTokenAsynchronously(activity, account, authTokenType, callback, numTries, - errorEncountered, null); + isTransientError, null); } private class ConnectionRetry implements NetworkChangeNotifier.ConnectionTypeObserver { @@ -253,15 +256,15 @@ private final String mAuthTokenType; private final GetAuthTokenCallback mCallback; private final AtomicInteger mNumTries; - private final AtomicBoolean mErrorEncountered; + private final AtomicBoolean mIsTransientError; ConnectionRetry(Account account, String authTokenType, GetAuthTokenCallback callback, - AtomicInteger numTries, AtomicBoolean errorEncountered) { + AtomicInteger numTries, AtomicBoolean isTransientError) { mAccount = account; mAuthTokenType = authTokenType; mCallback = callback; mNumTries = numTries; - mErrorEncountered = errorEncountered; + mIsTransientError = isTransientError; } @Override @@ -274,7 +277,7 @@ if (NetworkChangeNotifier.isOnline()) { NetworkChangeNotifier.removeConnectionTypeObserver(this); getAuthTokenAsynchronously(null, mAccount, mAuthTokenType, mCallback, mNumTries, - mErrorEncountered, this); + mIsTransientError, this); } } } @@ -292,7 +295,7 @@ // Gets the auth token synchronously private String getAuthTokenInner(AccountManagerFuture future, - AtomicBoolean errorEncountered) { + AtomicBoolean isTransientError) { try { Bundle result = future.getResult(); if (result != null) { @@ -306,54 +309,54 @@ Log.w(TAG, "Auth token - authenticator exception", e); } catch (IOException e) { Log.w(TAG, "Auth token - IO exception", e); - errorEncountered.set(true); + isTransientError.set(true); } return null; } private void getAuthTokenAsynchronously(@Nullable Activity activity, final Account account, final String authTokenType, final GetAuthTokenCallback callback, - final AtomicInteger numTries, final AtomicBoolean errorEncountered, + final AtomicInteger numTries, final AtomicBoolean isTransientError, final ConnectionRetry retry) { // Return null token for no USE_CREDENTIALS permission. if (!hasUseCredentialsPermission()) { ThreadUtils.runOnUiThread(new Runnable() { @Override public void run() { - callback.tokenAvailable(null); + callback.tokenAvailable(null, false); } }); return; } final AccountManagerFuture future = mAccountManager.getAuthToken( account, authTokenType, true, null, null); - errorEncountered.set(false); + isTransientError.set(false); new AsyncTask() { @Override public String doInBackground(Void... params) { - return getAuthTokenInner(future, errorEncountered); + return getAuthTokenInner(future, isTransientError); } @Override public void onPostExecute(String authToken) { onGotAuthTokenResult(account, authTokenType, authToken, callback, numTries, - errorEncountered, retry); + isTransientError, retry); } }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } private void onGotAuthTokenResult(Account account, String authTokenType, String authToken, - GetAuthTokenCallback callback, AtomicInteger numTries, AtomicBoolean errorEncountered, + GetAuthTokenCallback callback, AtomicInteger numTries, AtomicBoolean isTransientError, ConnectionRetry retry) { - if (authToken != null || !errorEncountered.get() + if (authToken != null || !isTransientError.get() || numTries.incrementAndGet() == MAX_TRIES || !NetworkChangeNotifier.isInitialized()) { - callback.tokenAvailable(authToken); + callback.tokenAvailable(authToken, isTransientError.get()); return; } if (retry == null) { ConnectionRetry newRetry = new ConnectionRetry(account, authTokenType, callback, - numTries, errorEncountered); + numTries, isTransientError); NetworkChangeNotifier.addConnectionTypeObserver(newRetry); } else { NetworkChangeNotifier.addConnectionTypeObserver(retry); @@ -369,9 +372,9 @@ String authTokenType, GetAuthTokenCallback callback) { invalidateAuthToken(authToken); AtomicInteger numTries = new AtomicInteger(0); - AtomicBoolean errorEncountered = new AtomicBoolean(false); + AtomicBoolean isTransientError = new AtomicBoolean(false); getAuthTokenAsynchronously( - null, account, authTokenType, callback, numTries, errorEncountered, null); + null, account, authTokenType, callback, numTries, isTransientError, null); } /** diff -Nru chromium-browser-45.0.2454.85/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/external/client/contrib/MultiplexingGcmListener.java chromium-browser-45.0.2454.101/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/external/client/contrib/MultiplexingGcmListener.java --- chromium-browser-45.0.2454.85/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/external/client/contrib/MultiplexingGcmListener.java 2015-09-01 20:10:43.000000000 +0000 +++ chromium-browser-45.0.2454.101/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/external/client/contrib/MultiplexingGcmListener.java 2015-09-25 09:06:24.000000000 +0000 @@ -22,6 +22,7 @@ import com.google.ipc.invalidation.external.client.SystemResources.Logger; import com.google.ipc.invalidation.external.client.android.service.AndroidLogger; import com.google.ipc.invalidation.ticl.android2.WakeLockManager; +import com.google.ipc.invalidation.ticl.android2.channel.AndroidChannelPreferences; import android.app.IntentService; import android.content.BroadcastReceiver; @@ -328,7 +329,7 @@ public static String initializeGcm(Context context) { GCMRegistrar.checkDevice(context); GCMRegistrar.checkManifest(context); - final String regId = GCMRegistrar.getRegistrationId(context); + final String regId = AndroidChannelPreferences.getRegistrationId(context); if (regId.isEmpty()) { GCMRegistrar.register(context, readSenderIdsFromManifestOrDie(context)); } diff -Nru chromium-browser-45.0.2454.85/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/android2/channel/AndroidChannelPreferences.java chromium-browser-45.0.2454.101/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/android2/channel/AndroidChannelPreferences.java --- chromium-browser-45.0.2454.85/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/android2/channel/AndroidChannelPreferences.java 2015-09-01 20:10:43.000000000 +0000 +++ chromium-browser-45.0.2454.101/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/android2/channel/AndroidChannelPreferences.java 2015-09-25 09:06:24.000000000 +0000 @@ -35,6 +35,8 @@ */ private static final String BUFFERED_MSG_PREF = "buffered-msg"; + private static final String GCM_REGISTRATION_ID_PREF = "gcm_registration_id"; + private static final Logger logger = AndroidLogger.forTag("ChannelPrefs"); /** Sets the token echoed on subsequent HTTP requests. */ @@ -51,11 +53,24 @@ } /** Returns the echo token that should be included on HTTP requests. */ - public static String getEchoToken(Context context) { return getPreferences(context).getString(C2dmConstants.ECHO_PARAM, null); } + /** Sets the GCM registration id. */ + public static void setRegistrationId(Context context, String regId) { + SharedPreferences.Editor editor = getPreferences(context).edit(); + editor.putString(GCM_REGISTRATION_ID_PREF, regId); + if (!editor.commit()) { + logger.warning("Failed writing shared preferences for: setRegistrationId"); + } + } + + /** Returns the GCM registration id. */ + public static String getRegistrationId(Context context) { + return getPreferences(context).getString(GCM_REGISTRATION_ID_PREF, ""); + } + /** Buffers the last message sent by the Ticl. Overwrites any previously buffered message. */ static void bufferMessage(Context context, byte[] message) { SharedPreferences.Editor editor = getPreferences(context).edit(); diff -Nru chromium-browser-45.0.2454.85/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/android2/channel/AndroidMessageReceiverService.java chromium-browser-45.0.2454.101/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/android2/channel/AndroidMessageReceiverService.java --- chromium-browser-45.0.2454.85/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/android2/channel/AndroidMessageReceiverService.java 2015-08-22 19:01:57.000000000 +0000 +++ chromium-browser-45.0.2454.101/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/android2/channel/AndroidMessageReceiverService.java 2015-09-25 09:06:24.000000000 +0000 @@ -89,6 +89,14 @@ @Override protected void onRegistered(String registrationId) { + if(!AndroidChannelPreferences.getRegistrationId(this).isEmpty()) { + logger.warning("Ignoring GCM registration: %s. GCM already registered with id: %s", + registrationId, AndroidChannelPreferences.getRegistrationId(this)); + return; + } + logger.info("Setting GCM registration id: %s", registrationId); + AndroidChannelPreferences.setRegistrationId(this, registrationId); + // Inform the sender service that the registration id has changed. If the sender service // had buffered a message because no registration id was previously available, this intent // will cause it to send that message. @@ -107,6 +115,7 @@ @Override protected void onUnregistered(String registrationId) { + logger.info("Ignoring unregistration event for registrationId: %s.", registrationId); // Nothing to do. } diff -Nru chromium-browser-45.0.2454.85/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/android2/channel/AndroidMessageSenderService.java chromium-browser-45.0.2454.101/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/android2/channel/AndroidMessageSenderService.java --- chromium-browser-45.0.2454.85/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/android2/channel/AndroidMessageSenderService.java 2015-09-01 20:10:43.000000000 +0000 +++ chromium-browser-45.0.2454.101/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/android2/channel/AndroidMessageSenderService.java 2015-09-25 09:06:24.000000000 +0000 @@ -342,7 +342,7 @@ * @param authToken auth token to provide in the request header * @param isOAuth2Token whether the token is an OAuth2 token (vs. a GoogleLogin token) */ - + public static HttpURLConnection createUrlConnectionForPost( Context context, URL url, String authToken, boolean isOAuth2Token) throws IOException { HttpURLConnection connection = (HttpURLConnection) url.openConnection(); @@ -360,7 +360,7 @@ connection.setRequestProperty("Content-Type", HttpConstants.PROTO_CONTENT_TYPE); connection.setRequestProperty( "User-Agent", context.getApplicationInfo().className + "(" + Build.VERSION.RELEASE + ")"); - + String echoToken = AndroidChannelPreferences.getEchoToken(context); if (echoToken != null) { // If we have a token to echo to the server, echo it. @@ -386,15 +386,13 @@ } /** Returns the network id for this channel, or {@code null} if one cannot be determined. */ - - public static NetworkEndpointId getNetworkEndpointId(Context context, Logger logger) { String registrationId; try { - registrationId = GCMRegistrar.getRegistrationId(context); + registrationId = AndroidChannelPreferences.getRegistrationId(context); } catch (RuntimeException exception) { - // GCMRegistrar#getRegistrationId occasionally throws a runtime exception. Catching the - // exception rather than crashing. + // AndroidChannelPreferences#getRegistrationId should not throw a runtime exception. This was + // used with GCMRegistrar#getRegistrationId but we don't want to remove it now. logger.warning("Unable to get GCM registration id: %s", exception); registrationId = null; } diff -Nru chromium-browser-45.0.2454.85/third_party/pdfium/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp chromium-browser-45.0.2454.101/third_party/pdfium/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp --- chromium-browser-45.0.2454.85/third_party/pdfium/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp 2015-09-01 20:10:51.000000000 +0000 +++ chromium-browser-45.0.2454.101/third_party/pdfium/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp 2015-09-25 09:06:34.000000000 +0000 @@ -141,38 +141,41 @@ } return NULL; } + CPDF_Dictionary* CPDF_Document::GetPage(int iPage) { - if (iPage < 0 || iPage >= m_PageList.GetSize()) { - return NULL; - } + if (iPage < 0 || iPage >= m_PageList.GetSize()) + return nullptr; + if (m_bLinearized && (iPage == (int)m_dwFirstPageNo)) { CPDF_Object* pObj = GetIndirectObject(m_dwFirstPageObjNum); if (pObj && pObj->GetType() == PDFOBJ_DICTIONARY) { - return (CPDF_Dictionary*)pObj; + return static_cast(pObj); } } int objnum = m_PageList.GetAt(iPage); if (objnum) { CPDF_Object* pObj = GetIndirectObject(objnum); - ASSERT(pObj->GetType() == PDFOBJ_DICTIONARY); - return (CPDF_Dictionary*)pObj; + if (pObj && pObj->GetType() == PDFOBJ_DICTIONARY) { + return static_cast(pObj); + } } CPDF_Dictionary* pRoot = GetRoot(); - if (pRoot == NULL) { - return NULL; - } + if (!pRoot) + return nullptr; + CPDF_Dictionary* pPages = pRoot->GetDict(FX_BSTRC("Pages")); - if (pPages == NULL) { - return NULL; - } + if (!pPages) + return nullptr; + CPDF_Dictionary* pPage = _FindPDFPage(pPages, iPage, iPage, 0); - if (pPage == NULL) { - return NULL; - } + if (!pPage) + return nullptr; + m_PageList.SetAt(iPage, pPage->GetObjNum()); return pPage; } + int CPDF_Document::_FindPageIndex(CPDF_Dictionary* pNode, FX_DWORD& skip_count, FX_DWORD objnum, int& index, int level) { if (pNode->KeyExist(FX_BSTRC("Kids"))) { diff -Nru chromium-browser-45.0.2454.85/third_party/pdfium/fpdfsdk/src/fpdfformfill_embeddertest.cpp chromium-browser-45.0.2454.101/third_party/pdfium/fpdfsdk/src/fpdfformfill_embeddertest.cpp --- chromium-browser-45.0.2454.85/third_party/pdfium/fpdfsdk/src/fpdfformfill_embeddertest.cpp 2015-09-01 20:10:52.000000000 +0000 +++ chromium-browser-45.0.2454.101/third_party/pdfium/fpdfsdk/src/fpdfformfill_embeddertest.cpp 2015-09-25 09:06:34.000000000 +0000 @@ -41,3 +41,15 @@ delegate.AdvanceTime(5000); UnloadPage(page); } + +TEST_F(FPDFFormFillEmbeddertest, BUG_507316) { + EmbedderTestTimerHandlingDelegate delegate; + SetDelegate(&delegate); + + EXPECT_TRUE(OpenDocument("testing/resources/bug_507316.pdf")); + FPDF_PAGE page = LoadAndCachePage(2); + EXPECT_NE(nullptr, page); + DoOpenActions(); + delegate.AdvanceTime(4000); + UnloadPage(page); +} diff -Nru chromium-browser-45.0.2454.85/third_party/pdfium/fpdfsdk/src/fsdk_mgr.cpp chromium-browser-45.0.2454.101/third_party/pdfium/fpdfsdk/src/fsdk_mgr.cpp --- chromium-browser-45.0.2454.85/third_party/pdfium/fpdfsdk/src/fsdk_mgr.cpp 2015-09-01 20:10:52.000000000 +0000 +++ chromium-browser-45.0.2454.101/third_party/pdfium/fpdfsdk/src/fsdk_mgr.cpp 2015-09-25 09:06:34.000000000 +0000 @@ -613,28 +613,33 @@ CPDFSDK_PageView::~CPDFSDK_PageView() { - CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); - int nAnnotCount = m_fxAnnotArray.GetSize(); + // if there is a focused annot on the page, we should kill the focus first. + if (CPDFSDK_Annot* focusedAnnot = m_pSDKDoc->GetFocusAnnot()) { + for (int i = 0, count = m_fxAnnotArray.GetSize(); i < count; i++) { + CPDFSDK_Annot* pAnnot = (CPDFSDK_Annot*)m_fxAnnotArray.GetAt(i); + if (pAnnot == focusedAnnot) { + KillFocusAnnot(); + break; + } + } + } - for (int i=0; iGetFocusAnnot()) - KillFocusAnnot(); - CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandlerMgr(); - ASSERT(pAnnotHandlerMgr); - pAnnotHandlerMgr->ReleaseAnnot(pAnnot); - } - m_fxAnnotArray.RemoveAll(); + CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); + CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandlerMgr(); + ASSERT(pAnnotHandlerMgr); + for (int i = 0, count = m_fxAnnotArray.GetSize(); i < count; i++) { + CPDFSDK_Annot* pAnnot = (CPDFSDK_Annot*)m_fxAnnotArray.GetAt(i); + pAnnotHandlerMgr->ReleaseAnnot(pAnnot); + } + m_fxAnnotArray.RemoveAll(); - delete m_pAnnotList; - m_pAnnotList = NULL; + delete m_pAnnotList; + m_pAnnotList = NULL; - m_page->RemovePrivateData((void*)m_page); - if(m_bTakeOverPage) { - delete m_page; - } + m_page->RemovePrivateData((void*)m_page); + if (m_bTakeOverPage) { + delete m_page; + } } void CPDFSDK_PageView::PageView_OnDraw(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,CPDF_RenderOptions* pOptions) diff -Nru chromium-browser-45.0.2454.85/third_party/pdfium/fpdfsdk/src/javascript/PublicMethods.cpp chromium-browser-45.0.2454.101/third_party/pdfium/fpdfsdk/src/javascript/PublicMethods.cpp --- chromium-browser-45.0.2454.85/third_party/pdfium/fpdfsdk/src/javascript/PublicMethods.cpp 2015-09-01 20:10:52.000000000 +0000 +++ chromium-browser-45.0.2454.101/third_party/pdfium/fpdfsdk/src/javascript/PublicMethods.cpp 2015-09-25 09:06:34.000000000 +0000 @@ -2162,8 +2162,8 @@ dValue = (double)floor(dValue * FXSYS_pow((double)10,(double)6) + 0.49) / FXSYS_pow((double)10,(double)6); CJS_Value jsValue(isolate,dValue); - if((CJS_EventHandler*)pContext->GetEventHandler()->m_pValue) - ((CJS_EventHandler*)pContext->GetEventHandler())->Value() = jsValue.ToCFXWideString(); + if(pContext->GetEventHandler()->m_pValue) + pContext->GetEventHandler()->Value() = jsValue.ToCFXWideString(); return TRUE; } diff -Nru chromium-browser-45.0.2454.85/third_party/pdfium/fpdfsdk/src/jsapi/fxjs_v8.cpp chromium-browser-45.0.2454.101/third_party/pdfium/fpdfsdk/src/jsapi/fxjs_v8.cpp --- chromium-browser-45.0.2454.85/third_party/pdfium/fpdfsdk/src/jsapi/fxjs_v8.cpp 2015-09-01 20:10:52.000000000 +0000 +++ chromium-browser-45.0.2454.101/third_party/pdfium/fpdfsdk/src/jsapi/fxjs_v8.cpp 2015-09-25 09:06:34.000000000 +0000 @@ -635,7 +635,7 @@ { if(pArray.IsEmpty()) return v8::Local(); v8::Local val; - if (pArray->Get(pJSRuntime->GetCurrentContext(), index).ToLocal(&val)) return v8::Local(); + if (!pArray->Get(pJSRuntime->GetCurrentContext(), index).ToLocal(&val)) return v8::Local(); return val; } diff -Nru chromium-browser-45.0.2454.85/third_party/pdfium/testing/embedder_test.cpp chromium-browser-45.0.2454.101/third_party/pdfium/testing/embedder_test.cpp --- chromium-browser-45.0.2454.85/third_party/pdfium/testing/embedder_test.cpp 2015-09-01 20:10:52.000000000 +0000 +++ chromium-browser-45.0.2454.101/third_party/pdfium/testing/embedder_test.cpp 2015-09-25 09:06:34.000000000 +0000 @@ -220,6 +220,7 @@ formfillinfo->version = 1; formfillinfo->FFI_SetTimer = SetTimerTrampoline; formfillinfo->FFI_KillTimer = KillTimerTrampoline; + formfillinfo->FFI_GetPage = GetPageTrampoline; formfillinfo->m_pJsPlatform = platform; form_handle_ = FPDFDOC_InitFormFillEnvironment(document_, formfillinfo); @@ -258,6 +259,15 @@ return page; } +FPDF_PAGE EmbedderTest::LoadAndCachePage(int page_number) { + FPDF_PAGE page = delegate_->GetPage(form_handle_, document_, page_number); + if (!page) { + return nullptr; + } + FORM_DoPageAAction(page, form_handle_, FPDFPAGE_AACTION_OPEN); + return page; +} + FPDF_BITMAP EmbedderTest::RenderPage(FPDF_PAGE page) { int width = static_cast(FPDF_GetPageWidth(page)); int height = static_cast(FPDF_GetPageHeight(page)); @@ -274,6 +284,22 @@ FPDF_ClosePage(page); } +FPDF_PAGE EmbedderTest::Delegate::GetPage(FPDF_FORMHANDLE form_handle, + FPDF_DOCUMENT document, + int page_index) { + auto it = m_pageMap.find(page_index); + if (it != m_pageMap.end()) { + return it->second; + } + FPDF_PAGE page = FPDF_LoadPage(document, page_index); + if (!page) { + return nullptr; + } + m_pageMap[page_index] = page; + FORM_OnAfterLoadPage(page, form_handle); + return page; +} + // static void EmbedderTest::UnsupportedHandlerTrampoline(UNSUPPORT_INFO* info, int type) { @@ -304,6 +330,14 @@ return test->delegate_->KillTimer(id); } +// static +FPDF_PAGE EmbedderTest::GetPageTrampoline(FPDF_FORMFILLINFO* info, + FPDF_DOCUMENT document, + int page_index) { + EmbedderTest* test = static_cast(info); + return test->delegate_->GetPage(test->m_pFormfillinfo, document, page_index); +} + // Can't use gtest-provided main since we need to stash the path to the // executable in order to find the external V8 binary data files. int main(int argc, char** argv) { diff -Nru chromium-browser-45.0.2454.85/third_party/pdfium/testing/embedder_test.h chromium-browser-45.0.2454.101/third_party/pdfium/testing/embedder_test.h --- chromium-browser-45.0.2454.85/third_party/pdfium/testing/embedder_test.h 2015-09-01 20:10:52.000000000 +0000 +++ chromium-browser-45.0.2454.101/third_party/pdfium/testing/embedder_test.h 2015-09-25 09:06:34.000000000 +0000 @@ -5,6 +5,7 @@ #ifndef TESTING_EMBEDDER_TEST_H_ #define TESTING_EMBEDDER_TEST_H_ +#include #include #include "../public/fpdf_dataavail.h" @@ -41,6 +42,14 @@ // Equivalent to FPDF_FORMFILLINFO::FFI_KillTimer(). virtual void KillTimer(int id) { } + + // Equivalent to FPDF_FORMFILLINFO::FFI_GetPage(). + virtual FPDF_PAGE GetPage(FPDF_FORMHANDLE form_handle, + FPDF_DOCUMENT document, + int page_index); + + private: + std::map m_pageMap; }; EmbedderTest(); @@ -70,6 +79,10 @@ // Load a specific page of the open document. virtual FPDF_PAGE LoadPage(int page_number); + // Load a specific page of the open document using delegate_->GetPage. + // delegate_->GetPage also caches loaded page. + virtual FPDF_PAGE LoadAndCachePage(int page_number); + // Convert a loaded page into a bitmap. virtual FPDF_BITMAP RenderPage(FPDF_PAGE page); @@ -100,6 +113,9 @@ static int SetTimerTrampoline(FPDF_FORMFILLINFO* info, int msecs, TimerCallback fn); static void KillTimerTrampoline(FPDF_FORMFILLINFO* info, int id); + static FPDF_PAGE GetPageTrampoline(FPDF_FORMFILLINFO* info, + FPDF_DOCUMENT document, + int page_index); }; #endif // TESTING_EMBEDDER_TEST_H_ diff -Nru chromium-browser-45.0.2454.85/third_party/pdfium/testing/resources/bug_507316.in chromium-browser-45.0.2454.101/third_party/pdfium/testing/resources/bug_507316.in --- chromium-browser-45.0.2454.85/third_party/pdfium/testing/resources/bug_507316.in 1970-01-01 00:00:00.000000000 +0000 +++ chromium-browser-45.0.2454.101/third_party/pdfium/testing/resources/bug_507316.in 2015-09-16 21:47:09.000000000 +0000 @@ -0,0 +1,126 @@ +{{header}} +{{object 1 0}} << + /Type /Catalog + /Pages 2 0 R + /OpenAction 4 0 R + /AcroForm 3 0 R +>> +endobj +{{object 2 0}} << + /Type /Pages + /Count 3 + /Kids [6 0 R 7 0 R 8 0 R ] +>> +endobj +{{object 3 0}} << + /CO [11 0 R] + /Fields [11 0 R 9 0 R] +>> +endobj +{{object 4 0}} << + /Type /Action + /S /JavaScript + /JS 5 0 R +>> +endobj +{{object 5 0}} <<>> +stream +var i = 0; +function run() +{ + t = this.getField('txtName1'); + t2 = this.getField('txtName2'); + t2.setFocus(); + t.setFocus(); + t.value='G'; +} + +function remove(){ + if (i==1){ + this.removeField('txtName2'); + } + i++; +} + +app.setTimeOut('run()',2000); +endstream +endobj +{{object 6 0}} << + /Type /Page + /Parent 2 0 R + /MediaBox [0 0 612 792] + /Resources <<>> +>> +endobj +{{object 7 0}} << + /Type /Page + /Parent 2 0 R + /MediaBox [0 0 612 792] + /Resources <<>> +>> +endobj +{{object 8 0}} << + /Type /Page + /Parent 2 0 R + /MediaBox [0 0 612 792] + /Resources <<>> + /Annots [9 0 R 11 0 R] +>> +endobj +{{object 9 0}} << + /FT /Tx + /Type /Annot + /Subtype /Widget + /T (txtName2) + /F 4 + /AP <> + /Rect [20 20 400 60] +>> +endobj +{{object 10 0}} << + /Type /XObject + /Subtype /Form + /FormType 1 +>> +endobj +{{object 11 0}} << + /FT /Tx + /Type /Annot + /Subtype /Widget + /T (txtName1) + /F 4 + /AP <> + /Rect [200 200 400 260] + /AA 13 0 R +>> +endobj +{{object 12 0}} << + /Type /XObject + /Subtype /Form + /FormType 1 +>> +endobj +{{object 13 0}} << + /C 14 0 R +>> +endobj +{{object 14 0}} << + /Type /Action + /S /JavaScript + /JS 15 0 R +>> +endobj +{{object 15 0}} <<>> +stream +this.getField('txtName2').value='B'; +this.pageNum=1; +remove(); +endstream +endobj +{{xref}} +trailer << + /Size 15 + /Root 1 0 R +>> +{{startxref}} +%%EOF diff -Nru chromium-browser-45.0.2454.85/third_party/pdfium/testing/resources/bug_507316.pdf chromium-browser-45.0.2454.101/third_party/pdfium/testing/resources/bug_507316.pdf --- chromium-browser-45.0.2454.85/third_party/pdfium/testing/resources/bug_507316.pdf 1970-01-01 00:00:00.000000000 +0000 +++ chromium-browser-45.0.2454.101/third_party/pdfium/testing/resources/bug_507316.pdf 2015-09-16 21:47:09.000000000 +0000 @@ -0,0 +1,145 @@ +%PDF-1.7 +% ò¤ô +1 0 obj << + /Type /Catalog + /Pages 2 0 R + /OpenAction 4 0 R + /AcroForm 3 0 R +>> +endobj +2 0 obj << + /Type /Pages + /Count 3 + /Kids [6 0 R 7 0 R 8 0 R ] +>> +endobj +3 0 obj << + /CO [11 0 R] + /Fields [11 0 R 9 0 R] +>> +endobj +4 0 obj << + /Type /Action + /S /JavaScript + /JS 5 0 R +>> +endobj +5 0 obj <<>> +stream +var i = 0; +function run() +{ + t = this.getField('txtName1'); + t2 = this.getField('txtName2'); + t2.setFocus(); + t.setFocus(); + t.value='G'; +} + +function remove(){ + if (i==1){ + this.removeField('txtName2'); + } + i++; +} + +app.setTimeOut('run()',2000); +endstream +endobj +6 0 obj << + /Type /Page + /Parent 2 0 R + /MediaBox [0 0 612 792] + /Resources <<>> +>> +endobj +7 0 obj << + /Type /Page + /Parent 2 0 R + /MediaBox [0 0 612 792] + /Resources <<>> +>> +endobj +8 0 obj << + /Type /Page + /Parent 2 0 R + /MediaBox [0 0 612 792] + /Resources <<>> + /Annots [9 0 R 11 0 R] +>> +endobj +9 0 obj << + /FT /Tx + /Type /Annot + /Subtype /Widget + /T (txtName2) + /F 4 + /AP <> + /Rect [20 20 400 60] +>> +endobj +10 0 obj << + /Type /XObject + /Subtype /Form + /FormType 1 +>> +endobj +11 0 obj << + /FT /Tx + /Type /Annot + /Subtype /Widget + /T (txtName1) + /F 4 + /AP <> + /Rect [200 200 400 260] + /AA 13 0 R +>> +endobj +12 0 obj << + /Type /XObject + /Subtype /Form + /FormType 1 +>> +endobj +13 0 obj << + /C 14 0 R +>> +endobj +14 0 obj << + /Type /Action + /S /JavaScript + /JS 15 0 R +>> +endobj +15 0 obj <<>> +stream +this.getField('txtName2').value='B'; +this.pageNum=1; +remove(); +endstream +endobj +xref +0 16 +0000000000 65535 f +0000000015 00000 n +0000000106 00000 n +0000000182 00000 n +0000000243 00000 n +0000000309 00000 n +0000000602 00000 n +0000000697 00000 n +0000000792 00000 n +0000000912 00000 n +0000001043 00000 n +0000001113 00000 n +0000001261 00000 n +0000001331 00000 n +0000001365 00000 n +0000001433 00000 n +trailer << + /Size 15 + /Root 1 0 R +>> +startxref +1534 +%%EOF diff -Nru chromium-browser-45.0.2454.85/third_party/pdfium/third_party/libopenjpeg20/dwt.c chromium-browser-45.0.2454.101/third_party/pdfium/third_party/libopenjpeg20/dwt.c --- chromium-browser-45.0.2454.85/third_party/pdfium/third_party/libopenjpeg20/dwt.c 2015-09-01 20:10:52.000000000 +0000 +++ chromium-browser-45.0.2454.101/third_party/pdfium/third_party/libopenjpeg20/dwt.c 2015-09-02 22:27:13.000000000 +0000 @@ -46,14 +46,12 @@ /** @defgroup DWT DWT - Implementation of a discrete wavelet transform */ /*@{*/ -#define OPJ_WS(i) v->mem[(i)*2] -#define OPJ_WD(i) v->mem[(1+(i)*2)] - /** @name Local data structures */ /*@{*/ typedef struct dwt_local { OPJ_INT32* mem; + OPJ_SIZE_T mem_count; OPJ_INT32 dn; OPJ_INT32 sn; OPJ_INT32 cas; @@ -107,16 +105,16 @@ /** Forward 5-3 wavelet transform in 1-D */ -static void opj_dwt_encode_1(OPJ_INT32 *a, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 cas); +static void opj_dwt_encode_1(OPJ_INT32 *a, OPJ_SIZE_T a_count, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 cas); /** Inverse 5-3 wavelet transform in 1-D */ static void opj_dwt_decode_1(opj_dwt_t *v); -static void opj_dwt_decode_1_(OPJ_INT32 *a, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 cas); +static void opj_dwt_decode_1_(OPJ_INT32 *a, OPJ_SIZE_T a_count, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 cas); /** Forward 9-7 wavelet transform in 1-D */ -static void opj_dwt_encode_1_real(OPJ_INT32 *a, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 cas); +static void opj_dwt_encode_1_real(OPJ_INT32 *a, OPJ_SIZE_T a_count, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 cas); /** Explicit calculation of the Quantization Stepsizes */ @@ -124,10 +122,10 @@ /** Inverse wavelet transform in 2-D. */ -static OPJ_BOOL opj_dwt_decode_tile(opj_tcd_tilecomp_t* tilec, OPJ_UINT32 i, DWT1DFN fn); +static OPJ_BOOL opj_dwt_decode_tile(const opj_tcd_tilecomp_t* tilec, OPJ_UINT32 i, DWT1DFN fn); -static OPJ_BOOL opj_dwt_encode_procedure( opj_tcd_tilecomp_t * tilec, - void (*p_function)(OPJ_INT32 *, OPJ_INT32,OPJ_INT32,OPJ_INT32) ); +static OPJ_BOOL opj_dwt_encode_procedure(const opj_tcd_tilecomp_t * tilec, + void (*p_function)(OPJ_INT32 *, OPJ_SIZE_T,OPJ_INT32,OPJ_INT32,OPJ_INT32) ); static OPJ_UINT32 opj_dwt_max_resolution(opj_tcd_resolution_t* restrict r, OPJ_UINT32 i); @@ -156,13 +154,20 @@ /*@}*/ -#define OPJ_S(i) a[(i)*2] -#define OPJ_D(i) a[(1+(i)*2)] -#define OPJ_S_(i) ((i)<0?OPJ_S(0):((i)>=sn?OPJ_S(sn-1):OPJ_S(i))) -#define OPJ_D_(i) ((i)<0?OPJ_D(0):((i)>=dn?OPJ_D(dn-1):OPJ_D(i))) +#define IDX_S(i) (i)*2 +#define IDX_D(i) 1+(i)*2 +#define UNDERFLOW_SN(i) ((i)>=sn&&sn>0) +#define UNDERFLOW_DN(i) ((i)>=dn&&dn>0) +#define OVERFLOW_S(i) (IDX_S(i)>=a_count) +#define OVERFLOW_D(i) (IDX_D(i)>=a_count) + +#define OPJ_S(i) a[IDX_S(i)] +#define OPJ_D(i) a[IDX_D(i)] +#define OPJ_S_(i) ((i)<0?OPJ_S(0):(UNDERFLOW_SN(i)?OPJ_S(sn-1):OVERFLOW_S(i)?OPJ_S(i-1):OPJ_S(i))) +#define OPJ_D_(i) ((i)<0?OPJ_D(0):(UNDERFLOW_DN(i)?OPJ_D(dn-1):OVERFLOW_D(i)?OPJ_D(i-1):OPJ_D(i))) /* new */ -#define OPJ_SS_(i) ((i)<0?OPJ_S(0):((i)>=dn?OPJ_S(dn-1):OPJ_S(i))) -#define OPJ_DD_(i) ((i)<0?OPJ_D(0):((i)>=sn?OPJ_D(sn-1):OPJ_D(i))) +#define OPJ_SS_(i) ((i)<0?OPJ_S(0):(UNDERFLOW_DN(i)?OPJ_S(dn-1):OVERFLOW_S(i)?OPJ_S(i-1):OPJ_S(i))) +#define OPJ_DD_(i) ((i)<0?OPJ_D(0):(UNDERFLOW_SN(i)?OPJ_D(sn-1):OVERFLOW_D(i)?OPJ_D(i-1):OPJ_D(i))) /* */ /* This table contains the norms of the 5-3 wavelets for different bands. */ @@ -283,7 +288,7 @@ /* */ /* Forward 5-3 wavelet transform in 1-D. */ /* */ -void opj_dwt_encode_1(OPJ_INT32 *a, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 cas) { +void opj_dwt_encode_1(OPJ_INT32 *a, OPJ_SIZE_T a_count, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 cas) { OPJ_INT32 i; if (!cas) { @@ -304,7 +309,7 @@ /* */ /* Inverse 5-3 wavelet transform in 1-D. */ /* */ -void opj_dwt_decode_1_(OPJ_INT32 *a, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 cas) { +void opj_dwt_decode_1_(OPJ_INT32 *a, OPJ_SIZE_T a_count, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 cas) { OPJ_INT32 i; if (!cas) { @@ -326,13 +331,13 @@ /* Inverse 5-3 wavelet transform in 1-D. */ /* */ void opj_dwt_decode_1(opj_dwt_t *v) { - opj_dwt_decode_1_(v->mem, v->dn, v->sn, v->cas); + opj_dwt_decode_1_(v->mem, v->mem_count, v->dn, v->sn, v->cas); } /* */ /* Forward 9-7 wavelet transform in 1-D. */ /* */ -void opj_dwt_encode_1_real(OPJ_INT32 *a, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 cas) { +void opj_dwt_encode_1_real(OPJ_INT32 *a, OPJ_SIZE_T a_count, OPJ_INT32 dn, OPJ_INT32 sn, OPJ_INT32 cas) { OPJ_INT32 i; if (!cas) { if ((dn > 0) || (sn > 1)) { /* NEW : CASE ONE ELEMENT */ @@ -385,7 +390,7 @@ /* */ /* Forward 5-3 wavelet transform in 2-D. */ /* */ -INLINE OPJ_BOOL opj_dwt_encode_procedure(opj_tcd_tilecomp_t * tilec,void (*p_function)(OPJ_INT32 *, OPJ_INT32,OPJ_INT32,OPJ_INT32) ) +INLINE OPJ_BOOL opj_dwt_encode_procedure(const opj_tcd_tilecomp_t * tilec,void (*p_function)(OPJ_INT32 *, OPJ_SIZE_T,OPJ_INT32,OPJ_INT32,OPJ_INT32) ) { OPJ_INT32 i, j, k; OPJ_INT32 *a = 00; @@ -395,7 +400,8 @@ OPJ_INT32 rw; /* width of the resolution level computed */ OPJ_INT32 rh; /* height of the resolution level computed */ - OPJ_UINT32 l_data_size; + OPJ_SIZE_T l_data_count; + OPJ_SIZE_T l_data_size; opj_tcd_resolution_t * l_cur_res = 0; opj_tcd_resolution_t * l_last_res = 0; @@ -407,8 +413,9 @@ l_cur_res = tilec->resolutions + l; l_last_res = l_cur_res - 1; - l_data_size = opj_dwt_max_resolution( tilec->resolutions,tilec->numresolutions) * (OPJ_UINT32)sizeof(OPJ_INT32); - bj = (OPJ_INT32*)opj_malloc((size_t)l_data_size); + l_data_count = opj_dwt_max_resolution( tilec->resolutions,tilec->numresolutions); + l_data_size = l_data_count * (OPJ_UINT32)sizeof(OPJ_INT32); + bj = (OPJ_INT32*)opj_malloc(l_data_size); if (! bj) { return OPJ_FALSE; } @@ -437,7 +444,7 @@ bj[k] = aj[k*w]; } - (*p_function) (bj, dn, sn, cas_col); + (*p_function) (bj, l_data_count, dn, sn, cas_col); opj_dwt_deinterleave_v(bj, aj, dn, sn, w, cas_col); } @@ -448,7 +455,7 @@ for (j = 0; j < rh; j++) { aj = a + j * w; for (k = 0; k < rw; k++) bj[k] = aj[k]; - (*p_function) (bj, dn, sn, cas_row); + (*p_function) (bj, l_data_count, dn, sn, cas_row); opj_dwt_deinterleave_h(bj, aj, dn, sn, cas_row); } @@ -557,7 +564,7 @@ /* */ /* Inverse wavelet transform in 2-D. */ /* */ -OPJ_BOOL opj_dwt_decode_tile(opj_tcd_tilecomp_t* tilec, OPJ_UINT32 numres, DWT1DFN dwt_1D) { +OPJ_BOOL opj_dwt_decode_tile(const opj_tcd_tilecomp_t* tilec, OPJ_UINT32 numres, DWT1DFN dwt_1D) { opj_dwt_t h; opj_dwt_t v; @@ -568,13 +575,14 @@ OPJ_UINT32 w = (OPJ_UINT32)(tilec->x1 - tilec->x0); - h.mem = (OPJ_INT32*) - opj_aligned_malloc(opj_dwt_max_resolution(tr, numres) * sizeof(OPJ_INT32)); + h.mem_count = opj_dwt_max_resolution(tr, numres); + h.mem = (OPJ_INT32*)opj_aligned_malloc(h.mem_count * sizeof(OPJ_INT32)); if (! h.mem){ /* FIXME event manager error callback */ return OPJ_FALSE; } + v.mem_count = h.mem_count; v.mem = h.mem; while( --numres) { diff -Nru chromium-browser-45.0.2454.85/third_party/WebKit/LayoutTests/http/tests/security/cross-frame-access-parent-explicit-domain-isolated-world-expected.txt chromium-browser-45.0.2454.101/third_party/WebKit/LayoutTests/http/tests/security/cross-frame-access-parent-explicit-domain-isolated-world-expected.txt --- chromium-browser-45.0.2454.85/third_party/WebKit/LayoutTests/http/tests/security/cross-frame-access-parent-explicit-domain-isolated-world-expected.txt 1970-01-01 00:00:00.000000000 +0000 +++ chromium-browser-45.0.2454.101/third_party/WebKit/LayoutTests/http/tests/security/cross-frame-access-parent-explicit-domain-isolated-world-expected.txt 2015-09-24 20:22:50.000000000 +0000 @@ -0,0 +1,11 @@ +Tests that isolated worlds do not allow cross-origin frame access + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +PASS Parent document access from isolated world is not allowed. +PASS successfullyParsed is true + +TEST COMPLETE + + diff -Nru chromium-browser-45.0.2454.85/third_party/WebKit/LayoutTests/http/tests/security/cross-frame-access-parent-explicit-domain-isolated-world.html chromium-browser-45.0.2454.101/third_party/WebKit/LayoutTests/http/tests/security/cross-frame-access-parent-explicit-domain-isolated-world.html --- chromium-browser-45.0.2454.85/third_party/WebKit/LayoutTests/http/tests/security/cross-frame-access-parent-explicit-domain-isolated-world.html 1970-01-01 00:00:00.000000000 +0000 +++ chromium-browser-45.0.2454.101/third_party/WebKit/LayoutTests/http/tests/security/cross-frame-access-parent-explicit-domain-isolated-world.html 2015-09-24 20:22:50.000000000 +0000 @@ -0,0 +1,39 @@ + + + + +

+

+ + + + diff -Nru chromium-browser-45.0.2454.85/third_party/WebKit/LayoutTests/http/tests/security/cross-frame-access-parent-isolated-world-expected.txt chromium-browser-45.0.2454.101/third_party/WebKit/LayoutTests/http/tests/security/cross-frame-access-parent-isolated-world-expected.txt --- chromium-browser-45.0.2454.85/third_party/WebKit/LayoutTests/http/tests/security/cross-frame-access-parent-isolated-world-expected.txt 1970-01-01 00:00:00.000000000 +0000 +++ chromium-browser-45.0.2454.101/third_party/WebKit/LayoutTests/http/tests/security/cross-frame-access-parent-isolated-world-expected.txt 2015-09-24 20:22:50.000000000 +0000 @@ -0,0 +1,11 @@ +Tests that isolated worlds do not allow cross-origin frame access + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +PASS Parent document access from isolated world is not allowed. +PASS successfullyParsed is true + +TEST COMPLETE + + diff -Nru chromium-browser-45.0.2454.85/third_party/WebKit/LayoutTests/http/tests/security/cross-frame-access-parent-isolated-world.html chromium-browser-45.0.2454.101/third_party/WebKit/LayoutTests/http/tests/security/cross-frame-access-parent-isolated-world.html --- chromium-browser-45.0.2454.85/third_party/WebKit/LayoutTests/http/tests/security/cross-frame-access-parent-isolated-world.html 1970-01-01 00:00:00.000000000 +0000 +++ chromium-browser-45.0.2454.101/third_party/WebKit/LayoutTests/http/tests/security/cross-frame-access-parent-isolated-world.html 2015-09-24 20:22:50.000000000 +0000 @@ -0,0 +1,34 @@ + + + + +

+

+ + + + diff -Nru chromium-browser-45.0.2454.85/third_party/WebKit/LayoutTests/http/tests/security/resources/cross-frame-iframe-for-parent-isolated-world.html chromium-browser-45.0.2454.101/third_party/WebKit/LayoutTests/http/tests/security/resources/cross-frame-iframe-for-parent-isolated-world.html --- chromium-browser-45.0.2454.85/third_party/WebKit/LayoutTests/http/tests/security/resources/cross-frame-iframe-for-parent-isolated-world.html 1970-01-01 00:00:00.000000000 +0000 +++ chromium-browser-45.0.2454.101/third_party/WebKit/LayoutTests/http/tests/security/resources/cross-frame-iframe-for-parent-isolated-world.html 2015-09-24 20:22:51.000000000 +0000 @@ -0,0 +1,33 @@ + + + + + + Binary files /tmp/OjxaYvXOvO/chromium-browser-45.0.2454.85/third_party/WebKit/LayoutTests/platform/mac/css3/blending/mix-blend-mode-isolated-group-1-expected.png and /tmp/0kKZKPMPM5/chromium-browser-45.0.2454.101/third_party/WebKit/LayoutTests/platform/mac/css3/blending/mix-blend-mode-isolated-group-1-expected.png differ Binary files /tmp/OjxaYvXOvO/chromium-browser-45.0.2454.85/third_party/WebKit/LayoutTests/platform/mac/css3/blending/mix-blend-mode-isolated-group-2-expected.png and /tmp/0kKZKPMPM5/chromium-browser-45.0.2454.101/third_party/WebKit/LayoutTests/platform/mac/css3/blending/mix-blend-mode-isolated-group-2-expected.png differ Binary files /tmp/OjxaYvXOvO/chromium-browser-45.0.2454.85/third_party/WebKit/LayoutTests/platform/mac/css3/blending/mix-blend-mode-isolated-group-3-expected.png and /tmp/0kKZKPMPM5/chromium-browser-45.0.2454.101/third_party/WebKit/LayoutTests/platform/mac/css3/blending/mix-blend-mode-isolated-group-3-expected.png differ Binary files /tmp/OjxaYvXOvO/chromium-browser-45.0.2454.85/third_party/WebKit/LayoutTests/platform/win/css3/blending/mix-blend-mode-isolated-group-1-expected.png and /tmp/0kKZKPMPM5/chromium-browser-45.0.2454.101/third_party/WebKit/LayoutTests/platform/win/css3/blending/mix-blend-mode-isolated-group-1-expected.png differ Binary files /tmp/OjxaYvXOvO/chromium-browser-45.0.2454.85/third_party/WebKit/LayoutTests/platform/win/css3/blending/mix-blend-mode-isolated-group-2-expected.png and /tmp/0kKZKPMPM5/chromium-browser-45.0.2454.101/third_party/WebKit/LayoutTests/platform/win/css3/blending/mix-blend-mode-isolated-group-2-expected.png differ Binary files /tmp/OjxaYvXOvO/chromium-browser-45.0.2454.85/third_party/WebKit/LayoutTests/platform/win/css3/blending/mix-blend-mode-isolated-group-3-expected.png and /tmp/0kKZKPMPM5/chromium-browser-45.0.2454.101/third_party/WebKit/LayoutTests/platform/win/css3/blending/mix-blend-mode-isolated-group-3-expected.png differ diff -Nru chromium-browser-45.0.2454.85/third_party/WebKit/public/web/WebSecurityPolicy.h chromium-browser-45.0.2454.101/third_party/WebKit/public/web/WebSecurityPolicy.h --- chromium-browser-45.0.2454.85/third_party/WebKit/public/web/WebSecurityPolicy.h 2015-09-01 20:10:53.000000000 +0000 +++ chromium-browser-45.0.2454.101/third_party/WebKit/public/web/WebSecurityPolicy.h 2015-09-25 09:06:24.000000000 +0000 @@ -79,6 +79,9 @@ // Registers a URL scheme whose resources can be loaded regardless of a page's Content Security Policy. BLINK_EXPORT static void registerURLSchemeAsBypassingContentSecurityPolicy(const WebString&); + // Registers a URL scheme which will always be considered the first-party when loaded in a top-level context. + BLINK_EXPORT static void registerURLSchemeAsFirstPartyWhenTopLevel(const WebString&); + // Registers a URL scheme for which some kinds of resources bypass Content Security Policy. // This enum should be kept in sync with Source/platform/weborigin/SchemeRegistry.h. // Enforced in AssertMatchingEnums.cpp. diff -Nru chromium-browser-45.0.2454.85/third_party/WebKit/Source/bindings/core/v8/ScriptController.cpp chromium-browser-45.0.2454.101/third_party/WebKit/Source/bindings/core/v8/ScriptController.cpp --- chromium-browser-45.0.2454.85/third_party/WebKit/Source/bindings/core/v8/ScriptController.cpp 2015-09-01 20:10:52.000000000 +0000 +++ chromium-browser-45.0.2454.101/third_party/WebKit/Source/bindings/core/v8/ScriptController.cpp 2015-09-25 09:06:24.000000000 +0000 @@ -139,6 +139,10 @@ void ScriptController::updateSecurityOrigin(SecurityOrigin* origin) { m_windowProxyManager->mainWorldProxy()->updateSecurityOrigin(origin); + Vector> isolatedContexts; + m_windowProxyManager->collectIsolatedContexts(isolatedContexts); + for (auto isolatedContext : isolatedContexts) + m_windowProxyManager->windowProxy(isolatedContext.first->world())->updateSecurityOrigin(isolatedContext.second); } v8::MaybeLocal ScriptController::callFunction(v8::Local function, v8::Local receiver, int argc, v8::Local info[]) diff -Nru chromium-browser-45.0.2454.85/third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.cpp chromium-browser-45.0.2454.101/third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.cpp --- chromium-browser-45.0.2454.85/third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.cpp 2015-08-22 19:03:02.000000000 +0000 +++ chromium-browser-45.0.2454.101/third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.cpp 2015-09-25 09:06:24.000000000 +0000 @@ -169,6 +169,7 @@ , m_queueLeadPosition(0) , m_queueTailPosition(0) , m_bookmarkPosition(0) + , m_lengthOfBOM(0) { } @@ -201,7 +202,7 @@ { ASSERT(!isMainThread()); m_bookmarkPosition = m_queueLeadPosition; - return m_bookmarkPosition != 0; // Don't mess with BOM. + return true; } // Called by V8 on background thread. @@ -211,7 +212,9 @@ { MutexLocker locker(m_mutex); m_queueLeadPosition = m_bookmarkPosition; - m_queueTailPosition = m_bookmarkPosition; + // See comments at m_lengthOfBOM declaration below for why + // we need this here. + m_queueTailPosition = m_bookmarkPosition + m_lengthOfBOM; m_dataQueue.clear(); } @@ -308,6 +311,11 @@ } } + if (lengthOfBOM > 0) { + ASSERT(!m_lengthOfBOM); // There should be only one BOM. + m_lengthOfBOM = lengthOfBOM; + } + // Copy the data chunks into a new buffer, since we're going to give the // data to a background thread. if (dataLength > lengthOfBOM) { @@ -346,6 +354,22 @@ unsigned m_queueLeadPosition; // Only used by v8 thread. unsigned m_queueTailPosition; // Used by both threads; guarded by m_mutex. unsigned m_bookmarkPosition; // Only used by v8 thread. + + // BOM (Unicode Byte Order Mark) handling: + // This class is responsible for stripping out the BOM, since Chrome + // delivers the input stream potentially with BOM, but V8 doesn't want + // to see the BOM. This is mostly easy to do, except for a funky edge + // condition with bookmarking: + // - m_queueLeadPosition counts the bytes that V8 has received + // (i.e., without BOM) + // - m_queueTailPosition counts the bytes that Chrome has sent + // (i.e., with BOM) + // So when resetting the bookmark, we have to adjust the lead position + // to account for the BOM (which happens implicitly in the regular + // streaming case). + // We store this separately, to avoid having to guard all + // m_queueLeadPosition references with a mutex. + unsigned m_lengthOfBOM; // Used by both threads; guarded by m_mutex. }; size_t ScriptStreamer::kSmallScriptThreshold = 30 * 1024; diff -Nru chromium-browser-45.0.2454.85/third_party/WebKit/Source/bindings/core/v8/V8DOMWrapper.cpp chromium-browser-45.0.2454.101/third_party/WebKit/Source/bindings/core/v8/V8DOMWrapper.cpp --- chromium-browser-45.0.2454.85/third_party/WebKit/Source/bindings/core/v8/V8DOMWrapper.cpp 2015-08-22 19:03:02.000000000 +0000 +++ chromium-browser-45.0.2454.101/third_party/WebKit/Source/bindings/core/v8/V8DOMWrapper.cpp 2015-09-24 20:23:03.000000000 +0000 @@ -34,6 +34,7 @@ #include "bindings/core/v8/V8Binding.h" #include "bindings/core/v8/V8HTMLCollection.h" #include "bindings/core/v8/V8HTMLDocument.h" +#include "bindings/core/v8/V8Location.h" #include "bindings/core/v8/V8ObjectConstructor.h" #include "bindings/core/v8/V8PerContextData.h" #include "bindings/core/v8/V8PerIsolateData.h" @@ -72,7 +73,12 @@ v8::Local V8DOMWrapper::createWrapper(v8::Isolate* isolate, v8::Local creationContext, const WrapperTypeInfo* type, ScriptWrappable* scriptWrappable) { - V8WrapperInstantiationScope scope(creationContext, isolate); + ASSERT(!type->equals(&V8Window::wrapperTypeInfo)); + // According to https://html.spec.whatwg.org/multipage/browsers.html#security-location, + // cross-origin script access to a few properties of Location is allowed. + // Location already implements the necessary security checks. + bool withSecurityCheck = !type->equals(&V8Location::wrapperTypeInfo); + V8WrapperInstantiationScope scope(creationContext, isolate, withSecurityCheck); V8PerContextData* perContextData = V8PerContextData::from(scope.context()); v8::Local wrapper; @@ -124,4 +130,31 @@ && untrustedWrapperTypeInfo->ginEmbedder == gin::kEmbedderBlink; } +void V8WrapperInstantiationScope::securityCheck(v8::Isolate* isolate, v8::Local contextForWrapper) +{ + if (m_context.IsEmpty()) + return; + // If the context is different, we need to make sure that the current + // context has access to the creation context. + Frame* frame = toFrameIfNotDetached(contextForWrapper); + if (!frame) + return; + const DOMWrapperWorld& currentWorld = DOMWrapperWorld::world(m_context); + RELEASE_ASSERT(currentWorld.worldId() == DOMWrapperWorld::world(contextForWrapper).worldId()); + if (currentWorld.isMainWorld()) { + RELEASE_ASSERT(BindingSecurity::shouldAllowAccessToFrame(isolate, frame, DoNotReportSecurityError)); + } +} + +void V8WrapperInstantiationScope::convertException() +{ + v8::Isolate* isolate = m_context->GetIsolate(); + // TODO(jochen): Currently, Location is the only object for which we can reach this code path. Should be generalized. + ExceptionState exceptionState(ExceptionState::ConstructionContext, "Location", isolate->GetCurrentContext()->Global(), isolate); + LocalDOMWindow* callingWindow = callingDOMWindow(isolate); + DOMWindow* targetWindow = toFrameIfNotDetached(m_context)->domWindow(); + exceptionState.throwSecurityError(targetWindow->sanitizedCrossDomainAccessErrorMessage(callingWindow), targetWindow->crossDomainAccessErrorMessage(callingWindow)); + exceptionState.throwIfNeeded(); +} + } // namespace blink diff -Nru chromium-browser-45.0.2454.85/third_party/WebKit/Source/bindings/core/v8/V8DOMWrapper.h chromium-browser-45.0.2454.101/third_party/WebKit/Source/bindings/core/v8/V8DOMWrapper.h --- chromium-browser-45.0.2454.85/third_party/WebKit/Source/bindings/core/v8/V8DOMWrapper.h 2015-09-01 20:10:52.000000000 +0000 +++ chromium-browser-45.0.2454.101/third_party/WebKit/Source/bindings/core/v8/V8DOMWrapper.h 2015-09-25 09:06:24.000000000 +0000 @@ -31,8 +31,10 @@ #ifndef V8DOMWrapper_h #define V8DOMWrapper_h +#include "bindings/core/v8/BindingSecurity.h" #include "bindings/core/v8/DOMDataStore.h" #include "bindings/core/v8/ScriptWrappable.h" +#include "bindings/core/v8/V8Binding.h" #include "wtf/PassRefPtr.h" #include "wtf/RawPtr.h" #include "wtf/text/AtomicString.h" @@ -106,19 +108,27 @@ class V8WrapperInstantiationScope { public: - V8WrapperInstantiationScope(v8::Local creationContext, v8::Isolate* isolate) + V8WrapperInstantiationScope(v8::Local creationContext, v8::Isolate* isolate, bool withSecurityCheck = true) : m_didEnterContext(false) , m_context(isolate->GetCurrentContext()) + , m_tryCatch(isolate) + , m_convertExceptions(false) { // creationContext should not be empty. Because if we have an // empty creationContext, we will end up creating // a new object in the context currently entered. This is wrong. RELEASE_ASSERT(!creationContext.IsEmpty()); v8::Local contextForWrapper = creationContext->CreationContext(); + // For performance, we enter the context only if the currently running context // is different from the context that we are about to enter. if (contextForWrapper == m_context) return; + if (withSecurityCheck) { + securityCheck(isolate, contextForWrapper); + } else { + m_convertExceptions = true; + } m_context = v8::Local::New(isolate, contextForWrapper); m_didEnterContext = true; m_context->Enter(); @@ -126,16 +136,31 @@ ~V8WrapperInstantiationScope() { - if (!m_didEnterContext) + if (!m_didEnterContext) { + m_tryCatch.ReThrow(); return; + } m_context->Exit(); + // Rethrow any cross-context exceptions as security error. + if (m_tryCatch.HasCaught()) { + if (m_convertExceptions) { + m_tryCatch.Reset(); + convertException(); + } + m_tryCatch.ReThrow(); + } } v8::Local context() const { return m_context; } private: + void securityCheck(v8::Isolate*, v8::Local contextForWrapper); + void convertException(); + bool m_didEnterContext; v8::Local m_context; + v8::TryCatch m_tryCatch; + bool m_convertExceptions; }; } // namespace blink diff -Nru chromium-browser-45.0.2454.85/third_party/WebKit/Source/bindings/core/v8/WindowProxy.cpp chromium-browser-45.0.2454.101/third_party/WebKit/Source/bindings/core/v8/WindowProxy.cpp --- chromium-browser-45.0.2454.85/third_party/WebKit/Source/bindings/core/v8/WindowProxy.cpp 2015-09-01 20:10:52.000000000 +0000 +++ chromium-browser-45.0.2454.101/third_party/WebKit/Source/bindings/core/v8/WindowProxy.cpp 2015-09-25 09:06:24.000000000 +0000 @@ -428,8 +428,22 @@ return; } - if (m_world->isPrivateScriptIsolatedWorld()) + if (m_world->isPrivateScriptIsolatedWorld()) { token = "private-script://" + token; + } else if (m_world->isIsolatedWorld()) { + SecurityOrigin* frameSecurityOrigin = m_frame->securityContext()->securityOrigin(); + String frameSecurityToken = frameSecurityOrigin->toString(); + // We need to check the return value of domainWasSetInDOM() on the + // frame's SecurityOrigin because, if that's the case, only + // SecurityOrigin::m_domain would have been modified. + // m_domain is not used by SecurityOrigin::toString(), so we would end + // up generating the same token that was already set. + if (frameSecurityOrigin->domainWasSetInDOM() || frameSecurityToken.isEmpty() || frameSecurityToken == "null") { + context->UseDefaultSecurityToken(); + return; + } + token = frameSecurityToken + token; + } CString utf8Token = token.utf8(); // NOTE: V8 does identity comparison in fast path, must use a symbol @@ -522,7 +536,6 @@ void WindowProxy::updateSecurityOrigin(SecurityOrigin* origin) { - ASSERT(m_world->isMainWorld()); if (!isContextInitialized()) return; setSecurityToken(origin); diff -Nru chromium-browser-45.0.2454.85/third_party/WebKit/Source/bindings/templates/interface.cpp chromium-browser-45.0.2454.101/third_party/WebKit/Source/bindings/templates/interface.cpp --- chromium-browser-45.0.2454.85/third_party/WebKit/Source/bindings/templates/interface.cpp 2015-09-01 20:10:52.000000000 +0000 +++ chromium-browser-45.0.2454.101/third_party/WebKit/Source/bindings/templates/interface.cpp 2015-09-25 09:06:24.000000000 +0000 @@ -560,8 +560,8 @@ { {{cpp_class}}* impl = scriptWrappable->toImpl<{{cpp_class}}>(); {% if set_wrapper_reference_to %} - v8::Local creationContext = v8::Local::New(isolate, wrapper); - V8WrapperInstantiationScope scope(creationContext, isolate); + v8::Local context = v8::Local::New(isolate, wrapper); + v8::Context::Scope scope(context->CreationContext()); {{set_wrapper_reference_to.cpp_type}} {{set_wrapper_reference_to.name}} = impl->{{set_wrapper_reference_to.name}}(); if ({{set_wrapper_reference_to.name}}) { if (DOMDataStore::containsWrapper({{set_wrapper_reference_to.name}}, isolate)) diff -Nru chromium-browser-45.0.2454.85/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterface.cpp chromium-browser-45.0.2454.101/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterface.cpp --- chromium-browser-45.0.2454.85/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterface.cpp 2015-09-01 20:10:52.000000000 +0000 +++ chromium-browser-45.0.2454.101/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterface.cpp 2015-09-25 09:06:24.000000000 +0000 @@ -2213,8 +2213,8 @@ void V8TestInterface::visitDOMWrapper(v8::Isolate* isolate, ScriptWrappable* scriptWrappable, const v8::Persistent& wrapper) { TestInterfaceImplementation* impl = scriptWrappable->toImpl(); - v8::Local creationContext = v8::Local::New(isolate, wrapper); - V8WrapperInstantiationScope scope(creationContext, isolate); + v8::Local context = v8::Local::New(isolate, wrapper); + v8::Context::Scope scope(context->CreationContext()); TestInterfaceImplementation* referencedName = impl->referencedName(); if (referencedName) { if (DOMDataStore::containsWrapper(referencedName, isolate)) diff -Nru chromium-browser-45.0.2454.85/third_party/WebKit/Source/bindings/tests/results/modules/V8TestInterface5.cpp chromium-browser-45.0.2454.101/third_party/WebKit/Source/bindings/tests/results/modules/V8TestInterface5.cpp --- chromium-browser-45.0.2454.85/third_party/WebKit/Source/bindings/tests/results/modules/V8TestInterface5.cpp 2015-09-01 20:10:52.000000000 +0000 +++ chromium-browser-45.0.2454.101/third_party/WebKit/Source/bindings/tests/results/modules/V8TestInterface5.cpp 2015-09-25 09:06:24.000000000 +0000 @@ -906,8 +906,8 @@ void V8TestInterface5::visitDOMWrapper(v8::Isolate* isolate, ScriptWrappable* scriptWrappable, const v8::Persistent& wrapper) { TestInterface5Implementation* impl = scriptWrappable->toImpl(); - v8::Local creationContext = v8::Local::New(isolate, wrapper); - V8WrapperInstantiationScope scope(creationContext, isolate); + v8::Local context = v8::Local::New(isolate, wrapper); + v8::Context::Scope scope(context->CreationContext()); TestInterface5Implementation* referencedName = impl->referencedName(); if (referencedName) { if (DOMDataStore::containsWrapper(referencedName, isolate)) diff -Nru chromium-browser-45.0.2454.85/third_party/WebKit/Source/core/animation/css/CSSAnimations.cpp chromium-browser-45.0.2454.101/third_party/WebKit/Source/core/animation/css/CSSAnimations.cpp --- chromium-browser-45.0.2454.85/third_party/WebKit/Source/core/animation/css/CSSAnimations.cpp 2015-09-01 20:10:52.000000000 +0000 +++ chromium-browser-45.0.2454.101/third_party/WebKit/Source/core/animation/css/CSSAnimations.cpp 2015-09-25 09:06:24.000000000 +0000 @@ -100,6 +100,11 @@ timingFunction = CSSTimingData::initialTimingFunction(); } keyframe->setEasing(timingFunction.release()); + } else if (property == CSSPropertyFilter) { + // TODO(alancutter): We will not support animating filter until -webkit-filter is an alias for it. + // This is to prevent animations on both -webkit-filter and filter from being run on the main thread when + // they would otherwise run on the compositor. + continue; } else if (CSSAnimations::isAnimatableProperty(property)) { keyframe->setPropertyValue(property, properties.propertyAt(j).value()); } diff -Nru chromium-browser-45.0.2454.85/third_party/WebKit/Source/core/dom/Document.cpp chromium-browser-45.0.2454.101/third_party/WebKit/Source/core/dom/Document.cpp --- chromium-browser-45.0.2454.85/third_party/WebKit/Source/core/dom/Document.cpp 2015-09-01 20:10:52.000000000 +0000 +++ chromium-browser-45.0.2454.101/third_party/WebKit/Source/core/dom/Document.cpp 2015-09-25 09:06:24.000000000 +0000 @@ -4073,6 +4073,9 @@ const KURL& Document::firstPartyForCookies() const { + if (SchemeRegistry::shouldTreatURLSchemeAsFirstPartyWhenTopLevel(topDocument().url().protocol())) + return topDocument().url(); + // We're intentionally using the URL of each document rather than the document's SecurityOrigin. // Sandboxing a document into a unique origin shouldn't effect first-/third-party status for // cookies and site data. @@ -5377,10 +5380,10 @@ if (oldActiveElement && !request.active()) { // The oldActiveElement layoutObject is null, dropped on :active by setting display: none, // for instance. We still need to clear the ActiveChain as the mouse is released. - for (Node* node = oldActiveElement; node; node = ComposedTreeTraversal::parent(*node)) { + for (RefPtrWillBeRawPtr node = oldActiveElement; node; node = ComposedTreeTraversal::parent(*node)) { ASSERT(!node->isTextNode()); node->setActive(false); - m_userActionElements.setInActiveChain(node, false); + m_userActionElements.setInActiveChain(node.get(), false); } setActiveHoverElement(nullptr); } else { diff -Nru chromium-browser-45.0.2454.85/third_party/WebKit/Source/core/dom/Text.cpp chromium-browser-45.0.2454.101/third_party/WebKit/Source/core/dom/Text.cpp --- chromium-browser-45.0.2454.85/third_party/WebKit/Source/core/dom/Text.cpp 2015-09-01 20:10:52.000000000 +0000 +++ chromium-browser-45.0.2454.101/third_party/WebKit/Source/core/dom/Text.cpp 2015-09-25 09:06:24.000000000 +0000 @@ -237,31 +237,12 @@ return cloneWithData(data()); } -static inline bool hasGeneratedAnonymousTableCells(const LayoutObject& parent) -{ - // We're checking whether the table part has generated anonymous table - // part wrappers to hold its contents, so inspecting its first child will suffice. - LayoutObject* child = parent.slowFirstChild(); - if (!child || !child->isAnonymous()) - return false; - if (child->isTableCell()) - return true; - if (child->isTableSection() || child->isTableRow()) - return hasGeneratedAnonymousTableCells(*child); - return false; -} - static inline bool canHaveWhitespaceChildren(const LayoutObject& parent) { //