Commit 1793a448 authored by Wes Kocher's avatar Wes Kocher
Browse files

Merge inbound to m-c

parents 15836c44 1369095e
Loading
Loading
Loading
Loading
+37 −11
Original line number Diff line number Diff line
@@ -163,10 +163,7 @@ Site.prototype = {
    this._node.addEventListener("dragstart", this, false);
    this._node.addEventListener("dragend", this, false);
    this._node.addEventListener("mouseover", this, false);

    let controls = this.node.querySelectorAll(".newtab-control");
    for (let i = 0; i < controls.length; i++)
      controls[i].addEventListener("click", this, false);
    this._node.addEventListener("click", this, false);
  },

  /**
@@ -179,11 +176,31 @@ Site.prototype = {
  },

  /**
   * Handles all site events.
   * Record interaction with site using telemetry.
   */
  handleEvent: function Site_handleEvent(aEvent) {
    switch (aEvent.type) {
      case "click":
  _recordSiteClicked: function Site_recordSiteClicked(aIndex) {
    if (Services.prefs.prefHasUserValue("browser.newtabpage.rows") ||
        Services.prefs.prefHasUserValue("browser.newtabpage.columns") ||
        aIndex > 8) {
      // We only want to get indices for the default configuration, everything
      // else goes in the same bucket.
      aIndex = 9;
    }
    Services.telemetry.getHistogramById("NEWTAB_PAGE_SITE_CLICKED")
                      .add(aIndex);
  },

  /**
   * Handles site click events.
   */
  _onClick: function Site_onClick(aEvent) {
    let target = aEvent.target;
    if (target.classList.contains("newtab-link") ||
        target.parentElement.classList.contains("newtab-link")) {
      this._recordSiteClicked(this.cell.index);
      return;
    }

    aEvent.preventDefault();
    if (aEvent.target.classList.contains("newtab-control-block"))
      this.block();
@@ -191,6 +208,15 @@ Site.prototype = {
      this.unpin();
    else
      this.pin();
  },

  /**
   * Handles all site events.
   */
  handleEvent: function Site_handleEvent(aEvent) {
    switch (aEvent.type) {
      case "click":
        this._onClick(aEvent);
        break;
      case "mouseover":
        this._node.removeEventListener("mouseover", this, false);
+3 −4
Original line number Diff line number Diff line
@@ -119,9 +119,8 @@ nsChromeRegistryChrome::Init()
  mSelectedLocale = NS_LITERAL_CSTRING("en-US");
  mSelectedSkin = NS_LITERAL_CSTRING("classic/1.0");

  if (!PL_DHashTableInit(&mPackagesHash, &kTableOps,
                         nullptr, sizeof(PackageEntry), 16))
    return NS_ERROR_FAILURE;
  PL_DHashTableInit(&mPackagesHash, &kTableOps,
                    nullptr, sizeof(PackageEntry), 16);

  bool safeMode = false;
  nsCOMPtr<nsIXULRuntime> xulrun (do_GetService(XULAPPINFO_SERVICE_CONTRACTID));
+10 −19
Original line number Diff line number Diff line
@@ -192,7 +192,6 @@ already_AddRefed<nsContentList>
NS_GetContentList(nsINode* aRootNode, 
                  int32_t  aMatchNameSpaceId,
                  const nsAString& aTagname)
                  
{
  NS_ASSERTION(aRootNode, "content list has to have a root");

@@ -218,14 +217,10 @@ NS_GetContentList(nsINode* aRootNode,

  // Initialize the hashtable if needed.
  if (!gContentListHashTable.ops) {
    bool success = PL_DHashTableInit(&gContentListHashTable,
    PL_DHashTableInit(&gContentListHashTable,
                      &hash_table_ops, nullptr,
                      sizeof(ContentListHashEntry),
                      16);

    if (!success) {
      gContentListHashTable.ops = nullptr;
    }
  }

  ContentListHashEntry *entry = nullptr;
@@ -339,14 +334,10 @@ GetFuncStringContentList(nsINode* aRootNode,

  // Initialize the hashtable if needed.
  if (!gFuncStringContentListHashTable.ops) {
    bool success = PL_DHashTableInit(&gFuncStringContentListHashTable,
    PL_DHashTableInit(&gFuncStringContentListHashTable,
                      &hash_table_ops, nullptr,
                      sizeof(FuncStringContentListHashEntry),
                      16);

    if (!success) {
      gFuncStringContentListHashTable.ops = nullptr;
    }
  }

  FuncStringContentListHashEntry *entry = nullptr;
+2 −6
Original line number Diff line number Diff line
@@ -413,12 +413,8 @@ nsContentUtils::Init()
      EventListenerManagerHashInitEntry
    };

    if (!PL_DHashTableInit(&sEventListenerManagersHash, &hash_table_ops,
                           nullptr, sizeof(EventListenerManagerMapEntry), 16)) {
      sEventListenerManagersHash.ops = nullptr;

      return NS_ERROR_OUT_OF_MEMORY;
    }
    PL_DHashTableInit(&sEventListenerManagersHash, &hash_table_ops,
                      nullptr, sizeof(EventListenerManagerMapEntry), 16);

    RegisterStrongMemoryReporter(new DOMEventListenerManagersHashReporter());
  }
+3 −4
Original line number Diff line number Diff line
@@ -9,9 +9,8 @@
void
nsContentSupportMap::Init()
{
    if (!PL_DHashTableInit(&mMap, PL_DHashGetStubOps(), nullptr,
                           sizeof(Entry), PL_DHASH_MIN_SIZE))
        mMap.ops = nullptr;
    PL_DHashTableInit(&mMap, PL_DHashGetStubOps(), nullptr,
                      sizeof(Entry), PL_DHASH_MIN_SIZE);
}

void
Loading