code:
--- chromium-59.0.3071.86/third_party/WebKit/Source/platform/wtf/LinkedHashSet.h.orig	2017-06-06 15:05:38.145247996 +0300
+++ chromium-59.0.3071.86/third_party/WebKit/Source/platform/wtf/LinkedHashSet.h	2017-06-06 15:06:13.866246667 +0300
@@ -647,31 +647,6 @@
   friend class LinkedHashSet;
 };

-inline void SwapAnchor(LinkedHashSetNodeBase& a, LinkedHashSetNodeBase& b) {
-  DCHECK(a.prev_);
-  DCHECK(a.next_);
-  DCHECK(b.prev_);
-  DCHECK(b.next_);
-  swap(a.prev_, b.prev_);
-  swap(a.next_, b.next_);
-  if (b.next_ == &a) {
-    DCHECK_EQ(b.prev_, &a);
-    b.next_ = &b;
-    b.prev_ = &b;
-  } else {
-    b.next_->prev_ = &b;
-    b.prev_->next_ = &b;
-  }
-  if (a.next_ == &b) {
-    DCHECK_EQ(a.prev_, &b);
-    a.next_ = &a;
-    a.prev_ = &a;
-  } else {
-    a.next_->prev_ = &a;
-    a.prev_->next_ = &a;
-  }
-}
-
 inline void swap(LinkedHashSetNodeBase& a, LinkedHashSetNodeBase& b) {
   DCHECK_NE(a.next_, &a);
   DCHECK_NE(b.next_, &b);
@@ -725,6 +700,31 @@
   return *this;
 }

+inline void SwapAnchor(LinkedHashSetNodeBase& a, LinkedHashSetNodeBase& b) {
+  DCHECK(a.prev_);
+  DCHECK(a.next_);
+  DCHECK(b.prev_);
+  DCHECK(b.next_);
+  swap(a.prev_, b.prev_);
+  swap(a.next_, b.next_);
+  if (b.next_ == &a) {
+    DCHECK_EQ(b.prev_, &a);
+    b.next_ = &b;
+    b.prev_ = &b;
+  } else {
+    b.next_->prev_ = &b;
+    b.prev_->next_ = &b;
+  }
+  if (a.next_ == &b) {
+    DCHECK_EQ(a.prev_, &b);
+    a.next_ = &a;
+    a.prev_ = &a;
+  } else {
+    a.next_->prev_ = &a;
+    a.prev_->next_ = &a;
+  }
+}
+
 template <typename T, typename U, typename V, typename W>
 inline void LinkedHashSet<T, U, V, W>::Swap(LinkedHashSet& other) {
   impl_.swap(other.impl_);

--- chromium-59.0.3071.86/third_party/WebKit/Source/platform/graphics/gpu/SharedGpuContext.h.orig	2017-06-06 16:16:43.657661313 +0300
+++ chromium-59.0.3071.86/third_party/WebKit/Source/platform/graphics/gpu/SharedGpuContext.h	2017-06-06 16:16:50.911198032 +0300
@@ -5,6 +5,7 @@
 #include "platform/PlatformExport.h"
 #include "platform/wtf/ThreadSpecific.h"

+#include <functional>
 #include <memory>

 namespace gpu {


code:
#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Encoding=UTF-8
Name=Chromium Browser
GenericName=Web Browser
GenericName[ar]=متصفح الشبكة
GenericName[bg]=Уеб браузър
GenericName[ca]=Navegador web
GenericName[cs]=WWW prohlížeč
GenericName[da]=Browser
GenericName[de]=Web-Browser
GenericName[el]=Περιηγητής ιστού
GenericName[en_GB]=Web Browser
GenericName[es]=Navegador web
GenericName[et]=Veebibrauser
GenericName[fi]=WWW-selain
GenericName[fr]=Navigateur Web
GenericName[gu]=વેબ બ્રાઉઝર
GenericName[he]=דפדפן אינטרנט
GenericName[hi]=वेब ब्राउज़र
GenericName[hu]=Webböngésző
GenericName[it]=Browser Web
GenericName[ja]=ウェブブラウザ
GenericName[kn]=ಜಾಲ ವೀಕ್ಷಕ
GenericName[ko]=웹 브라우저
GenericName[lt]=Žiniatinklio naršyklė
GenericName[lv]=Tīmekļa pārlūks
GenericName[ml]=വെബ് ബ്രൌസര്
GenericName[mr]=वेब ब्राऊजर
GenericName[nb]=Nettleser
GenericName[nl]=Webbrowser
GenericName[pl]=Przeglądarka WWW
GenericName[pt]=Navegador Web
GenericName[pt_BR]=Navegador da Internet
GenericName[ro]=Navigator de Internet
GenericName[ru]=Веб-браузер
GenericName[sl]=Spletni brskalnik
GenericName[sv]=Webbläsare
GenericName[ta]=இணைய உலாவி
GenericName[th]=เว็บเบราว์เซอร์
GenericName[tr]=Web Tarayıcı
GenericName[uk]=Навігатор Тенет
GenericName[zh_CN]=网页浏览器
GenericName[zh_HK]=網頁瀏覽器
GenericName[zh_TW]=網頁瀏覽器
GenericName[bn]=ওয়েব ব্রাউজার
GenericName[fil]=Web Browser
GenericName[hr]=Web preglednik
GenericName[id]=Browser Web
GenericName[or]=ଓ୍ବେବ ବ୍ରାଉଜର
GenericName[sk]=WWW prehliadač
GenericName[sr]=Интернет прегледник
GenericName[te]=మహాతల అన్వేషి
GenericName[vi]=Bộ duyệt Web
Comment=Access the Internet
Comment[ar]=الدخول إلى الإنترنت
Comment[bg]=Достъп до интернет
Comment[bn]=ইন্টারনেটটি অ্যাক্সেস করুন
Comment[ca]=Accedeix a Internet
Comment[cs]=Přístup k internetu
Comment[da]=Få adgang til internettet
Comment[de]=Internetzugriff
Comment[el]=Πρόσβαση στο Διαδίκτυο
Comment[en_GB]=Access the Internet
Comment[es]=Accede a Internet.
Comment[et]=Pääs Internetti
Comment[fi]=Käytä internetiä
Comment[fil]=I-access ang Internet
Comment[fr]=Accéder à Internet
Comment[gu]=ઇંટરનેટ ઍક્સેસ કરો
Comment[he]=גישה אל האינטרנט
Comment[hi]=इंटरनेट तक पहुंच स्थापित करें
Comment[hr]=Pristup Internetu
Comment[hu]=Internetelérés
Comment[id]=Akses Internet
Comment[it]=Accesso a Internet
Comment[ja]=インターネットにアクセス
Comment[kn]=ಇಂಟರ್ನೆಟ್ ಅನ್ನು ಪ್ರವೇಶಿಸಿ
Comment[ko]=인터넷 연결
Comment[lt]=Interneto prieiga
Comment[lv]=Piekļūt internetam
Comment[ml]=ഇന്റര്‍നെറ്റ് ആക്‌സസ് ചെയ്യുക
Comment[mr]=इंटरनेटमध्ये प्रवेश करा
Comment[nb]=Gå til Internett
Comment[nl]=Verbinding maken met internet
Comment[or]=ଇଣ୍ଟର୍ନେଟ୍ ପ୍ରବେଶ କରନ୍ତୁ
Comment[pl]=Skorzystaj z internetu
Comment[pt]=Aceder à Internet
Comment[pt_BR]=Acessar a internet
Comment[ro]=Accesaţi Internetul
Comment[ru]=Доступ в Интернет
Comment[sk]=Prístup do siete Internet
Comment[sl]=Dostop do interneta
Comment[sr]=Приступите Интернету
Comment[sv]=Gå ut på Internet
Comment[ta]=இணையத்தை அணுகுதல்
Comment[te]=ఇంటర్నెట్‌ను ఆక్సెస్ చెయ్యండి
Comment[th]=เข้าถึงอินเทอร์เน็ต
Comment[tr]=İnternet'e erişin
Comment[uk]=Доступ до Інтернету
Comment[vi]=Truy cập Internet
Comment[zh_CN]=访问互联网
Comment[zh_HK]=連線到網際網路
Comment[zh_TW]=連線到網際網路
Exec=chromium-browser %U  --ppapi-flash-path=/usr/lib/chromium-browser/PepperFlash/libpepflashplayer.so --ppapi-flash-version=$version
Terminal=false
Icon=chromium-browser
Type=Application
Categories=Application;Network;
MimeType=text/html;text/xml;application/xhtml_xml;
StartupWMClass=Chromium
StartupNotify=true

repo_name: ayhanyalcinsoy/main


code:
diff --git a/base/numerics/safe_math_shared_impl.h b/base/numerics/safe_math_shared_impl.h
index 99f230ce7e9a..de2415d402f5 100644
--- a/base/numerics/safe_math_shared_impl.h
+++ b/base/numerics/safe_math_shared_impl.h
@@ -21,8 +21,7 @@
 #if !defined(__native_client__) &&                         \
     ((defined(__clang__) &&                                \
       ((__clang_major__ > 3) ||                            \
-       (__clang_major__ == 3 && __clang_minor__ >= 4))) || \
-     (defined(__GNUC__) && __GNUC__ >= 5))
+       (__clang_major__ == 3 && __clang_minor__ >= 4))))
 #include "base/numerics/safe_math_clang_gcc_impl.h"
 #define BASE_HAS_OPTIMIZED_SAFE_MATH (1)
 #else


