Merge inbound to mozilla-central. a=merge
authorBrindusan Cristian <cbrindusan@mozilla.com>
Tue, 19 Feb 2019 06:38:36 +0200
changeset 459831 ee6e77950205a7ce94a0caf3a1bffdc2cd3540a9
parent 459821 8231f78228bc6336b3bacefbfe004d4640cb56a2 (current diff)
parent 459830 0daaf4ad964578e532cc798f03359a932074eccc (diff)
child 459833 a42ee9783546fa9282fdf98c11a93f6df4964c4b
child 459887 7fc33c7516c3854f037b89911caeddad781c57f5
push id35575
push usercbrindusan@mozilla.com
push dateTue, 19 Feb 2019 04:40:03 +0000
treeherdermozilla-central@ee6e77950205 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Merge inbound to mozilla-central. a=merge
testing/web-platform/meta/css/css-sizing/range-percent-intrinsic-size-2.html.ini
--- a/browser/components/enterprisepolicies/content/aboutPolicies.css
+++ b/browser/components/enterprisepolicies/content/aboutPolicies.css
@@ -142,8 +142,29 @@ tbody.collapsible td {
   padding-bottom: 1rem;
 }
 
 .schema {
   font-family: monospace;
   white-space: pre;
   direction: ltr;
 }
+
+/*
+ * The Active tab has two messages: one for when the policy service
+ * is inactive and another for when the there are no specified
+ * policies. The three classes below control which message to display
+ * or to show the policy table.
+ */
+.no-specified-policies > table,
+.inactive-service > table {
+  display: none;
+}
+
+:not(.no-specified-policies) > .no-specified-policies-message,
+:not(.inactive-service) > .inactive-service-message {
+  display: none;
+}
+
+.no-specified-policies-message,
+.inactive-service-message {
+  padding: 1rem;
+}
--- a/browser/components/enterprisepolicies/content/aboutPolicies.js
+++ b/browser/components/enterprisepolicies/content/aboutPolicies.js
@@ -86,16 +86,25 @@ function generateActivePolicies(data) {
       let row = document.createElement("tr");
       row.appendChild(col(policyName));
       row.appendChild(col(JSON.stringify(data[policyName])));
       row.classList.add(color_class, "last_row");
       new_cont.appendChild(row);
     }
   }
 
+  if (policy_count < 1) {
+    let current_tab = document.querySelector(".active");
+    if (Services.policies.status == Services.policies.ACTIVE) {
+      current_tab.classList.add("no-specified-policies");
+    } else {
+      current_tab.classList.add("inactive-service");
+    }
+  }
+
   addMissingColumns();
 }
 
 /*
  * This is a helper recursive function that iterates levels of each
  * policy and formats the content to be displayed accordingly.
  */
 
@@ -201,17 +210,16 @@ function generateErrors() {
   for (let err of consoleEvents) {
     if (prefixes.includes(err.prefix)) {
       flag = true;
       let row = document.createElement("tr");
       row.appendChild(col(err.arguments[0]));
       new_cont.appendChild(row);
     }
   }
-
   if (!flag) {
     let errors_tab = document.getElementById("category-errors");
     errors_tab.style.display = "none";
   }
 }
 
 function generateDocumentation() {
   let new_cont = document.getElementById("documentationContent");
--- a/browser/components/enterprisepolicies/content/aboutPolicies.xhtml
+++ b/browser/components/enterprisepolicies/content/aboutPolicies.xhtml
@@ -32,16 +32,18 @@
             </div>
         </div>
         <div class="main-content">
             <div class="header">
                 <div id="sectionTitle" class="header-name" data-l10n-id="active-policies-tab"/>
             </div>
 
             <div id="active" class="tab active">
+                <h3 class="inactive-service-message" data-l10n-id="inactive-message"></h3>
+                <h3 class="no-specified-policies-message" data-l10n-id="no-specified-policies-message"></h3>
                 <table>
                     <thead>
                         <tr>
                             <th data-l10n-id="policy-name"/>
                             <th data-l10n-id="policy-value"/>
                         </tr>
                     </thead>
                     <tbody id="activeContent" />
--- a/browser/locales/en-US/browser/aboutPolicies.ftl
+++ b/browser/locales/en-US/browser/aboutPolicies.ftl
@@ -4,11 +4,14 @@
 
 about-policies-title = Enterprise Policies
 
 # 'Active' is used to describe the policies that are currently active
 active-policies-tab = Active
 errors-tab = Errors
 documentation-tab = Documentation
 
+no-specified-policies-message = The Enterprise Policies service is active but there are no policies enabled.
+inactive-message = The Enterprise Policies service is inactive.
+
 policy-name = Policy Name
 policy-value = Policy Value
 policy-errors = Policy Errors
--- a/dom/media/VideoFrameContainer.cpp
+++ b/dom/media/VideoFrameContainer.cpp
@@ -75,26 +75,26 @@ void VideoFrameContainer::UpdatePrincipa
     const ImageContainer::FrameID& aFrameID) {
   if (mPendingPrincipalHandle == aPrincipalHandle) {
     return;
   }
   mPendingPrincipalHandle = aPrincipalHandle;
   mFrameIDForPendingPrincipalHandle = aFrameID;
 }
 
-static void SetImageToBlackPixel(PlanarYCbCrImage* aImage) {
+static bool SetImageToBlackPixel(PlanarYCbCrImage* aImage) {
   uint8_t blackPixel[] = {0x10, 0x80, 0x80};
 
   PlanarYCbCrData data;
   data.mYChannel = blackPixel;
   data.mCbChannel = blackPixel + 1;
   data.mCrChannel = blackPixel + 2;
   data.mYStride = data.mCbCrStride = 1;
   data.mPicSize = data.mYSize = data.mCbCrSize = gfx::IntSize(1, 1);
-  aImage->CopyData(data);
+  return aImage->CopyData(data);
 }
 
 class VideoFrameContainerInvalidateRunnable : public Runnable {
  public:
   explicit VideoFrameContainerInvalidateRunnable(
       VideoFrameContainer* aVideoFrameContainer)
       : Runnable("VideoFrameContainerInvalidateRunnable"),
         mVideoFrameContainer(aVideoFrameContainer) {}
@@ -137,21 +137,23 @@ void VideoFrameContainer::SetCurrentFram
     Image* image = frame->GetImage();
     CONTAINER_LOG(
         LogLevel::Verbose,
         ("VideoFrameContainer %p writing video frame %p (%d x %d)", this, image,
          frame->GetIntrinsicSize().width, frame->GetIntrinsicSize().height));
 
     if (frame->GetForceBlack()) {
       if (!mBlackImage) {
-        mBlackImage = GetImageContainer()->CreatePlanarYCbCrImage();
-        if (mBlackImage) {
+        RefPtr<Image> blackImage = GetImageContainer()->CreatePlanarYCbCrImage();
+        if (blackImage) {
           // Sets the image to a single black pixel, which will be scaled to
           // fill the rendered size.
-          SetImageToBlackPixel(mBlackImage->AsPlanarYCbCrImage());
+          if (SetImageToBlackPixel(blackImage->AsPlanarYCbCrImage())) {
+            mBlackImage = blackImage;
+          }
         }
       }
       if (mBlackImage) {
         image = mBlackImage;
       }
     }
     // Don't append null image to the newImages.
     if (!image) {
--- a/dom/media/ipc/RemoteVideoDecoder.cpp
+++ b/dom/media/ipc/RemoteVideoDecoder.cpp
@@ -59,29 +59,34 @@ RefPtr<mozilla::layers::Image> RemoteVid
   pData.mYUVColorSpace = descriptor.yUVColorSpace();
   pData.mYChannel = ImageDataSerializer::GetYChannel(buffer, descriptor);
   pData.mCbChannel = ImageDataSerializer::GetCbChannel(buffer, descriptor);
   pData.mCrChannel = ImageDataSerializer::GetCrChannel(buffer, descriptor);
 
   // images coming from AOMDecoder are RecyclingPlanarYCbCrImages.
   RefPtr<RecyclingPlanarYCbCrImage> image =
       new RecyclingPlanarYCbCrImage(mBufferRecycleBin);
-  image->CopyData(pData);
+  bool setData = image->CopyData(pData);
+  MOZ_ASSERT(setData);
 
   switch (memOrShmem.type()) {
     case MemoryOrShmem::Tuintptr_t:
       delete[] reinterpret_cast<uint8_t*>(memOrShmem.get_uintptr_t());
       break;
     case MemoryOrShmem::TShmem:
       DeallocShmem(memOrShmem.get_Shmem());
       break;
     default:
       MOZ_ASSERT(false, "Unknown MemoryOrShmem type");
   }
 
+  if (!setData) {
+    return nullptr;
+  }
+
   return image;
 }
 
 mozilla::ipc::IPCResult RemoteVideoDecoderChild::RecvOutput(
     const DecodedOutputIPDL& aDecodedData) {
   AssertOnManagerThread();
   MOZ_ASSERT(aDecodedData.type() == DecodedOutputIPDL::TRemoteVideoDataIPDL);
   const RemoteVideoDataIPDL& aData = aDecodedData.get_RemoteVideoDataIPDL();
--- a/js/src/wasm/AsmJS.cpp
+++ b/js/src/wasm/AsmJS.cpp
@@ -2069,17 +2069,17 @@ class MOZ_STACK_CLASS JS_HAZ_ROOTED Modu
   }
 
   // Error handling.
   bool failCurrentOffset(const char* str) {
     return failOffset(tokenStream().anyCharsAccess().currentToken().pos.begin,
                       str);
   }
 
-  SharedModule finish(UniqueLinkData* linkData) {
+  SharedModule finish() {
     MOZ_ASSERT(env_.funcTypes.empty());
     if (!env_.funcTypes.resize(funcImportMap_.count() + funcDefs_.length())) {
       return nullptr;
     }
     for (FuncImportMap::Range r = funcImportMap_.all(); !r.empty();
          r.popFront()) {
       uint32_t funcIndex = r.front().value();
       MOZ_ASSERT(!env_.funcTypes[funcIndex]);
@@ -2162,17 +2162,17 @@ class MOZ_STACK_CLASS JS_HAZ_ROOTED Modu
         return nullptr;
       }
     }
 
     if (!mg.finishFuncDefs()) {
       return nullptr;
     }
 
-    return mg.finishModule(*bytes, nullptr, linkData);
+    return mg.finishModule(*bytes);
   }
 };
 
 /*****************************************************************************/
 // Numeric literal utilities
 
 static bool IsNumericNonFloatLiteral(ParseNode* pn) {
   // Note: '-' is never rolled into the number; numbers are always positive
@@ -6345,18 +6345,17 @@ static bool CheckModuleEnd(ModuleValidat
   }
 
   m.parser().tokenStream.anyCharsAccess().ungetToken();
   return true;
 }
 
 template <typename Unit>
 static SharedModule CheckModule(JSContext* cx, AsmJSParser<Unit>& parser,
-                                ParseNode* stmtList, UniqueLinkData* linkData,
-                                unsigned* time) {
+                                ParseNode* stmtList, unsigned* time) {
   int64_t before = PRMJ_Now();
 
   FunctionNode* moduleFunctionNode = parser.pc->functionBox()->functionNode;
 
   ModuleValidator<Unit> m(cx, parser, moduleFunctionNode);
   if (!m.init()) {
     return nullptr;
   }
@@ -6396,17 +6395,17 @@ static SharedModule CheckModule(JSContex
   if (!CheckModuleReturn(m)) {
     return nullptr;
   }
 
   if (!CheckModuleEnd(m)) {
     return nullptr;
   }
 
-  SharedModule module = m.finish(linkData);
+  SharedModule module = m.finish();
   if (!module) {
     return nullptr;
   }
 
   *time = (PRMJ_Now() - before) / PRMJ_USEC_PER_MSEC;
   return module;
 }
 
@@ -7063,28 +7062,22 @@ static bool DoCompileAsmJS(JSContext* cx
                            ParseNode* stmtList, bool* validated) {
   *validated = false;
 
   // Various conditions disable asm.js optimizations.
   if (!EstablishPreconditions(cx, parser)) {
     return NoExceptionPending(cx);
   }
 
-  // Validate and generate code in a single linear pass over the chars of the
-  // asm.js module.
-  SharedModule module;
+  // "Checking" parses, validates and compiles, producing a fully compiled
+  // WasmModuleObject as result.
   unsigned time;
-  {
-    // "Checking" parses, validates and compiles, producing a fully compiled
-    // WasmModuleObject as result.
-    UniqueLinkData linkData;
-    module = CheckModule(cx, parser, stmtList, &linkData, &time);
-    if (!module) {
-      return NoExceptionPending(cx);
-    }
+  SharedModule module = CheckModule(cx, parser, stmtList, &time);
+  if (!module) {
+    return NoExceptionPending(cx);
   }
 
   // Hand over ownership to a GC object wrapper which can then be referenced
   // from the module function.
   Rooted<WasmModuleObject*> moduleObj(cx,
                                       WasmModuleObject::create(cx, *module));
   if (!moduleObj) {
     return false;
--- a/js/src/wasm/WasmCompile.cpp
+++ b/js/src/wasm/WasmCompile.cpp
@@ -546,17 +546,17 @@ static bool DecodeCodeSection(const Modu
 
   return mg.finishFuncDefs();
 }
 
 SharedModule wasm::CompileBuffer(const CompileArgs& args,
                                  const ShareableBytes& bytecode,
                                  UniqueChars* error,
                                  UniqueCharsVector* warnings,
-                                 UniqueLinkData* maybeLinkData) {
+                                 JS::OptimizedEncodingListener* listener) {
   Decoder d(bytecode.bytes, 0, error, warnings);
 
   CompilerEnvironment compilerEnv(args);
   ModuleEnvironment env(
       args.gcEnabled, &compilerEnv,
       args.sharedMemoryEnabled ? Shareable::True : Shareable::False);
   if (!DecodeModuleEnvironment(d, &env)) {
     return nullptr;
@@ -570,17 +570,17 @@ SharedModule wasm::CompileBuffer(const C
   if (!DecodeCodeSection(env, d, mg)) {
     return nullptr;
   }
 
   if (!DecodeModuleTail(d, &env)) {
     return nullptr;
   }
 
-  return mg.finishModule(bytecode, nullptr, maybeLinkData);
+  return mg.finishModule(bytecode, listener);
 }
 
 void wasm::CompileTier2(const CompileArgs& args, const Bytes& bytecode,
                         const Module& module, Atomic<bool>* cancelled) {
   UniqueChars error;
   Decoder d(bytecode, 0, &error);
 
   bool gcTypesConfigured = false;  // No optimized backend support yet
--- a/js/src/wasm/WasmCompile.h
+++ b/js/src/wasm/WasmCompile.h
@@ -90,17 +90,17 @@ double EstimateCompiledCodeSize(Tier tie
 // wasm::Module. On success, the Module is returned. On failure, the returned
 // SharedModule pointer is null and either:
 //  - *error points to a string description of the error
 //  - *error is null and the caller should report out-of-memory.
 
 SharedModule CompileBuffer(const CompileArgs& args,
                            const ShareableBytes& bytecode, UniqueChars* error,
                            UniqueCharsVector* warnings,
-                           UniqueLinkData* maybeLinkData = nullptr);
+                           JS::OptimizedEncodingListener* listener = nullptr);
 
 // Attempt to compile the second tier of the given wasm::Module.
 
 void CompileTier2(const CompileArgs& args, const Bytes& bytecode,
                   const Module& module, Atomic<bool>* cancelled);
 
 // Compile the given WebAssembly module which has been broken into three
 // partitions:
--- a/js/src/wasm/WasmGenerator.cpp
+++ b/js/src/wasm/WasmGenerator.cpp
@@ -1089,18 +1089,17 @@ SharedMetadata ModuleGenerator::finishMe
   // Metadata shouldn't be mutably modified after finishMetadata().
   SharedMetadata metadata = metadata_;
   metadata_ = nullptr;
   return metadata;
 }
 
 SharedModule ModuleGenerator::finishModule(
     const ShareableBytes& bytecode,
-    JS::OptimizedEncodingListener* maybeTier2Listener,
-    UniqueLinkData* maybeLinkData) {
+    JS::OptimizedEncodingListener* maybeTier2Listener) {
   MOZ_ASSERT(mode() == CompileMode::Once || mode() == CompileMode::Tier1);
 
   UniqueCodeTier codeTier = finishCodeTier();
   if (!codeTier) {
     return nullptr;
   }
 
   JumpTables jumpTables;
@@ -1208,21 +1207,16 @@ SharedModule ModuleGenerator::finishModu
   }
 
   if (mode() == CompileMode::Tier1) {
     module->startTier2(*compileArgs_, bytecode, maybeTier2Listener);
   } else if (tier() == Tier::Serialized && maybeTier2Listener) {
     module->serialize(*linkData_, *maybeTier2Listener);
   }
 
-  if (maybeLinkData) {
-    MOZ_ASSERT(!env_->debugEnabled());
-    *maybeLinkData = std::move(linkData_);
-  }
-
   return module;
 }
 
 bool ModuleGenerator::finishTier2(const Module& module) {
   MOZ_ASSERT(mode() == CompileMode::Tier2);
   MOZ_ASSERT(tier() == Tier::Optimized);
   MOZ_ASSERT(!env_->debugEnabled());
 
--- a/js/src/wasm/WasmGenerator.h
+++ b/js/src/wasm/WasmGenerator.h
@@ -215,17 +215,16 @@ class MOZ_STACK_CLASS ModuleGenerator {
   MOZ_MUST_USE bool finishFuncDefs();
 
   // If env->mode is Once or Tier1, finishModule() must be called to generate
   // a new Module. Otherwise, if env->mode is Tier2, finishTier2() must be
   // called to augment the given Module with tier 2 code.
 
   SharedModule finishModule(
       const ShareableBytes& bytecode,
-      JS::OptimizedEncodingListener* maybeTier2Listener = nullptr,
-      UniqueLinkData* maybeLinkData = nullptr);
+      JS::OptimizedEncodingListener* maybeTier2Listener = nullptr);
   MOZ_MUST_USE bool finishTier2(const Module& module);
 };
 
 }  // namespace wasm
 }  // namespace js
 
 #endif  // wasm_generator_h
--- a/js/src/wasm/WasmJS.cpp
+++ b/js/src/wasm/WasmJS.cpp
@@ -447,45 +447,61 @@ bool wasm::Eval(JSContext* cx, Handle<Ty
                   globalObjs.get(), &globals)) {
     return false;
   }
 
   return module->instantiate(cx, funcs, tables.get(), memory, globals,
                              globalObjs.get(), nullptr, instanceObj);
 }
 
+struct MOZ_STACK_CLASS SerializeListener : JS::OptimizedEncodingListener {
+  // MOZ_STACK_CLASS means these can be nops.
+  MozExternalRefCountType MOZ_XPCOM_ABI AddRef() override { return 0; }
+  MozExternalRefCountType MOZ_XPCOM_ABI Release() override { return 0; }
+
+  DebugOnly<bool> called = false;
+  Bytes* serialized;
+  explicit SerializeListener(Bytes* serialized) : serialized(serialized) {}
+
+  void storeOptimizedEncoding(const uint8_t* bytes, size_t length) override {
+    MOZ_ASSERT(!called);
+    called = true;
+    if (serialized->resize(length)) {
+      memcpy(serialized->begin(), bytes, length);
+    }
+  }
+};
+
 bool wasm::CompileAndSerialize(const ShareableBytes& bytecode,
                                Bytes* serialized) {
   MutableCompileArgs compileArgs = js_new<CompileArgs>(ScriptedCaller());
   if (!compileArgs) {
     return false;
   }
 
-  // The caller has ensured HasCachingSupport().
+  // The caller has ensured HasCachingSupport(). Moreover, we want to ensure
+  // we go straight to tier-2 so that we synchronously call
+  // JS::OptimizedEncodingListener::storeOptimizedEncoding().
+  compileArgs->baselineEnabled = false;
   compileArgs->ionEnabled = true;
 
+  SerializeListener listener(serialized);
+
   UniqueChars error;
   UniqueCharsVector warnings;
-  UniqueLinkData linkData;
   SharedModule module =
-      CompileBuffer(*compileArgs, bytecode, &error, &warnings, &linkData);
+      CompileBuffer(*compileArgs, bytecode, &error, &warnings, &listener);
   if (!module) {
     fprintf(stderr, "Compilation error: %s\n", error ? error.get() : "oom");
     return false;
   }
 
   MOZ_ASSERT(module->code().hasTier(Tier::Serialized));
-
-  size_t serializedSize = module->serializedSize(*linkData);
-  if (!serialized->resize(serializedSize)) {
-    return false;
-  }
-
-  module->serialize(*linkData, serialized->begin(), serialized->length());
-  return true;
+  MOZ_ASSERT(listener.called);
+  return !listener.serialized->empty();
 }
 
 bool wasm::DeserializeModule(JSContext* cx, const Bytes& serialized,
                              MutableHandleObject moduleObj) {
   MutableModule module =
       Module::deserialize(serialized.begin(), serialized.length());
   if (!module) {
     ReportOutOfMemory(cx);
--- a/layout/svg/SVGTextFrame.cpp
+++ b/layout/svg/SVGTextFrame.cpp
@@ -3515,17 +3515,17 @@ void SVGTextFrame::ReflowSVG() {
     mRect.SetEmpty();
   } else {
     mRect = nsLayoutUtils::RoundGfxRectToAppRect(r.ToThebesRect(),
                                                  AppUnitsPerCSSPixel());
 
     // Due to rounding issues when we have a transform applied, we sometimes
     // don't include an additional row of pixels.  For now, just inflate our
     // covered region.
-    mRect.Inflate(presContext->AppUnitsPerDevPixel() / mLastContextScale);
+    mRect.Inflate(ceil(presContext->AppUnitsPerDevPixel() / mLastContextScale));
   }
 
   if (mState & NS_FRAME_FIRST_REFLOW) {
     // Make sure we have our filter property (if any) before calling
     // FinishAndStoreOverflow (subsequent filter changes are handled off
     // nsChangeHint_UpdateEffects):
     SVGObserverUtils::UpdateEffects(this);
   }