code:
--- a/third_party/WebKit/Source/platform/wtf/typed_arrays/ArrayBufferContents.h
+++ b/third_party/WebKit/Source/platform/wtf/typed_arrays/ArrayBufferContents.h
@@ -63,7 +63,7 @@ class WTF_EXPORT ArrayBufferContents {
           allocation_length_(0),
           data_(data),
           data_length_(0),
-          kind_(AllocationKind::kNormal),
+          kind_(WTF::ArrayBufferContents::AllocationKind::kNormal),
           deleter_(deleter) {}
     DataHandle(void* allocation_base,
                size_t allocation_length,
@@ -94,11 +94,11 @@ class WTF_EXPORT ArrayBufferContents {
              reinterpret_cast<uintptr_t>(allocation_base_) +
                  allocation_length_);
       switch (kind_) {
-        case AllocationKind::kNormal:
+        case WTF::ArrayBufferContents::AllocationKind::kNormal:
           DCHECK(deleter_);
           deleter_(data_);
           return;
-        case AllocationKind::kReservation:
+        case WTF::ArrayBufferContents::AllocationKind::kReservation:
           ReleaseReservedMemory(allocation_base_, allocation_length_);
           return;
       }
--- a/third_party/webrtc/modules/audio_processing/aec3/aec_state.cc.orig	2017-08-15 12:45:59.433532111 +0000
+++ b/third_party/webrtc/modules/audio_processing/aec3/aec_state.cc	2017-08-15 17:52:59.691328825 +0000
@@ -10,7 +10,7 @@

 #include "webrtc/modules/audio_processing/aec3/aec_state.h"

-#include <math.h>
+#include <cmath>
 #include <numeric>
 #include <vector>


code:
--- a/tools/gn/bootstrap/bootstrap.py
+++ b/tools/gn/bootstrap/bootstrap.py
@@ -179,6 +179,7 @@ def build_gn_with_ninja_manually(tempdir, options):

   write_buildflag_header_manually(root_gen_dir, 'base/debug/debugging_flags.h',
       {
+          'ENABLE_LOCATION_SOURCE': 'false',
           'ENABLE_PROFILING': 'false',
           'CAN_UNWIND_WITH_FRAME_POINTERS': 'false'
       })
@@ -204,7 +205,7 @@ def build_gn_with_ninja_manually(tempdir, options):

   write_gn_ninja(os.path.join(tempdir, 'build.ninja'),
                  root_gen_dir, options)
-  cmd = ['ninja', '-C', tempdir]
+  cmd = ['ninja', '-C', tempdir, '-w', 'dupbuild=err']
   if options.verbose:
     cmd.append('-v')

@@ -458,6 +459,7 @@ def write_gn_ninja(path, root_gen_dir, options):
       'base/metrics/bucket_ranges.cc',
       'base/metrics/field_trial.cc',
       'base/metrics/field_trial_param_associator.cc',
+      'base/metrics/field_trial_params.cc',
       'base/metrics/histogram.cc',
       'base/metrics/histogram_base.cc',
       'base/metrics/histogram_functions.cc',
@@ -507,6 +509,7 @@ def write_gn_ninja(path, root_gen_dir, options):
       'base/task_scheduler/scheduler_lock_impl.cc',
       'base/task_scheduler/scheduler_single_thread_task_runner_manager.cc',
       'base/task_scheduler/scheduler_worker.cc',
+      'base/task_scheduler/scheduler_worker_pool.cc',
       'base/task_scheduler/scheduler_worker_pool_impl.cc',
       'base/task_scheduler/scheduler_worker_pool_params.cc',
       'base/task_scheduler/scheduler_worker_stack.cc',
@@ -523,6 +526,7 @@ def write_gn_ninja(path, root_gen_dir, options):
       'base/third_party/icu/icu_utf.cc',
       'base/third_party/nspr/prtime.cc',
       'base/threading/post_task_and_reply_impl.cc',
+      'base/threading/scoped_blocking_call.cc',
       'base/threading/sequence_local_storage_map.cc',
       'base/threading/sequenced_task_runner_handle.cc',
       'base/threading/sequenced_worker_pool.cc',
@@ -579,7 +583,6 @@ def write_gn_ninja(path, root_gen_dir, options):
       'base/unguessable_token.cc',
       'base/value_iterators.cc',
       'base/values.cc',
-      'base/value_iterators.cc',
       'base/vlog.cc',
   ])

@@ -652,7 +655,6 @@ def write_gn_ninja(path, root_gen_dir, options):
     static_libraries['base']['sources'].extend([
         'base/memory/shared_memory_handle_posix.cc',
         'base/memory/shared_memory_posix.cc',
-        'base/memory/shared_memory_tracker.cc',
         'base/nix/xdg_util.cc',
         'base/process/internal_linux.cc',
         'base/process/memory_linux.cc',
@@ -827,7 +829,7 @@ def build_gn_with_gn(temp_gn, build_dir, options):
   cmd = [temp_gn, 'gen', build_dir, '--args=%s' % gn_gen_args]
   check_call(cmd)

-  cmd = ['ninja', '-C', build_dir]
+  cmd = ['ninja', '-C', build_dir, '-w', 'dupbuild=err']
   if options.verbose:
     cmd.append('-v')
   cmd.append('gn')


code:
Index: tools/gn/bootstrap/bootstrap.py
diff --git a/tools/gn/bootstrap/bootstrap.py b/tools/gn/bootstrap/bootstrap.py
index 38cfb117d29c3895291379f00d8dc8c8b0727474..679170e610f8292bcbeb76508fd247d322a69c79 100755
--- a/tools/gn/bootstrap/bootstrap.py
+++ b/tools/gn/bootstrap/bootstrap.py
@@ -385,6 +385,7 @@ def write_gn_ninja(path, root_gen_dir, options):
       'base/base_switches.cc',
       'base/build_time.cc',
       'base/callback_internal.cc',
+      'base/callback_helpers.cc',
       'base/command_line.cc',
       'base/debug/activity_tracker.cc',
       'base/debug/alias.cc',


code:
--- a/tools/gn/bootstrap/bootstrap.py
+++ b/tools/gn/bootstrap/bootstrap.py
@@ -546,6 +546,7 @@ def write_gn_ninja(path, root_gen_dir, options):
       'base/timer/timer.cc',
       'base/trace_event/category_registry.cc',
       'base/trace_event/event_name_filter.cc',
+      'base/trace_event/freed_object_tracker.cc',
       'base/trace_event/heap_profiler_allocation_context.cc',
       'base/trace_event/heap_profiler_allocation_context_tracker.cc',
       'base/trace_event/heap_profiler_allocation_register.cc',
@@ -605,7 +606,6 @@ def write_gn_ninja(path, root_gen_dir, options):
         'base/strings/string16.cc',
         'base/synchronization/condition_variable_posix.cc',
         'base/synchronization/lock_impl_posix.cc',
-        'base/synchronization/read_write_lock_posix.cc',
         'base/sys_info_posix.cc',
         'base/task_scheduler/task_tracker_posix.cc',
         'base/threading/platform_thread_internal_posix.cc',


code:
Index: tools/gn/bootstrap/bootstrap.py
diff --git a/tools/gn/bootstrap/bootstrap.py b/tools/gn/bootstrap/bootstrap.py
index 6f2f5b1264519ea38cc36fb0b7e2cc24c378ca7a..0b03d2626b358fb90ab39d737679ee47bd60303b 100755
--- a/tools/gn/bootstrap/bootstrap.py
+++ b/tools/gn/bootstrap/bootstrap.py
@@ -487,6 +487,7 @@ def write_gn_ninja(path, root_gen_dir, options):
       'base/sys_info.cc',
       'base/task_runner.cc',
       'base/task_scheduler/delayed_task_manager.cc',
+      'base/task_scheduler/environment_config.cc',
       'base/task_scheduler/post_task.cc',
       'base/task_scheduler/priority_queue.cc',
       'base/task_scheduler/scheduler_lock_impl.cc',


code:
From 424584b4984bde7c831f42e9fb47f1ad583a1c46 Mon Sep 17 00:00:00 2001
From: jshin <jshin@chromium.org>
Date: Fri, 21 Oct 2016 01:15:50 -0700
Subject: [PATCH] Update aspirational_scripts per Unicode 9

This is a preparation to update ICU to 58.1.
Without this change, ICU update CL cannot be tested on
trybots because a compile will fail due to '#error' checking
if ICU version is less than 58.

BUG=637001
TEST=None
TBR=pkasting@chromium.org

Review-Url: https://chromiumcodereview.appspot.com/2436113003
Cr-Commit-Position: refs/heads/master@{#426749}
---
 components/url_formatter/url_formatter.cc | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/components/url_formatter/url_formatter.cc b/components/url_formatter/url_formatter.cc
index 4455db3..2b82c0c 100644
--- a/components/url_formatter/url_formatter.cc
+++ b/components/url_formatter/url_formatter.cc
@@ -428,9 +428,9 @@ void IDNSpoofChecker::SetAllowedUnicodeSet(UErrorCode* status) {
   // section at
   // http://www.unicode.org/Public/security/latest/xidmodifications.txt) are
   // are added to the allowed set. The list has to be updated when a new
-  // version of Unicode is released. The current version is 8.0.0 and ICU 58
-  // will have Unicode 9.0 data.
-#if U_ICU_VERSION_MAJOR_NUM < 58
+  // version of Unicode is released. The current version is 9.0.0 and ICU 60
+  // will have Unicode 10.0 data.
+#if U_ICU_VERSION_MAJOR_NUM < 60
   const icu::UnicodeSet aspirational_scripts(
       icu::UnicodeString(
           // Unified Canadian Syllabics
@@ -444,13 +444,13 @@ void IDNSpoofChecker::SetAllowedUnicodeSet(UErrorCode* status) {
           // Yi
           "\\uA000-\\uA48C"
           // Miao
-          "\\U00016F00-\\U00016F44\\U00016F50-\\U00016F7F"
+          "\\U00016F00-\\U00016F44\\U00016F50-\\U00016F7E"
           "\\U00016F8F-\\U00016F9F]",
           -1, US_INV),
       *status);
   allowed_set.addAll(aspirational_scripts);
 #else
-#error "Update aspirational_scripts per Unicode 9.0"
+#error "Update aspirational_scripts per Unicode 10.0"
 #endif

   // U+0338 is included in the recommended set, while U+05F4 and U+2027 are in
--
2.10.2

From e60b571faa3f14dd9119a6792dccf12f8bf80192 Mon Sep 17 00:00:00 2001
From: jshin <jshin@chromium.org>
Date: Fri, 21 Oct 2016 12:20:05 -0700
Subject: [PATCH] Prepare to upgrade ICU to 58 part 2

U_LB_COUNT is assumed to be 40 in Blink line breaking code, but it's
43 in ICU 58/Unicode 9.

Three new classes (Emoji Base, Emoji Modifier, and ZWJ) should behave
identically whether or not 'word-break: break-all' is in effect.

BUG=637001
TEST=TextBreakIterator.cpp is compiled without an error with ICU 58.
R=kojii@chromium.org
CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_precise_blink_rel

Review-Url: https://chromiumcodereview.appspot.com/2440923002
Cr-Commit-Position: refs/heads/master@{#426860}
---
 .../WebKit/Source/platform/text/TextBreakIterator.cpp    | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/third_party/WebKit/Source/platform/text/TextBreakIterator.cpp b/third_party/WebKit/Source/platform/text/TextBreakIterator.cpp
index 568dc0a..36121eb 100644
--- a/third_party/WebKit/Source/platform/text/TextBreakIterator.cpp
+++ b/third_party/WebKit/Source/platform/text/TextBreakIterator.cpp
@@ -28,6 +28,9 @@
 #include "wtf/StdLibExtras.h"
 #include "wtf/text/CharacterNames.h"

+#include <unicode/uchar.h>
+#include <unicode/uvernum.h>
+
 namespace blink {

 unsigned numGraphemeClusters(const String& string) {
@@ -129,6 +132,11 @@ static const unsigned char asciiLineBreakTable[][(asciiLineBreakTableLastChar -
 };
 // clang-format on

+#if U_ICU_VERSION_MAJOR_NUM >= 58
+#define BA_LB_COUNT (U_LB_COUNT - 3)
+#else
+#define BA_LB_COUNT U_LB_COUNT
+#endif
 // Line breaking table for CSS word-break: break-all. This table differs from
 // asciiLineBreakTable in:
 // - Indices are Line Breaking Classes defined in UAX#14 Unicode Line Breaking
@@ -136,7 +144,7 @@ static const unsigned char asciiLineBreakTable[][(asciiLineBreakTableLastChar -
 // - 1 indicates additional break opportunities. 0 indicates to fallback to
 //   normal line break, not "prohibit break."
 // clang-format off
-static const unsigned char breakAllLineBreakClassTable[][U_LB_COUNT / 8 + 1] = {
+static const unsigned char breakAllLineBreakClassTable[][BA_LB_COUNT / 8 + 1] = {
     // XX AI AL B2 BA BB BK CB    CL CM CR EX GL HY ID IN    IS LF NS NU OP PO PR QU    SA SG SP SY ZW NL WJ H2    H3 JL JT JV CP CJ HL RI
     { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // XX
     { B(0, 1, 1, 0, 1, 0, 0, 0), B(0, 0, 0, 0, 0, 1, 0, 0), B(0, 0, 0, 1, 1, 0, 1, 0), B(1, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 1, 0) }, // AI
@@ -190,7 +198,7 @@ static_assert(WTF_ARRAY_LENGTH(asciiLineBreakTable) ==
                   asciiLineBreakTableLastChar - asciiLineBreakTableFirstChar +
                       1,
               "asciiLineBreakTable should be consistent");
-static_assert(WTF_ARRAY_LENGTH(breakAllLineBreakClassTable) == U_LB_COUNT,
+static_assert(WTF_ARRAY_LENGTH(breakAllLineBreakClassTable) == BA_LB_COUNT,
               "breakAllLineBreakClassTable should be consistent");

 static inline bool shouldBreakAfter(UChar lastCh, UChar ch, UChar nextCh) {
@@ -226,8 +234,8 @@ static inline ULineBreak lineBreakPropertyValue(UChar lastCh, UChar ch) {

 static inline bool shouldBreakAfterBreakAll(ULineBreak lastLineBreak,
                                             ULineBreak lineBreak) {
-  if (lineBreak >= 0 && lineBreak < U_LB_COUNT && lastLineBreak >= 0 &&
-      lastLineBreak < U_LB_COUNT) {
+  if (lineBreak >= 0 && lineBreak < BA_LB_COUNT && lastLineBreak >= 0 &&
+      lastLineBreak < BA_LB_COUNT) {
     const unsigned char* tableRow = breakAllLineBreakClassTable[lastLineBreak];
     return tableRow[lineBreak / 8] & (1 << (lineBreak % 8));
   }
--
2.10.2


code:
diff -upr chromium-59.0.3071.86.orig/v8/src/objects/hash-table.h chromium-59.0.3071.86/v8/src/objects/hash-table.h
--- chromium-59.0.3071.86.orig/v8/src/objects/hash-table.h	2017-06-05 22:04:29.000000000 +0300
+++ chromium-59.0.3071.86/v8/src/objects/hash-table.h	2017-06-06 14:35:41.558245559 +0300
@@ -135,22 +135,10 @@ class HashTable : public HashTableBase {
  public:
   typedef Shape ShapeT;

-  // Wrapper methods
-  inline uint32_t Hash(Key key) {
-    if (Shape::UsesSeed) {
-      return Shape::SeededHash(key, GetHeap()->HashSeed());
-    } else {
-      return Shape::Hash(key);
-    }
-  }
-
-  inline uint32_t HashForObject(Key key, Object* object) {
-    if (Shape::UsesSeed) {
-      return Shape::SeededHashForObject(key, GetHeap()->HashSeed(), object);
-    } else {
-      return Shape::HashForObject(key, object);
-    }
-  }
+  // Wrapper methods.  Defined in src/objects-inl.h
+  // to break a cycle with src/heap/heap.h.
+  inline uint32_t Hash(Key key);
+  inline uint32_t HashForObject(Key key, Object* object);

   // Returns a new HashTable object.
   MUST_USE_RESULT static Handle<Derived> New(
diff -upr chromium-59.0.3071.86.orig/v8/src/objects-body-descriptors.h chromium-59.0.3071.86/v8/src/objects-body-descriptors.h
--- chromium-59.0.3071.86.orig/v8/src/objects-body-descriptors.h	2017-06-05 22:04:29.000000000 +0300
+++ chromium-59.0.3071.86/v8/src/objects-body-descriptors.h	2017-06-06 14:35:41.554912132 +0300
@@ -99,7 +99,7 @@ class FixedBodyDescriptor final : public

   template <typename StaticVisitor>
   static inline void IterateBody(HeapObject* obj, int object_size) {
-    IterateBody(obj);
+    IterateBody<StaticVisitor>(obj);
   }
 };

diff -upr chromium-59.0.3071.86.orig/v8/src/objects-inl.h chromium-59.0.3071.86/v8/src/objects-inl.h
--- chromium-59.0.3071.86.orig/v8/src/objects-inl.h	2017-06-05 22:04:29.000000000 +0300
+++ chromium-59.0.3071.86/v8/src/objects-inl.h	2017-06-06 14:35:41.558245559 +0300
@@ -46,6 +46,27 @@
 namespace v8 {
 namespace internal {

+template <typename Derived, typename Shape, typename Key>
+uint32_t HashTable<Derived, Shape, Key>::Hash(Key key) {
+  if (Shape::UsesSeed) {
+    return Shape::SeededHash(key, GetHeap()->HashSeed());
+  } else {
+    return Shape::Hash(key);
+  }
+}
+
+
+template <typename Derived, typename Shape, typename Key>
+uint32_t HashTable<Derived, Shape, Key>::HashForObject(Key key,
+                                                       Object* object) {
+  if (Shape::UsesSeed) {
+    return Shape::SeededHashForObject(key, GetHeap()->HashSeed(), object);
+  } else {
+    return Shape::HashForObject(key, object);
+  }
+}
+
+
 PropertyDetails::PropertyDetails(Smi* smi) {
   value_ = smi->value();
 }


code:
Minimal patch to get chromium to compile with widevine support

https://bugs.gentoo.org/show_bug.cgi?id=547630

--- a/third_party/widevine/cdm/stub/widevine_cdm_version.h
+++ b/third_party/widevine/cdm/stub/widevine_cdm_version.h
@@ -10,6 +10,7 @@

 #include "third_party/widevine/cdm/widevine_cdm_common.h"

+#define WIDEVINE_CDM_VERSION_STRING "unknown"
 #define WIDEVINE_CDM_AVAILABLE

 #endif  // WIDEVINE_CDM_VERSION_H_


code:
diff -upr chromium-48.0.2564.82.orig/third_party/widevine/cdm/stub/widevine_cdm_version.h chromium-48.0.2564.82/third_party/widevine/cdm/stub/widevine_cdm_version.h
--- chromium-48.0.2564.82.orig/third_party/widevine/cdm/stub/widevine_cdm_version.h	2016-01-14 01:05:17.000000000 +0200
+++ chromium-48.0.2564.82/third_party/widevine/cdm/stub/widevine_cdm_version.h	2016-01-21 19:18:51.287978456 +0200
@@ -12,4 +12,6 @@

 #define WIDEVINE_CDM_AVAILABLE

+#define WIDEVINE_CDM_VERSION_STRING "@WIDEVINE_VERSION@"
+
 #endif  // WIDEVINE_CDM_VERSION_H_


code:
diff --git a/third_party/WebKit/Source/wtf/dtoa/bignum.cc b/third_party/WebKit/S
 index a000b46..6c6d336 100644
 --- a/third_party/WebKit/Source/wtf/dtoa/bignum.cc
 +++ b/third_party/WebKit/Source/wtf/dtoa/bignum.cc
-@@ -109,7 +109,10 @@ namespace double_conversion {
-         int length = value.length();
-         int pos = 0;
-         // Let's just say that each digit needs 4 bits.
+@@ -102,7 +102,10 @@
+     }
+
+
 +#pragma GCC diagnostic push
 +#pragma GCC diagnostic warning "-Wstrict-overflow"
-         while (length >= kMaxUint64DecimalDigits) {
+     void Bignum::AssignDecimalString(Vector<const char> value) {
 +#pragma GCC diagnostic pop
-             uint64_t digits = ReadUInt64(value, pos, kMaxUint64DecimalDigits);
-             pos += kMaxUint64DecimalDigits;
-             length -= kMaxUint64DecimalDigits;
+         // 2^64 = 18446744073709551616 > 10^19
+         const int kMaxUint64DecimalDigits = 19;
+         Zero();
 --
 1.8.4.5
-

diff --git a/ui/gfx/image/image_util.cc b/ui/gfx/image/image_util.cc
 index 89a3f8c..d595da3 100644
 --- a/ui/gfx/image/image_util.cc
 +++ b/ui/gfx/image/image_util.cc
-@@ -68,7 +68,10 @@ bool VisibleMargins(const ImageSkia& image, int* leading, int* trailing) {
-   int inner_min = bitmap.width();
-   for (int x = 0; x < bitmap.width(); ++x) {
-     for (int y = 0; y < bitmap.height(); ++y) {
+@@ -47,7 +47,10 @@
+ }
+ #endif  // !defined(OS_IOS)
+
 +#pragma GCC diagnostic push
 +#pragma GCC diagnostic warning "-Wstrict-overflow"
-       if (SkColorGetA(bitmap.getColor(x, y)) > kMinimumVisibleOpacity) {
+ bool VisibleMargins(const ImageSkia& image, int* leading, int* trailing) {
 +#pragma GCC diagnostic pop
-         inner_min = x;
-         break;
-       }
+   *leading = 0;
+   *trailing = std::max(1, image.width()) - 1;
+   if (!image.HasRepresentation(1.0))
 --
 1.8.4.5
-
--
2.7.1


code:
diff -Naur orig/ui/gfx/codec/jpeg_codec.cc patched/ui/gfx/codec/jpeg_codec.cc
--- orig/ui/gfx/codec/jpeg_codec.cc	2016-04-24 21:31:31.000000000 +0200
+++ patched/ui/gfx/codec/jpeg_codec.cc	2016-06-13 23:43:36.809948082 +0200
@@ -120,7 +120,7 @@
   // tell libjpeg where to write the next data
   cinfo->dest->next_output_byte = &(*state->out)[state->image_buffer_used];
   cinfo->dest->free_in_buffer = state->out->size() - state->image_buffer_used;
-  return 1;
+  return TRUE;
 }

 // Cleans up the JpegEncoderState to prepare for returning in the final form.
@@ -266,7 +266,7 @@
   cinfo.data_precision = 8;

   jpeg_set_defaults(&cinfo);
-  jpeg_set_quality(&cinfo, quality, 1);  // quality here is 0-100
+  jpeg_set_quality(&cinfo, quality, TRUE);  // quality here is 0-100

   // set up the destination manager
   jpeg_destination_mgr destmgr;
@@ -278,7 +278,7 @@
   JpegEncoderState state(output);
   cinfo.client_data = &state;

-  jpeg_start_compress(&cinfo, 1);
+  jpeg_start_compress(&cinfo, TRUE);

   // feed it the rows, doing necessary conversions for the color format
 #ifdef JCS_EXTENSIONS
@@ -364,7 +364,7 @@
 //   set to a positive value if TRUE is returned. A FALSE return should only
 //   be used when I/O suspension is desired."
 boolean FillInputBuffer(j_decompress_ptr cinfo) {
-  return false;
+  return FALSE;
 }

 // Skip data in the buffer. Since we have all the data at once, this operation
@@ -496,7 +496,7 @@
   cinfo.client_data = &state;

   // fill the file metadata into our buffer
-  if (jpeg_read_header(&cinfo, true) != JPEG_HEADER_OK)
+  if (jpeg_read_header(&cinfo, TRUE) != JPEG_HEADER_OK)
     return false;

   // we want to always get RGB data out


code:
--- chromium-55.0.2883.75/tools/gn/gn_main.cc.orig	2016-12-12 11:49:56.260549036 +0000
+++ chromium-55.0.2883.75/tools/gn/gn_main.cc	2016-12-12 11:50:14.780931485 +0000
@@ -11,13 +11,7 @@
 #include "tools/gn/standard_out.h"
 #include "tools/gn/switches.h"

-// Only the GN-generated build makes this header for now.
-// TODO(brettw) consider adding this if we need it in GYP.
-#if defined(GN_BUILD)
-#include "tools/gn/last_commit_position.h"
-#else
 #define LAST_COMMIT_POSITION "UNKNOWN"
-#endif

 namespace {

--- chromium-55.0.2883.75/tools/gn/BUILD.gn.orig	2016-12-12 11:50:43.513524769 +0000
+++ chromium-55.0.2883.75/tools/gn/BUILD.gn	2016-12-12 11:50:57.697817632 +0000
@@ -227,7 +227,6 @@

   deps = [
     ":gn_lib",
-    ":last_commit_position",
     "//base",
     "//build/config/sanitizers:deps",
   ]


code:
Disable AVX2 code to prevent build failure with GCC

Bug: https://bugs.gentoo.org/608640

--- a/third_party/skia/include/core/SkPreConfig.h
+++ b/third_party/skia/include/core/SkPreConfig.h
@@ -125,7 +125,7 @@
     // These checks must be done in descending order to ensure we set the highest
     // available SSE level.
     #if defined(__AVX2__)
-        #define SK_CPU_SSE_LEVEL    SK_CPU_SSE_LEVEL_AVX2
+        #define SK_CPU_SSE_LEVEL    SK_CPU_SSE_LEVEL_AVX
     #elif defined(__AVX__)
         #define SK_CPU_SSE_LEVEL    SK_CPU_SSE_LEVEL_AVX
     #elif defined(__SSE4_2__)


code:
<?xml version="1.0" ?>
<!DOCTYPE PISI SYSTEM "http://www.pisilinux.org/projeler/pisi/pisi-spec.dtd">
<PISI>
    <Source>
        <Name>chromium-browser</Name>
        <Homepage>http://code.google.com/chromium</Homepage>
        <Packager>
            <Name>Admin PisiLinux</Name>
            <Email>admin@pisilinux.org</Email>
        </Packager>
        <License>GPLv2</License>
        <Icon>chromium-browser</Icon>
        <IsA>app:gui</IsA>
        <Summary>A WebKit powered web browser</Summary>
        <Description>Chromium-browser is an open-source web browser, powered by WebKit.</Description>
        <Archive sha1sum="ee980a4098dfddad852b962046a0c39d9d1ee1d3" type="tarxz">https://commondatastorage.googleapis.com/chromium-browser-official/chromium-62.0.3202.94.tar.xz</Archive>
        <BuildDependencies>
            <Dependency>alsa-lib-devel</Dependency>
            <Dependency>at-spi2-atk-devel</Dependency>
            <Dependency>atk-devel</Dependency>
            <Dependency>cairo-devel</Dependency>
            <Dependency>cups-devel</Dependency>
            <Dependency>desktop-file-utils</Dependency>
            <Dependency>faac-devel</Dependency>
            <!--Dependency>ffmpeg-devel</Dependency-->
            <Dependency>flac-devel</Dependency>
            <Dependency>pciutils-devel</Dependency>
            <Dependency>fontconfig-devel</Dependency>
            <Dependency>dbus-devel</Dependency>
            <Dependency>gperf</Dependency>
            <Dependency>jack-audio-connection-kit-devel</Dependency>
            <Dependency>libavc1394-devel</Dependency>
            <Dependency>libgnome-keyring-devel</Dependency>
            <Dependency>speech-dispatcher-devel</Dependency>
            <Dependency>gdk-pixbuf-devel</Dependency>
            <Dependency>gsm-devel</Dependency>
            <!--Dependency>gtk2-devel</Dependency-->
            <Dependency>gtk3-devel</Dependency>
            <Dependency>harfbuzz-devel</Dependency>
            <Dependency>hunspell-devel</Dependency>
            <!--Dependency>icu4c-devel</Dependency-->
            <Dependency>imlib2-devel</Dependency>
            <Dependency>lame-devel</Dependency>
            <Dependency>libdc1394-devel</Dependency>
            <Dependency>libdrm-devel</Dependency>
            <!--Dependency>libevent-devel</Dependency-->
            <Dependency>libexif-devel</Dependency>
            <Dependency>libjpeg-turbo-devel</Dependency>
            <Dependency>libmtp-devel</Dependency>
            <Dependency>libogg-devel</Dependency>
            <Dependency>libopus-devel</Dependency>
            <Dependency>libsecret-devel</Dependency>
            <Dependency>libtheora-devel</Dependency>
            <Dependency>libvdpau-devel</Dependency>
            <Dependency>libvorbis-devel</Dependency>
            <!--Dependency>libvpx-devel</Dependency-->
            <Dependency>libXcomposite-devel</Dependency>
            <Dependency>libXcursor-devel</Dependency>
            <Dependency>libXdamage-devel</Dependency>
            <Dependency>libXext-devel</Dependency>
            <Dependency>libXfixes-devel</Dependency>
            <Dependency>libXi-devel</Dependency>
            <Dependency>libXrandr-devel</Dependency>
            <Dependency>libXrender-devel</Dependency>
            <Dependency>libXScrnSaver-devel</Dependency>
            <Dependency>libXtst-devel</Dependency>
            <Dependency>minizip-devel</Dependency>
            <Dependency>mit-kerberos</Dependency>
            <Dependency>nss-devel</Dependency>
            <Dependency>opencore-amr-devel</Dependency>
            <Dependency>pango-devel</Dependency>
            <Dependency>pulseaudio-libs-devel</Dependency>
            <Dependency>python-lxml</Dependency>
            <Dependency>schroedinger-devel</Dependency>
            <Dependency>snappy-devel</Dependency>
            <Dependency>libxcb-devel</Dependency>
            <Dependency>speex-devel</Dependency>
            <Dependency>libxslt-devel</Dependency>
            <Dependency>valgrind</Dependency>
            <Dependency>webp-devel</Dependency>
            <Dependency>x264-devel</Dependency>
            <Dependency>xdg-utils</Dependency>
            <Dependency>xvid-devel</Dependency>
            <Dependency>ninja</Dependency>
            <Dependency>libffi-devel</Dependency>
            <Dependency>yasm-devel</Dependency>
            <Dependency>usbutils</Dependency>
            <Dependency>nodejs</Dependency>
            <Dependency>glibc-devel</Dependency>
            <Dependency>glib2-devel</Dependency>
            <Dependency>icon-theme-hicolor</Dependency>
            <Dependency>llvm-clang-devel</Dependency>
        </BuildDependencies>
        <Patches>
            <Patch level="1">chromium-widevine.patch</Patch>
            <Patch level="1">breakpad-use-ucontext_t.patch</Patch>
            <Patch level="1">chromium-gn-bootstrap-r17.patch</Patch>
<!--             <Patch level="1">chromium-blink-gcc7-r2.patch</Patch> -->
<!--             <Patch level="1">chromium-widevine-r1.patch</Patch> -->
            <!--Patch level="1">pisilinux/gfx_jpeg_codec.patch</Patch-->
            <!--Patch level="1">pisilinux/fix_build_with_newer_gcc.patch</Patch-->
            <Patch level="1">pisilinux/last_commit_position.patch</Patch>
        </Patches>
    </Source>
    <Package>
        <Name>chromium-browser</Name>
        <RuntimeDependencies>
            <Dependency>alsa-lib</Dependency>
            <Dependency>dbus</Dependency>
            <Dependency>atk</Dependency>
            <Dependency>cairo</Dependency>
            <Dependency>cups</Dependency>
            <Dependency>flac</Dependency>
            <Dependency>fontconfig</Dependency>
            <Dependency>gdk-pixbuf</Dependency>
            <!--Dependency>gtk2</Dependency-->
            <Dependency>gtk3</Dependency>
            <!--Dependency>libevent</Dependency-->
            <!--Dependency>libjpeg-turbo</Dependency-->
            <!--Dependency>libopus</Dependency-->
            <Dependency>libXcomposite</Dependency>
            <Dependency>libXcursor</Dependency>
            <Dependency>libXdamage</Dependency>
            <Dependency>libXext</Dependency>
            <Dependency>libXfixes</Dependency>
            <Dependency>libXi</Dependency>
            <Dependency>libXrandr</Dependency>
            <Dependency>libXrender</Dependency>
            <Dependency>libXScrnSaver</Dependency>
            <Dependency>libXtst</Dependency>
            <Dependency>libxcb</Dependency>
            <Dependency>libxslt</Dependency>
            <!--Dependency>minizip</Dependency-->
            <!--Dependency>mit-kerberos</Dependency-->
            <Dependency>nss</Dependency>
            <Dependency>pango</Dependency>
            <Dependency>pepperflash</Dependency> <!-- no remove -->
            <Dependency>pulseaudio-libs</Dependency>
            <!--Dependency>speech-dispatcher</Dependency-->
            <!--Dependency>speex</Dependency-->
            <Dependency>webp</Dependency>
            <!--Dependency>pciutils</Dependency-->
            <Dependency>nspr</Dependency>
            <!--Dependency>zlib</Dependency-->
            <Dependency>expat</Dependency>
            <Dependency>glib2</Dependency>
            <Dependency>libX11</Dependency>
            <Dependency>libgcc</Dependency>
            <!--Dependency>libpng</Dependency-->
            <!--Dependency>snappy</Dependency-->
            <!--Dependency>freetype</Dependency-->
            <Dependency>harfbuzz</Dependency>
            <!--Dependency>glibc</Dependency-->
        </RuntimeDependencies>
        <Files>
            <Path fileType="config">/etc</Path>
            <Path fileType="executable">/usr/bin</Path>
            <Path fileType="library">/usr/lib</Path>
            <Path fileType="man">/usr/share/man</Path>
            <Path fileType="doc">/usr/share/doc</Path>
            <Path fileType="data">/usr/share/icons</Path>
            <Path fileType="data">/usr/share/pixmaps</Path>
            <Path fileType="data">/usr/share/applications</Path>
        </Files>
        <AdditionalFiles>
            <AdditionalFile owner="root" permission="0644" target="/usr/lib/chromium-browser/master_preferences" >master_preferences</AdditionalFile>
            <AdditionalFile owner="root" permission="0644" target="/usr/share/applications/chromium-browser.desktop" >chromium-browser.desktop</AdditionalFile>
        </AdditionalFiles>
    </Package>

    <History>
        <Update release="11">
            <Date>2017-11-24</Date>
            <Version>62.0.3202.94</Version>
            <Comment>Version Bump.</Comment>
            <Name>Mustafa Cinasal</Name>
            <Email>muscnsl@gmail.com</Email>
        </Update>
        <Update release="11">
            <Date>2017-07-31</Date>
            <Version>60.0.3112.78</Version>
            <Comment>Version Bump</Comment>
            <Name>Mustafa Cinasal</Name>
            <Email>muscnsl@gmail.com</Email>
        </Update>
        <Update release="10">
            <Date>2017-05-11</Date>
            <Version>58.0.3029.81</Version>
            <Comment>Version Bump</Comment>
            <Name>Mustafa Cinasal</Name>
            <Email>muscnsl@gmail.com</Email>
        </Update>
        <Update release="9">
            <Date>2016-12-12</Date>
            <Version>55.0.2883.75</Version>
            <Comment>Version Bump.</Comment>
            <Name>Ergün Salman</Name>
            <Email>poyraz76@pisilinux.org</Email>
        </Update>
        <Update release="8">
            <Date>2016-09-23</Date>
            <Version>53.0.2785.116</Version>
            <Comment>Version Bump.</Comment>
            <Name>Ergün Salman</Name>
            <Email>poyraz76@pisilinux.org</Email>
        </Update>
        <Update release="7">
            <Date>2016-09-10</Date>
            <Version>53.0.2785.101</Version>
            <Comment>Version Bump.</Comment>
            <Name>Ergün Salman</Name>
            <Email>poyraz76@pisilinux.org</Email>
        </Update>
        <Update release="6">
            <Date>2016-09-06</Date>
            <Version>53.0.2785.92</Version>
            <Comment>Version Bump.</Comment>
            <Name>Ergün Salman</Name>
            <Email>poyraz76@pisilinux.org</Email>
        </Update>
        <Update release="5">
            <Date>2016-08-03</Date>
            <Version>52.0.2743.116</Version>
            <Comment>Version Bump.</Comment>
            <Name>Ergün Salman</Name>
            <Email>poyraz76@pisilinux.org</Email>
        </Update>
        <Update release="4">
            <Date>2016-07-22</Date>
            <Version>52.0.2743.82</Version>
            <Comment>Version Bump.</Comment>
            <Name>Ergün Salman</Name>
            <Email>poyraz76@pisilinux.org</Email>
        </Update>
        <Update release="3">
            <Date>2016-07-05</Date>
            <Version>51.0.2704.106</Version>
            <Comment>Version Bump.</Comment>
            <Name>Ergün Salman</Name>
            <Email>poyraz76@pisilinux.org</Email>
        </Update>
        <Update release="2">
            <Date>2016-06-30</Date>
            <Version>51.0.2704.84</Version>
            <Comment>Version Bump.</Comment>
            <Name>Ergün Salman</Name>
            <Email>poyraz76@pisilinux.org</Email>
        </Update>
        <Update release="1">
             <Date>2016-06-09</Date>
             <Version>48.0.2564.97</Version>
            <Comment>Release Bump</Comment>
             <Name>Pisi Linux Community</Name>
             <Email>admin@pisilinux.org</Email>
        </Update>
    </History>
</PISI>


code:
<?xml version="1.0" ?>
<PISI>
    <Source>
        <Name>chromium-browser</Name>
        <Summary xml:lang="tr">Webkit tabanlı ağ tarayıcı</Summary>
        <Description xml:lang="tr">Chromium, açık kaynak kodlu Webkit tabanlı bir ağ tarayıcıdır.</Description>
    </Source>
</PISI>


code:
<PISI>
    <Name>network.web</Name>
</PISI>


code:
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Licensed under the GNU General Public License, version 3.
# See the file http://www.gnu.org/licenses/gpl.txt

from pisi.actionsapi import get
from pisi.actionsapi import autotools
from pisi.actionsapi import pisitools
from pisi.actionsapi import shelltools

#WorkDir = "mozilla-release"
ObjDir = "build"
locales = "az bs ca  da  de  el  en-US en-GB en-ZA  es-AR  es-CL  es-ES  fi  fr  hr  hu  it  lt nl  pl  pt-BR  pt-PT  ro  ru  sr  sv-SE  tr  uk".split()
xpidir = "%s/xpi" % get.workDIR()
arch = get.ARCH()
ver = ".".join(get.srcVERSION().split(".")[:3])

shelltools.export("SHELL", "/bin/sh")

def setup():
    # Google API key
    shelltools.echo("google_api_key", "AIzaSyBINKL31ZYd8W5byPuwTXYK6cEyoceGh6Y")
    pisitools.dosed(".mozconfig", "%%PWD%%", get.curDIR())
    pisitools.dosed(".mozconfig", "%%FILE%%", "google_api_key")
    pisitools.dosed(".mozconfig", "##JOBCOUNT##", get.makeJOBS())

    # LOCALE
    shelltools.system("rm -rf langpack-ff/*/browser/defaults")
    if not shelltools.isDirectory(xpidir): shelltools.makedirs(xpidir)
    for locale in locales:
        shelltools.system("wget -c -P %s http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/%s/linux-%s/xpi/%s.xpi" % (xpidir, ver, arch, locale))
        shelltools.makedirs("langpack-ff/langpack-%s@firefox.mozilla.org" % locale)
        shelltools.system("unzip -uo %s/%s.xpi -d langpack-ff/langpack-%s@firefox.mozilla.org" % (xpidir, locale, locale))
        print "Replacing browser.properties for %s locale" % locale
        shelltools.copy("browserconfig.properties", "langpack-ff/langpack-%s@firefox.mozilla.org/browser/chrome/%s/locale/branding/" % (locale, locale))
        shelltools.copy("browserconfig.properties", "browser/branding/official/locales/")

    shelltools.makedirs(ObjDir)
    shelltools.cd(ObjDir)

    shelltools.system("../configure --prefix=/usr --libdir=/usr/lib --disable-strip --disable-install-strip")

def build():
    shelltools.cd(ObjDir)
    shelltools.system("../mach build")

def install():
    shelltools.cd(ObjDir)
    shelltools.system("DESTDIR=%s ../mach install " % get.installDIR())

    shelltools.cd("..")

    # Install language packs
    pisitools.insinto("/usr/lib/firefox/browser/extensions", "./langpack-ff/*")

    # Create profile dir, we'll copy bookmarks.html in post-install script
    pisitools.dodir("/usr/lib/firefox/browser/defaults/profile")

    # Install branding icon
    pisitools.insinto("/usr/share/pixmaps", "browser/branding/official/default256.png", "firefox.png")

    # Install docs
    pisitools.dodoc("LEGAL", "LICENSE")


code:
#!/usr/bin/python

import os
import re

def symlink(src, dest):
    try:
        os.symlink(src, dest)
    except OSError:
        pass

def postInstall(fromVersion, fromRelease, toVersion, toRelease):
    os.environ["HOME"] = "/root"
    os.system("/bin/touch /usr/lib/firefox/components/compreg.dat")
    os.system("/bin/touch /usr/lib/firefox/components/xpti.dat")
    os.system("/usr/lib/firefox/firefox -register")
    os.system("/bin/touch /usr/lib/firefox/.autoreg")

    lang = None

    if os.path.exists("/etc/mudur/language"):
        lang = open("/etc/mudur/language").read().strip()
    elif os.path.exists("/etc/env.d/03locale"):
        fileContent = open("/etc/env.d/03locale").read()
        lang = re.search("^LANG=(.*)$", fileContent, flags=re.M)
        if lang:
            lang = lang.group(1).split(".")[0]

    if lang:
        # Bookmarks & Search plugins
        if lang.startswith("tr"):
            symlink("/usr/lib/firefox/pisilinux/bookmarks-tr.html", "/usr/lib/firefox/browser/defaults/profile/bookmarks.html")
            #symlink("/usr/lib/firefox/pisilinux/pisilinux-wiki_tr.xml", "/usr/lib/firefox/browser/searchplugins/pisilinux-wiki.xml")
        elif lang.startswith("nl"):
            symlink("/usr/lib/firefox/pisilinux/bookmarks-nl.html", "/usr/lib/firefox/browser/defaults/profile/bookmarks.html")
            #symlink("/usr/lib/firefox/pisilinux/pisilinux-wiki_nl.xml", "/usr/lib/firefox/browser/searchplugins/pisilinux-wiki.xml")
        elif lang.startswith("pt"):
            #symlink("/usr/lib/firefox/pisilinux/pisilinux-wiki_pt.xml", "/usr/lib/firefox/browser/searchplugins/pisilinux-wiki.xml")
            #TODO: translate bookmarks to pt also.
            symlink("/usr/lib/firefox/pisilinux/bookmarks-en.html", "/usr/lib/firefox/browser/defaults/profile/bookmarks.html")
        elif lang.startswith("de"):
            symlink("/usr/lib/firefox/pisilinux/bookmarks-de.html", "/usr/lib/firefox/browser/defaults/profile/bookmarks.html")
            #symlink("/usr/lib/firefox/pisilinux/pisilinux-wiki_en.xml", "/usr/lib/firefox/browser/searchplugins/pisilinux-wiki.xml")
        elif lang.startswith("es"):
            symlink("/usr/lib/firefox/pisilinux/bookmarks-en.html", "/usr/lib/firefox/browser/defaults/profile/bookmarks.html")
        #else:
            #symlink("/usr/lib/firefox/pisilinux/pisilinux-wiki_en.xml", "/usr/lib/firefox/browser/searchplugins/pisilinux-wiki.xml")

def preRemove():
    for f in  ("/usr/lib/firefox/.autoreg", "/usr/lib/firefox/browser/defaults/profile/bookmarks.html", "/usr/lib/firefox/browser/searchplugins/pisilinux-wiki.xml"):
        try:
            os.unlink(f)
        except:
            pass


code:
From 05ec1aa0d5e8806dd0c5c6d08c82846a1389b599 Mon Sep 17 00:00:00 2001
Message-Id: <05ec1aa0d5e8806dd0c5c6d08c82846a1389b599.1512038840.git.jan.steffens@gmail.com>
From: Robin Grenet <robin.grenet@wanadoo.fr>
Date: Thu, 16 Nov 2017 13:35:58 +0100
Subject: [PATCH 1/2] Bug 1360278 - Add preference to trigger context menu on
 mouse up for GTK+ and macOS, r=mstange,smaug

MozReview-Commit-ID: Bg60bD8jIg6

--HG--
extra : rebase_source : cc8bd5796096f49ad4fdab81885a426afd6117e4
---
 modules/libpref/init/all.js |  4 ++++
 widget/cocoa/nsChildView.mm | 23 +++++++++++++++++++++--
 widget/gtk/nsWindow.cpp     | 27 ++++++++++++++++++++-------
 widget/gtk/nsWindow.h       |  2 ++
 widget/nsBaseWidget.cpp     | 16 ++++++++++++++++
 widget/nsBaseWidget.h       |  6 ++++++
 6 files changed, 69 insertions(+), 9 deletions(-)

diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js
index 9febead1d363d792..7a6e6a20f3cc3fd6 100644
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -231,6 +231,10 @@ pref("browser.sessionhistory.max_total_viewers", -1);

 pref("ui.use_native_colors", true);
 pref("ui.click_hold_context_menus", false);
+
+// Pop up context menu on mouseup instead of mousedown, if that's the OS default.
+// Note: ignored on Windows (context menus always use mouseup)
+pref("ui.context_menus.after_mouseup", false);
 // Duration of timeout of incremental search in menus (ms).  0 means infinite.
 pref("ui.menu.incremental_search.timeout", 1000);
 // If true, all popups won't hide automatically on blur
diff --git a/widget/cocoa/nsChildView.mm b/widget/cocoa/nsChildView.mm
index 25b4c1ba7a2d1207..2affd1ef386cbfd0 100644
--- a/widget/cocoa/nsChildView.mm
+++ b/widget/cocoa/nsChildView.mm
@@ -4719,30 +4719,49 @@ NSEvent* gLastDragMouseDownEvent = nil;
   if (!mGeckoChild)
     return;

-  // Let the superclass do the context menu stuff.
-  [super rightMouseDown:theEvent];
+  if (!nsBaseWidget::ShowContextMenuAfterMouseUp()) {
+    // Let the superclass do the context menu stuff.
+    [super rightMouseDown:theEvent];
+  }

   NS_OBJC_END_TRY_ABORT_BLOCK;
 }

 - (void)rightMouseUp:(NSEvent *)theEvent
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;

   if (!mGeckoChild)
     return;
   if (mTextInputHandler->OnHandleEvent(theEvent)) {
     return;
   }

   WidgetMouseEvent geckoEvent(true, eMouseUp, mGeckoChild,
                               WidgetMouseEvent::eReal);
   [self convertCocoaMouseEvent:theEvent toGeckoEvent:&geckoEvent];
   geckoEvent.button = WidgetMouseEvent::eRightButton;
   geckoEvent.mClickCount = [theEvent clickCount];

   nsAutoRetainCocoaObject kungFuDeathGrip(self);
   mGeckoChild->DispatchInputEvent(&geckoEvent);
+  if (!mGeckoChild)
+    return;
+
+  if (nsBaseWidget::ShowContextMenuAfterMouseUp()) {
+    // Let the superclass do the context menu stuff, but pretend it's rightMouseDown.
+    NSEvent *dupeEvent = [NSEvent mouseEventWithType:NSRightMouseDown
+                                            location:theEvent.locationInWindow
+                                       modifierFlags:theEvent.modifierFlags
+                                           timestamp:theEvent.timestamp
+                                        windowNumber:theEvent.windowNumber
+                                             context:theEvent.context
+                                         eventNumber:theEvent.eventNumber
+                                          clickCount:theEvent.clickCount
+                                            pressure:theEvent.pressure];
+
+    [super rightMouseDown:dupeEvent];
+  }

   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp
index 37b6aae4c3d0b4e7..2b80124538c20ed6 100644
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -2727,6 +2727,19 @@ static guint ButtonMaskFromGDKButton(guint button)
     return GDK_BUTTON1_MASK << (button - 1);
 }

+void
+nsWindow::DispatchContextMenuEventFromMouseEvent(uint16_t domButton,
+                                                 GdkEventButton *aEvent)
+{
+    if (domButton == WidgetMouseEvent::eRightButton && MOZ_LIKELY(!mIsDestroyed)) {
+        WidgetMouseEvent contextMenuEvent(true, eContextMenu, this,
+                                          WidgetMouseEvent::eReal);
+        InitButtonEvent(contextMenuEvent, aEvent);
+        contextMenuEvent.pressure = mLastMotionPressure;
+        DispatchInputEvent(&contextMenuEvent);
+    }
+}
+
 void
 nsWindow::OnButtonPressEvent(GdkEventButton *aEvent)
 {
@@ -2796,13 +2809,8 @@ nsWindow::OnButtonPressEvent(GdkEventButton *aEvent)
     DispatchInputEvent(&event);

     // right menu click on linux should also pop up a context menu
-    if (domButton == WidgetMouseEvent::eRightButton &&
-        MOZ_LIKELY(!mIsDestroyed)) {
-        WidgetMouseEvent contextMenuEvent(true, eContextMenu, this,
-                                          WidgetMouseEvent::eReal);
-        InitButtonEvent(contextMenuEvent, aEvent);
-        contextMenuEvent.pressure = mLastMotionPressure;
-        DispatchInputEvent(&contextMenuEvent);
+    if (!nsBaseWidget::ShowContextMenuAfterMouseUp()) {
+        DispatchContextMenuEventFromMouseEvent(domButton, aEvent);
     }
 }

@@ -2838,6 +2846,11 @@ nsWindow::OnButtonReleaseEvent(GdkEventButton *aEvent)

     DispatchInputEvent(&event);
     mLastMotionPressure = pressure;
+
+    // right menu click on linux should also pop up a context menu
+    if (nsBaseWidget::ShowContextMenuAfterMouseUp()) {
+        DispatchContextMenuEventFromMouseEvent(domButton, aEvent);
+    }
 }

 void
diff --git a/widget/gtk/nsWindow.h b/widget/gtk/nsWindow.h
index f7c07d57491b0b83..b969c9db4306ba6a 100644
--- a/widget/gtk/nsWindow.h
+++ b/widget/gtk/nsWindow.h
@@ -245,6 +245,8 @@ private:

     void               UpdateClientOffset();

+    void               DispatchContextMenuEventFromMouseEvent(uint16_t domButton,
+                                                              GdkEventButton *aEvent);
 public:
     void               ThemeChanged(void);
     void               OnDPIChanged(void);
diff --git a/widget/nsBaseWidget.cpp b/widget/nsBaseWidget.cpp
index 996409f45db11cc7..de73fe36d27955cd 100644
--- a/widget/nsBaseWidget.cpp
+++ b/widget/nsBaseWidget.cpp
@@ -1222,6 +1222,22 @@ nsBaseWidget::DispatchEventToAPZOnly(mozilla::WidgetInputEvent* aEvent)
   }
 }

+// static
+bool
+nsBaseWidget::ShowContextMenuAfterMouseUp()
+{
+  static bool gContextMenuAfterMouseUp = false;
+  static bool gContextMenuAfterMouseUpCached = false;
+  if (!gContextMenuAfterMouseUpCached) {
+    Preferences::AddBoolVarCache(&gContextMenuAfterMouseUp,
+                                 "ui.context_menus.after_mouseup",
+                                 false);
+
+    gContextMenuAfterMouseUpCached = true;
+  }
+  return gContextMenuAfterMouseUp;
+}
+
 nsIDocument*
 nsBaseWidget::GetDocument() const
 {
diff --git a/widget/nsBaseWidget.h b/widget/nsBaseWidget.h
index 6d6b93ea73d64b38..cdc6aa0c87279832 100644
--- a/widget/nsBaseWidget.h
+++ b/widget/nsBaseWidget.h
@@ -418,6 +418,12 @@ public:
   void RecvScreenPixels(mozilla::ipc::Shmem&& aMem, const ScreenIntSize& aSize) override {};
 #endif

+  /**
+   * Whether context menus should only appear on mouseup instead of mousedown,
+   * on OSes where they normally appear on mousedown (macOS, *nix).
+   */
+  static bool ShowContextMenuAfterMouseUp();
+
 protected:
   // These are methods for CompositorWidgetWrapper, and should only be
   // accessed from that class. Derived widgets can choose which methods to
--
2.15.1


code:
From 2874ecd82e9671f774bdfda41fe0857fcb916c13 Mon Sep 17 00:00:00 2001
Message-Id: <2874ecd82e9671f774bdfda41fe0857fcb916c13.1506634385.git.jan.steffens@gmail.com>
From: Mike Hommey <mh+mozilla@glandium.org>
Date: Wed, 16 Aug 2017 13:16:16 +0900
Subject: [PATCH] Bug 1384062 - Make SystemResourceMonitor.stop more resilient
 to errors. r=ahal,gps

The poll() call in SystemResourceMonitor.stop might fail even though
there is something to read from the pipe, in some corner cases, and
python won't let us know about it. In that case, an exception is thrown,
leaving the SystemResourceMonitor (and its callers) in a weird state. In
practice, this leads BuildMonitor.__exit__ to recall stop, which then
fails.

So when poll() throws an exception, we pretend there's still something
to read, and we try to read anyways. If there is something to read,
recv() will return it, otherwise, it will throw an exception of its own,
which we catch, pretending we're done.

Furthermore, when there is nothing to read from the pipe, poll() simply
returns False, and our loop never sets `done` to True, and we then hit
an assert, which doesn't have its place here, so we remove it.

Finally, the other end of the pipe might have died at any time, making
sending over the pipe fail, so we also protect against that.

With all these changes, it feels like the reason to backout bug 1239939
in bug 1272782 should have been dealt with, and we can drop the timeout
again.

--HG--
extra : rebase_source : ac72dd5b2602cf3ffddfb429f95e02380f939893
---
 .../mozsystemmonitor/resourcemonitor.py            | 38 +++++++++++++++-------
 1 file changed, 26 insertions(+), 12 deletions(-)

diff --git a/testing/mozbase/mozsystemmonitor/mozsystemmonitor/resourcemonitor.py b/testing/mozbase/mozsystemmonitor/mozsystemmonitor/resourcemonitor.py
index 8f2ac95cbe505540..38f9bc986ac2a120 100644
--- a/testing/mozbase/mozsystemmonitor/mozsystemmonitor/resourcemonitor.py
+++ b/testing/mozbase/mozsystemmonitor/mozsystemmonitor/resourcemonitor.py
@@ -289,47 +289,61 @@ class SystemResourceMonitor(object):
         assert self._running
         assert not self._stopped

-        self._pipe.send(('terminate',))
+        try:
+            self._pipe.send(('terminate',))
+        except Exception:
+            pass
         self._running = False
         self._stopped = True

         self.measurements = []

-        done = False
-
         # The child process will send each data sample over the pipe
         # as a separate data structure. When it has finished sending
         # samples, it sends a special "done" message to indicate it
         # is finished.
-        while self._pipe.poll(1.0):
-            start_time, end_time, io_diff, cpu_diff, cpu_percent, virt_mem, \
-                swap_mem = self._pipe.recv()
+
+        # multiprocessing.Pipe is not actually a pipe on at least Linux.  that
+        # has an effect on the expected outcome of reading from it when the
+        # other end of the pipe dies, leading to possibly hanging on revc()
+        # below. So we must poll().
+        def poll():
+            try:
+                return self._pipe.poll(0.1)
+            except Exception:
+                # Poll might throw an exception even though there's still
+                # data to read. That happens when the underlying system call
+                # returns both POLLERR and POLLIN, but python doesn't tell us
+                # about it. So assume there is something to read, and we'll
+                # get an exception when trying to read the data.
+                return True
+        while poll():
+            try:
+                start_time, end_time, io_diff, cpu_diff, cpu_percent, virt_mem, \
+                    swap_mem = self._pipe.recv()
+            except Exception:
+                # Let's assume we're done here
+                break

             # There should be nothing after the "done" message so
             # terminate.
             if start_time == 'done':
-                done = True
                 break

             io = self._io_type(*io_diff)
             virt = self._virt_type(*virt_mem)
             swap = self._swap_type(*swap_mem)
             cpu_times = [self._cpu_times_type(*v) for v in cpu_diff]

             self.measurements.append(SystemResourceUsage(start_time, end_time,
                                                          cpu_times, cpu_percent, io, virt, swap))

         # We establish a timeout so we don't hang forever if the child
         # process has crashed.
         self._process.join(10)
         if self._process.is_alive():
             self._process.terminate()
             self._process.join(10)
-        else:
-            # We should have received a "done" message from the
-            # child indicating it shut down properly. This only
-            # happens if the child shuts down cleanly.
-            assert done

         if len(self.measurements):
             self.start_time = self.measurements[0].start
--
2.14.2


code:
From f19a0f3bc5e1e87d3c663cc2b147c5c0831519c5 Mon Sep 17 00:00:00 2001
Message-Id: <f19a0f3bc5e1e87d3c663cc2b147c5c0831519c5.1512038840.git.jan.steffens@gmail.com>
In-Reply-To: <05ec1aa0d5e8806dd0c5c6d08c82846a1389b599.1512038840.git.jan.steffens@gmail.com>
References: <05ec1aa0d5e8806dd0c5c6d08c82846a1389b599.1512038840.git.jan.steffens@gmail.com>
From: Bob Silverberg <bsilverberg@mozilla.com>
Date: Fri, 24 Nov 2017 07:45:03 -0500
Subject: [PATCH 2/2] Bug 1419426 - Implement
 browserSettings.contextMenuShowEvent, r=kmag a=gchang

Uplift for 58.
---
 .../components/extensions/ext-browserSettings.js   | 45 ++++++++++++++++
 .../extensions/schemas/browser_settings.json       | 10 ++++
 .../test/xpcshell/test_ext_browserSettings.js      | 62 ++++++++++++++++++++--
 3 files changed, 114 insertions(+), 3 deletions(-)

diff --git a/toolkit/components/extensions/ext-browserSettings.js b/toolkit/components/extensions/ext-browserSettings.js
index f3212f351baf6975..2b24bcc1d09091f2 100644
--- a/toolkit/components/extensions/ext-browserSettings.js
+++ b/toolkit/components/extensions/ext-browserSettings.js
@@ -2,17 +2,23 @@
 /* vim: set sts=2 sw=2 et tw=80: */
 "use strict";

+XPCOMUtils.defineLazyModuleGetter(this, "AppConstants",
+                                  "resource://gre/modules/AppConstants.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "ExtensionSettingsStore",
                                   "resource://gre/modules/ExtensionSettingsStore.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "Services",
                                   "resource://gre/modules/Services.jsm");

 XPCOMUtils.defineLazyServiceGetter(this, "aboutNewTabService",
                                    "@mozilla.org/browser/aboutnewtab-service;1",
                                    "nsIAboutNewTabService");

 Cu.import("resource://gre/modules/ExtensionPreferencesManager.jsm");

+var {
+  ExtensionError,
+} = ExtensionUtils;
+
 const HOMEPAGE_OVERRIDE_SETTING = "homepage_override";
 const HOMEPAGE_URL_PREF = "browser.startup.homepage";
 const URL_STORE_TYPE = "url_overrides";
@@ -82,6 +88,16 @@ ExtensionPreferencesManager.addSetting("imageAnimationBehavior", {
   },
 });

+ExtensionPreferencesManager.addSetting("contextMenuShowEvent", {
+  prefNames: [
+    "ui.context_menus.after_mouseup",
+  ],
+
+  setCallback(value) {
+    return {[this.prefNames[0]]: value === "mouseup"};
+  },
+});
+
 this.browserSettings = class extends ExtensionAPI {
   getAPI(context) {
     let {extension} = context;
@@ -114,6 +130,35 @@ this.browserSettings = class extends ExtensionAPI {
           () => {
             return aboutNewTabService.newTabURL;
           }, URL_STORE_TYPE, true),
+        contextMenuShowEvent: Object.assign(
+          getSettingsAPI(
+            extension,
+            "contextMenuShowEvent",
+            () => {
+              if (AppConstants.platform === "win") {
+                return "mouseup";
+              }
+              let prefValue = Services.prefs.getBoolPref(
+                "ui.context_menus.after_mouseup", null);
+              return prefValue ? "mouseup" : "mousedown";
+            }
+          ),
+          {
+            set: details => {
+              if (!["mouseup", "mousedown"].includes(details.value)) {
+                throw new ExtensionError(
+                  `${details.value} is not a valid value for contextMenuShowEvent.`);
+              }
+              if (AppConstants.platform === "android" ||
+                  (AppConstants.platform === "win" &&
+                   details.value === "mousedown")) {
+                return false;
+              }
+              return ExtensionPreferencesManager.setSetting(
+                extension, "contextMenuShowEvent", details.value);
+            },
+          }
+        ),
       },
     };
   }
diff --git a/toolkit/components/extensions/schemas/browser_settings.json b/toolkit/components/extensions/schemas/browser_settings.json
index af073d933723cbd5..4f354e69dfedaf96 100644
--- a/toolkit/components/extensions/schemas/browser_settings.json
+++ b/toolkit/components/extensions/schemas/browser_settings.json
@@ -27,28 +27,38 @@
         "type": "string",
         "enum": ["normal", "none", "once"],
         "description": "How images should be animated in the browser."
+      },
+      {
+        "id": "ContextMenuMouseEvent",
+        "type": "string",
+        "enum": ["mouseup", "mousedown"],
+        "description": "After which mouse event context menus should popup."
       }
     ],
     "properties": {
       "allowPopupsForUserEvents": {
         "$ref": "types.Setting",
         "description": "Allows or disallows pop-up windows from opening in response to user events."
       },
       "cacheEnabled": {
         "$ref": "types.Setting",
         "description": "Enables or disables the browser cache."
       },
       "homepageOverride": {
         "$ref": "types.Setting",
         "description": "Returns the value of the overridden home page. Read-only."
       },
       "imageAnimationBehavior": {
         "$ref": "types.Setting",
         "description": "Controls the behaviour of image animation in the browser. This setting's value is of type ImageAnimationBehavior, defaulting to normal."
       },
       "newTabPageOverride": {
         "$ref": "types.Setting",
         "description": "Returns the value of the overridden new tab page. Read-only."
+      },
+      "contextMenuShowEvent": {
+        "$ref": "types.Setting",
+        "description": "Controls after which mouse event context menus popup. This setting's value is of type ContextMenuMouseEvent, which has possible values of mouseup and mousedown."
       }
     }
   }
diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_browserSettings.js b/toolkit/components/extensions/test/xpcshell/test_ext_browserSettings.js
index 5c441df3e4198671..7e9c1576a723dfc6 100644
--- a/toolkit/components/extensions/test/xpcshell/test_ext_browserSettings.js
+++ b/toolkit/components/extensions/test/xpcshell/test_ext_browserSettings.js
@@ -24,13 +24,20 @@ add_task(async function test_browser_settings() {
     "browser.cache.memory.enable": true,
     "dom.popup_allowed_events": Preferences.get("dom.popup_allowed_events"),
     "image.animation_mode": "none",
+    "ui.context_menus.after_mouseup": false,
   };

   async function background() {
     browser.test.onMessage.addListener(async (msg, apiName, value) => {
       let apiObj = browser.browserSettings[apiName];
-      await apiObj.set({value});
-      browser.test.sendMessage("settingData", await apiObj.get({}));
+      let result = await apiObj.set({value});
+      if (msg === "set") {
+        browser.test.assertTrue(result, "set returns true.");
+        browser.test.sendMessage("settingData", await apiObj.get({}));
+      } else {
+        browser.test.assertFalse(result, "set returns false for a no-op.");
+        browser.test.sendMessage("no-op set");
+      }
     });
   }

@@ -69,33 +76,82 @@ add_task(async function test_browser_settings() {
     }
   }

+  async function testNoOpSetting(setting, value, expected) {
+    extension.sendMessage("setNoOp", setting, value);
+    await extension.awaitMessage("no-op set");
+    for (let pref in expected) {
+      equal(Preferences.get(pref), expected[pref], `${pref} set correctly for ${value}`);
+    }
+  }
+
   await testSetting(
     "cacheEnabled", false,
     {
       "browser.cache.disk.enable": false,
       "browser.cache.memory.enable": false,
     });
   await testSetting(
     "cacheEnabled", true,
     {
       "browser.cache.disk.enable": true,
       "browser.cache.memory.enable": true,
     });

   await testSetting(
     "allowPopupsForUserEvents", false,
     {"dom.popup_allowed_events": ""});
   await testSetting(
     "allowPopupsForUserEvents", true,
     {"dom.popup_allowed_events": PREFS["dom.popup_allowed_events"]});

   for (let value of ["normal", "none", "once"]) {
     await testSetting(
       "imageAnimationBehavior", value,
       {"image.animation_mode": value});
   }

-  await extension.unload();
+  // This setting is a no-op on Android.
+  if (AppConstants.platform === "android") {
+    await testNoOpSetting("contextMenuShowEvent", "mouseup",
+      {"ui.context_menus.after_mouseup": false});
+  } else {
+    await testSetting(
+      "contextMenuShowEvent", "mouseup",
+      {"ui.context_menus.after_mouseup": true});
+  }

+  // "mousedown" is also a no-op on Windows.
+  if (["android", "win"].includes(AppConstants.platform)) {
+    await testNoOpSetting("contextMenuShowEvent", "mousedown",
+      {"ui.context_menus.after_mouseup": AppConstants.platform === "win"});
+  } else {
+    await testSetting(
+      "contextMenuShowEvent", "mousedown",
+      {"ui.context_menus.after_mouseup": false});
+  }
+
+  await extension.unload();
   await promiseShutdownManager();
 });
+
+add_task(async function test_bad_value() {
+  async function background() {
+    await browser.test.assertRejects(
+      browser.browserSettings.contextMenuShowEvent.set({value: "bad"}),
+      /bad is not a valid value for contextMenuShowEvent/,
+      "contextMenuShowEvent.set rejects with an invalid value.");
+
+    browser.test.sendMessage("done");
+  }
+
+  let extension = ExtensionTestUtils.loadExtension({
+    background,
+    manifest: {
+      permissions: ["browserSettings"],
+    },
+  });
+
+  await extension.startup();
+  await extension.awaitMessage("done");
+  await extension.unload();
+});
--
2.15.1


code:
diff --git i/config/baseconfig.mk w/config/baseconfig.mk
index e204533ac9b66b88..27ae154ce265ca2b 100644
--- i/config/baseconfig.mk
+++ w/config/baseconfig.mk
@@ -4,7 +4,7 @@
 # whether a normal build is happening or whether the check is running.
 includedir := $(includedir)/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
 idldir = $(datadir)/idl/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
-installdir = $(libdir)/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
+installdir = $(libdir)/$(MOZ_APP_NAME)
 sdkdir = $(libdir)/$(MOZ_APP_NAME)-devel-$(MOZ_APP_VERSION)
 ifeq (.,$(DEPTH))
 DIST = dist


code:
From 6a0b7c8ecf0734ba1bcdccf8e0ee97e721fd5420 Mon Sep 17 00:00:00 2001
Message-Id: <6a0b7c8ecf0734ba1bcdccf8e0ee97e721fd5420.1505113337.git.jan.steffens@gmail.com>
From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= <emilio@crisal.io>
Date: Sat, 19 Aug 2017 20:14:25 +0200
Subject: [PATCH] Fix use of struct ucontext (squash 2 commits)

Needed for building with glibc 2.26.

Bug 1385667: Use ucontext_t consistently in breakpad-client. r=ted
MozReview-Commit-ID: AJhzJdNXP0f

Bug 1394149: Fix remaining uses of ucontext in breakpad-client. r=ted
MozReview-Commit-ID: 5tP7fXsI7dQ
---
 .../linux/dump_writer_common/ucontext_reader.cc    | 30 +++++++++++-----------
 .../linux/dump_writer_common/ucontext_reader.h     | 10 ++++----
 .../linux/handler/exception_handler.cc             | 10 ++++----
 .../linux/handler/exception_handler.h              |  2 +-
 .../linux/microdump_writer/microdump_writer.cc     |  2 +-
 .../linux/minidump_writer/minidump_writer.cc       |  2 +-
 6 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/toolkit/crashreporter/breakpad-client/linux/dump_writer_common/ucontext_reader.cc b/toolkit/crashreporter/breakpad-client/linux/dump_writer_common/ucontext_reader.cc
index 999960912e459e1b..303c0ebd32b663c4 100644
--- a/toolkit/crashreporter/breakpad-client/linux/dump_writer_common/ucontext_reader.cc
+++ b/toolkit/crashreporter/breakpad-client/linux/dump_writer_common/ucontext_reader.cc
@@ -40,15 +40,15 @@ namespace google_breakpad {

 #if defined(__i386__)

-uintptr_t UContextReader::GetStackPointer(const struct ucontext* uc) {
+uintptr_t UContextReader::GetStackPointer(const ucontext_t* uc) {
   return uc->uc_mcontext.gregs[REG_ESP];
 }

-uintptr_t UContextReader::GetInstructionPointer(const struct ucontext* uc) {
+uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) {
   return uc->uc_mcontext.gregs[REG_EIP];
 }

-void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext *uc,
+void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc,
                                     const struct _libc_fpstate* fp) {
   const greg_t* regs = uc->uc_mcontext.gregs;

@@ -88,15 +88,15 @@ void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext *uc,

 #elif defined(__x86_64)

-uintptr_t UContextReader::GetStackPointer(const struct ucontext* uc) {
+uintptr_t UContextReader::GetStackPointer(const ucontext_t* uc) {
   return uc->uc_mcontext.gregs[REG_RSP];
 }

-uintptr_t UContextReader::GetInstructionPointer(const struct ucontext* uc) {
+uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) {
   return uc->uc_mcontext.gregs[REG_RIP];
 }

-void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext *uc,
+void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc,
                                     const struct _libc_fpstate* fpregs) {
   const greg_t* regs = uc->uc_mcontext.gregs;

@@ -145,15 +145,15 @@ void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext *uc,

 #elif defined(__ARM_EABI__)

-uintptr_t UContextReader::GetStackPointer(const struct ucontext* uc) {
+uintptr_t UContextReader::GetStackPointer(const ucontext_t* uc) {
   return uc->uc_mcontext.arm_sp;
 }

-uintptr_t UContextReader::GetInstructionPointer(const struct ucontext* uc) {
+uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) {
   return uc->uc_mcontext.arm_pc;
 }

-void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext *uc) {
+void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc) {
   out->context_flags = MD_CONTEXT_ARM_FULL;

   out->iregs[0] = uc->uc_mcontext.arm_r0;
@@ -184,41 +184,41 @@ void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext *uc) {

 #elif defined(__aarch64__)

-uintptr_t UContextReader::GetStackPointer(const struct ucontext* uc) {
+uintptr_t UContextReader::GetStackPointer(const ucontext_t* uc) {
   return uc->uc_mcontext.sp;
 }

-uintptr_t UContextReader::GetInstructionPointer(const struct ucontext* uc) {
+uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) {
   return uc->uc_mcontext.pc;
 }

-void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext *uc,
+void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc,
                                     const struct fpsimd_context* fpregs) {
   out->context_flags = MD_CONTEXT_ARM64_FULL;

   out->cpsr = static_cast<uint32_t>(uc->uc_mcontext.pstate);
   for (int i = 0; i < MD_CONTEXT_ARM64_REG_SP; ++i)
     out->iregs[i] = uc->uc_mcontext.regs[i];
   out->iregs[MD_CONTEXT_ARM64_REG_SP] = uc->uc_mcontext.sp;
   out->iregs[MD_CONTEXT_ARM64_REG_PC] = uc->uc_mcontext.pc;

   out->float_save.fpsr = fpregs->fpsr;
   out->float_save.fpcr = fpregs->fpcr;
   my_memcpy(&out->float_save.regs, &fpregs->vregs,
       MD_FLOATINGSAVEAREA_ARM64_FPR_COUNT * 16);
 }

 #elif defined(__mips__)

-uintptr_t UContextReader::GetStackPointer(const struct ucontext* uc) {
+uintptr_t UContextReader::GetStackPointer(const ucontext_t* uc) {
   return uc->uc_mcontext.gregs[MD_CONTEXT_MIPS_REG_SP];
 }

-uintptr_t UContextReader::GetInstructionPointer(const struct ucontext* uc) {
+uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) {
   return uc->uc_mcontext.pc;
 }

-void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext *uc) {
+void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc) {
 #if _MIPS_SIM == _ABI64
   out->context_flags = MD_CONTEXT_MIPS64_FULL;
 #elif _MIPS_SIM == _ABIO32
diff --git a/toolkit/crashreporter/breakpad-client/linux/dump_writer_common/ucontext_reader.h b/toolkit/crashreporter/breakpad-client/linux/dump_writer_common/ucontext_reader.h
index c533e28ba7441e83..039752a2dfb6e589 100644
--- a/toolkit/crashreporter/breakpad-client/linux/dump_writer_common/ucontext_reader.h
+++ b/toolkit/crashreporter/breakpad-client/linux/dump_writer_common/ucontext_reader.h
@@ -41,21 +41,21 @@ namespace google_breakpad {

 // Wraps platform-dependent implementations of accessors to ucontext structs.
 struct UContextReader {
-  static uintptr_t GetStackPointer(const struct ucontext* uc);
+  static uintptr_t GetStackPointer(const ucontext_t* uc);

-  static uintptr_t GetInstructionPointer(const struct ucontext* uc);
+  static uintptr_t GetInstructionPointer(const ucontext_t* uc);

   // Juggle a arch-specific ucontext into a minidump format
   //   out: the minidump structure
   //   info: the collection of register structures.
 #if defined(__i386__) || defined(__x86_64)
-  static void FillCPUContext(RawContextCPU *out, const ucontext *uc,
+  static void FillCPUContext(RawContextCPU *out, const ucontext_t *uc,
                              const struct _libc_fpstate* fp);
 #elif defined(__aarch64__)
-  static void FillCPUContext(RawContextCPU *out, const ucontext *uc,
+  static void FillCPUContext(RawContextCPU *out, const ucontext_t *uc,
                              const struct fpsimd_context* fpregs);
 #else
-  static void FillCPUContext(RawContextCPU *out, const ucontext *uc);
+  static void FillCPUContext(RawContextCPU *out, const ucontext_t *uc);
 #endif
 };

diff --git a/toolkit/crashreporter/breakpad-client/linux/handler/exception_handler.cc b/toolkit/crashreporter/breakpad-client/linux/handler/exception_handler.cc
index 71a51a763938e39d..12df9bc96ec45fea 100644
--- a/toolkit/crashreporter/breakpad-client/linux/handler/exception_handler.cc
+++ b/toolkit/crashreporter/breakpad-client/linux/handler/exception_handler.cc
@@ -439,44 +439,44 @@ bool ExceptionHandler::HandleSignal(int sig, siginfo_t* info, void* uc) {
   // Fill in all the holes in the struct to make Valgrind happy.
   memset(&g_crash_context_, 0, sizeof(g_crash_context_));
   memcpy(&g_crash_context_.siginfo, info, sizeof(siginfo_t));
-  memcpy(&g_crash_context_.context, uc, sizeof(struct ucontext));
+  memcpy(&g_crash_context_.context, uc, sizeof(ucontext_t));
 #if defined(__aarch64__)
-  struct ucontext* uc_ptr = (struct ucontext*)uc;
+  ucontext_t* uc_ptr = (ucontext_t*)uc;
   struct fpsimd_context* fp_ptr =
       (struct fpsimd_context*)&uc_ptr->uc_mcontext.__reserved;
   if (fp_ptr->head.magic == FPSIMD_MAGIC) {
     memcpy(&g_crash_context_.float_state, fp_ptr,
            sizeof(g_crash_context_.float_state));
   }
 #elif !defined(__ARM_EABI__) && !defined(__mips__)
   // FP state is not part of user ABI on ARM Linux.
-  // In case of MIPS Linux FP state is already part of struct ucontext
+  // In case of MIPS Linux FP state is already part of ucontext_t
   // and 'float_state' is not a member of CrashContext.
-  struct ucontext* uc_ptr = (struct ucontext*)uc;
+  ucontext_t* uc_ptr = (ucontext_t*)uc;
   if (uc_ptr->uc_mcontext.fpregs) {
     memcpy(&g_crash_context_.float_state, uc_ptr->uc_mcontext.fpregs,
            sizeof(g_crash_context_.float_state));
   }
 #endif
   g_crash_context_.tid = syscall(__NR_gettid);
   if (crash_handler_ != NULL) {
     if (crash_handler_(&g_crash_context_, sizeof(g_crash_context_),
                        callback_context_)) {
       return true;
     }
   }
   return GenerateDump(&g_crash_context_);
 }

 // This is a public interface to HandleSignal that allows the client to
 // generate a crash dump. This function may run in a compromised context.
 bool ExceptionHandler::SimulateSignalDelivery(int sig) {
   siginfo_t siginfo = {};
   // Mimic a trusted signal to allow tracing the process (see
   // ExceptionHandler::HandleSignal().
   siginfo.si_code = SI_USER;
   siginfo.si_pid = getpid();
-  struct ucontext context;
+  ucontext_t context;
   getcontext(&context);
   return HandleSignal(sig, &siginfo, &context);
 }
diff --git a/toolkit/crashreporter/breakpad-client/linux/handler/exception_handler.h b/toolkit/crashreporter/breakpad-client/linux/handler/exception_handler.h
index 711586fec7ddae59..be1880170e2826b0 100644
--- a/toolkit/crashreporter/breakpad-client/linux/handler/exception_handler.h
+++ b/toolkit/crashreporter/breakpad-client/linux/handler/exception_handler.h
@@ -191,7 +191,7 @@ class ExceptionHandler {
   struct CrashContext {
     siginfo_t siginfo;
     pid_t tid;  // the crashing thread.
-    struct ucontext context;
+    ucontext_t context;
 #if !defined(__ARM_EABI__) && !defined(__mips__)
     // #ifdef this out because FP state is not part of user ABI for Linux ARM.
     // In case of MIPS Linux FP state is already part of struct
diff --git a/toolkit/crashreporter/breakpad-client/linux/microdump_writer/microdump_writer.cc b/toolkit/crashreporter/breakpad-client/linux/microdump_writer/microdump_writer.cc
index ff20bf36584c876b..a0b90e08fc5f0cff 100644
--- a/toolkit/crashreporter/breakpad-client/linux/microdump_writer/microdump_writer.cc
+++ b/toolkit/crashreporter/breakpad-client/linux/microdump_writer/microdump_writer.cc
@@ -571,7 +571,7 @@ class MicrodumpWriter {

   void* Alloc(unsigned bytes) { return dumper_->allocator()->Alloc(bytes); }

-  const struct ucontext* const ucontext_;
+  const ucontext_t* const ucontext_;
 #if !defined(__ARM_EABI__) && !defined(__mips__)
   const google_breakpad::fpstate_t* const float_state_;
 #endif
diff --git a/toolkit/crashreporter/breakpad-client/linux/minidump_writer/minidump_writer.cc b/toolkit/crashreporter/breakpad-client/linux/minidump_writer/minidump_writer.cc
index 0650bb95c179464a..6b5304bcd605ca3a 100644
--- a/toolkit/crashreporter/breakpad-client/linux/minidump_writer/minidump_writer.cc
+++ b/toolkit/crashreporter/breakpad-client/linux/minidump_writer/minidump_writer.cc
@@ -1247,7 +1247,7 @@ class MinidumpWriter {
   const int fd_;  // File descriptor where the minidum should be written.
   const char* path_;  // Path to the file where the minidum should be written.

-  const struct ucontext* const ucontext_;  // also from the signal handler
+  const ucontext_t* const ucontext_;  // also from the signal handler
 #if !defined(__ARM_EABI__) && !defined(__mips__)
   const google_breakpad::fpstate_t* const float_state_;  // ditto
 #endif
--
2.14.1